aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pcmcia
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/pcmcia')
-rw-r--r--drivers/net/pcmcia/3c574_cs.c129
-rw-r--r--drivers/net/pcmcia/3c589_cs.c66
-rw-r--r--drivers/net/pcmcia/axnet_cs.c335
-rw-r--r--drivers/net/pcmcia/com20020_cs.c77
-rw-r--r--drivers/net/pcmcia/fmvj18x_cs.c130
-rw-r--r--drivers/net/pcmcia/ibmtr_cs.c117
-rw-r--r--drivers/net/pcmcia/nmclan_cs.c102
-rw-r--r--drivers/net/pcmcia/pcnet_cs.c257
-rw-r--r--drivers/net/pcmcia/smc91c92_cs.c229
-rw-r--r--drivers/net/pcmcia/xirc2ps_cs.c267
10 files changed, 619 insertions, 1090 deletions
diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c
index c683f77c6f42..34c5e1cbf65d 100644
--- a/drivers/net/pcmcia/3c574_cs.c
+++ b/drivers/net/pcmcia/3c574_cs.c
@@ -62,13 +62,15 @@ invalid ramWidth is Very Bad.
62V. References 62V. References
63 63
64http://www.scyld.com/expert/NWay.html 64http://www.scyld.com/expert/NWay.html
65http://www.national.com/pf/DP/DP83840.html 65http://www.national.com/opf/DP/DP83840A.html
66 66
67Thanks to Terry Murphy of 3Com for providing development information for 67Thanks to Terry Murphy of 3Com for providing development information for
68earlier 3Com products. 68earlier 3Com products.
69 69
70*/ 70*/
71 71
72#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
73
72#include <linux/module.h> 74#include <linux/module.h>
73#include <linux/kernel.h> 75#include <linux/kernel.h>
74#include <linux/init.h> 76#include <linux/init.h>
@@ -83,11 +85,9 @@ earlier 3Com products.
83#include <linux/skbuff.h> 85#include <linux/skbuff.h>
84#include <linux/if_arp.h> 86#include <linux/if_arp.h>
85#include <linux/ioport.h> 87#include <linux/ioport.h>
86#include <linux/ethtool.h>
87#include <linux/bitops.h> 88#include <linux/bitops.h>
88#include <linux/mii.h> 89#include <linux/mii.h>
89 90
90#include <pcmcia/cs.h>
91#include <pcmcia/cistpl.h> 91#include <pcmcia/cistpl.h>
92#include <pcmcia/cisreg.h> 92#include <pcmcia/cisreg.h>
93#include <pcmcia/ciscode.h> 93#include <pcmcia/ciscode.h>
@@ -238,7 +238,6 @@ static int el3_rx(struct net_device *dev, int worklimit);
238static int el3_close(struct net_device *dev); 238static int el3_close(struct net_device *dev);
239static void el3_tx_timeout(struct net_device *dev); 239static void el3_tx_timeout(struct net_device *dev);
240static int el3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); 240static int el3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
241static const struct ethtool_ops netdev_ethtool_ops;
242static void set_rx_mode(struct net_device *dev); 241static void set_rx_mode(struct net_device *dev);
243static void set_multicast_list(struct net_device *dev); 242static void set_multicast_list(struct net_device *dev);
244 243
@@ -280,25 +279,14 @@ static int tc574_probe(struct pcmcia_device *link)
280 spin_lock_init(&lp->window_lock); 279 spin_lock_init(&lp->window_lock);
281 link->resource[0]->end = 32; 280 link->resource[0]->end = 32;
282 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16; 281 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16;
283 link->conf.Attributes = CONF_ENABLE_IRQ; 282 link->config_flags |= CONF_ENABLE_IRQ;
284 link->conf.IntType = INT_MEMORY_AND_IO; 283 link->config_index = 1;
285 link->conf.ConfigIndex = 1;
286 284
287 dev->netdev_ops = &el3_netdev_ops; 285 dev->netdev_ops = &el3_netdev_ops;
288 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
289 dev->watchdog_timeo = TX_TIMEOUT; 286 dev->watchdog_timeo = TX_TIMEOUT;
290 287
291 return tc574_config(link); 288 return tc574_config(link);
292} /* tc574_attach */ 289}
293
294/*
295
296 This deletes a driver "instance". The device is de-registered
297 with Card Services. If it has been released, all local data
298 structures are freed. Otherwise, the structures will be freed
299 when the device is released.
300
301*/
302 290
303static void tc574_detach(struct pcmcia_device *link) 291static void tc574_detach(struct pcmcia_device *link)
304{ 292{
@@ -313,12 +301,6 @@ static void tc574_detach(struct pcmcia_device *link)
313 free_netdev(dev); 301 free_netdev(dev);
314} /* tc574_detach */ 302} /* tc574_detach */
315 303
316/*
317 tc574_config() is scheduled to run after a CARD_INSERTION event
318 is received, to configure the PCMCIA socket, and to make the
319 ethernet device available to the system.
320*/
321
322static const char *ram_split[] = {"5:3", "3:1", "1:1", "3:5"}; 304static const char *ram_split[] = {"5:3", "3:1", "1:1", "3:5"};
323 305
324static int tc574_config(struct pcmcia_device *link) 306static int tc574_config(struct pcmcia_device *link)
@@ -352,7 +334,7 @@ static int tc574_config(struct pcmcia_device *link)
352 if (ret) 334 if (ret)
353 goto failed; 335 goto failed;
354 336
355 ret = pcmcia_request_configuration(link, &link->conf); 337 ret = pcmcia_enable_device(link);
356 if (ret) 338 if (ret)
357 goto failed; 339 goto failed;
358 340
@@ -376,8 +358,8 @@ static int tc574_config(struct pcmcia_device *link)
376 for (i = 0; i < 3; i++) 358 for (i = 0; i < 3; i++)
377 phys_addr[i] = htons(read_eeprom(ioaddr, i + 10)); 359 phys_addr[i] = htons(read_eeprom(ioaddr, i + 10));
378 if (phys_addr[0] == htons(0x6060)) { 360 if (phys_addr[0] == htons(0x6060)) {
379 printk(KERN_NOTICE "3c574_cs: IO port conflict at 0x%03lx" 361 pr_notice("IO port conflict at 0x%03lx-0x%03lx\n",
380 "-0x%03lx\n", dev->base_addr, dev->base_addr+15); 362 dev->base_addr, dev->base_addr+15);
381 goto failed; 363 goto failed;
382 } 364 }
383 } 365 }
@@ -391,7 +373,7 @@ static int tc574_config(struct pcmcia_device *link)
391 outw(2<<11, ioaddr + RunnerRdCtrl); 373 outw(2<<11, ioaddr + RunnerRdCtrl);
392 mcr = inb(ioaddr + 2); 374 mcr = inb(ioaddr + 2);
393 outw(0<<11, ioaddr + RunnerRdCtrl); 375 outw(0<<11, ioaddr + RunnerRdCtrl);
394 printk(KERN_INFO " ASIC rev %d,", mcr>>3); 376 pr_info(" ASIC rev %d,", mcr>>3);
395 EL3WINDOW(3); 377 EL3WINDOW(3);
396 config = inl(ioaddr + Wn3_Config); 378 config = inl(ioaddr + Wn3_Config);
397 lp->default_media = (config & Xcvr) >> Xcvr_shift; 379 lp->default_media = (config & Xcvr) >> Xcvr_shift;
@@ -428,7 +410,7 @@ static int tc574_config(struct pcmcia_device *link)
428 } 410 }
429 } 411 }
430 if (phy > 32) { 412 if (phy > 32) {
431 printk(KERN_NOTICE " No MII transceivers found!\n"); 413 pr_notice(" No MII transceivers found!\n");
432 goto failed; 414 goto failed;
433 } 415 }
434 i = mdio_read(ioaddr, lp->phys, 16) | 0x40; 416 i = mdio_read(ioaddr, lp->phys, 16) | 0x40;
@@ -444,18 +426,16 @@ static int tc574_config(struct pcmcia_device *link)
444 SET_NETDEV_DEV(dev, &link->dev); 426 SET_NETDEV_DEV(dev, &link->dev);
445 427
446 if (register_netdev(dev) != 0) { 428 if (register_netdev(dev) != 0) {
447 printk(KERN_NOTICE "3c574_cs: register_netdev() failed\n"); 429 pr_notice("register_netdev() failed\n");
448 goto failed; 430 goto failed;
449 } 431 }
450 432
451 printk(KERN_INFO "%s: %s at io %#3lx, irq %d, " 433 netdev_info(dev, "%s at io %#3lx, irq %d, hw_addr %pM\n",
452 "hw_addr %pM.\n", 434 cardname, dev->base_addr, dev->irq, dev->dev_addr);
453 dev->name, cardname, dev->base_addr, dev->irq, 435 netdev_info(dev, " %dK FIFO split %s Rx:Tx, %sMII interface.\n",
454 dev->dev_addr); 436 8 << config & Ram_size,
455 printk(" %dK FIFO split %s Rx:Tx, %sMII interface.\n", 437 ram_split[(config & Ram_split) >> Ram_split_shift],
456 8 << config & Ram_size, 438 config & Autoselect ? "autoselect " : "");
457 ram_split[(config & Ram_split) >> Ram_split_shift],
458 config & Autoselect ? "autoselect " : "");
459 439
460 return 0; 440 return 0;
461 441
@@ -465,12 +445,6 @@ failed:
465 445
466} /* tc574_config */ 446} /* tc574_config */
467 447
468/*
469 After a card is removed, tc574_release() will unregister the net
470 device, and release the PCMCIA configuration. If the device is
471 still open, this will be postponed until it is closed.
472*/
473
474static void tc574_release(struct pcmcia_device *link) 448static void tc574_release(struct pcmcia_device *link)
475{ 449{
476 pcmcia_disable_device(link); 450 pcmcia_disable_device(link);
@@ -502,14 +476,14 @@ static void dump_status(struct net_device *dev)
502{ 476{
503 unsigned int ioaddr = dev->base_addr; 477 unsigned int ioaddr = dev->base_addr;
504 EL3WINDOW(1); 478 EL3WINDOW(1);
505 printk(KERN_INFO " irq status %04x, rx status %04x, tx status " 479 netdev_info(dev, " irq status %04x, rx status %04x, tx status %02x, tx free %04x\n",
506 "%02x, tx free %04x\n", inw(ioaddr+EL3_STATUS), 480 inw(ioaddr+EL3_STATUS),
507 inw(ioaddr+RxStatus), inb(ioaddr+TxStatus), 481 inw(ioaddr+RxStatus), inb(ioaddr+TxStatus),
508 inw(ioaddr+TxFree)); 482 inw(ioaddr+TxFree));
509 EL3WINDOW(4); 483 EL3WINDOW(4);
510 printk(KERN_INFO " diagnostics: fifo %04x net %04x ethernet %04x" 484 netdev_info(dev, " diagnostics: fifo %04x net %04x ethernet %04x media %04x\n",
511 " media %04x\n", inw(ioaddr+0x04), inw(ioaddr+0x06), 485 inw(ioaddr+0x04), inw(ioaddr+0x06),
512 inw(ioaddr+0x08), inw(ioaddr+0x0a)); 486 inw(ioaddr+0x08), inw(ioaddr+0x0a));
513 EL3WINDOW(1); 487 EL3WINDOW(1);
514} 488}
515 489
@@ -523,7 +497,7 @@ static void tc574_wait_for_completion(struct net_device *dev, int cmd)
523 while (--i > 0) 497 while (--i > 0)
524 if (!(inw(dev->base_addr + EL3_STATUS) & 0x1000)) break; 498 if (!(inw(dev->base_addr + EL3_STATUS) & 0x1000)) break;
525 if (i == 0) 499 if (i == 0)
526 printk(KERN_NOTICE "%s: command 0x%04x did not complete!\n", dev->name, cmd); 500 netdev_notice(dev, "command 0x%04x did not complete!\n", cmd);
527} 501}
528 502
529/* Read a word from the EEPROM using the regular EEPROM access register. 503/* Read a word from the EEPROM using the regular EEPROM access register.
@@ -710,7 +684,7 @@ static int el3_open(struct net_device *dev)
710 netif_start_queue(dev); 684 netif_start_queue(dev);
711 685
712 tc574_reset(dev); 686 tc574_reset(dev);
713 lp->media.function = &media_check; 687 lp->media.function = media_check;
714 lp->media.data = (unsigned long) dev; 688 lp->media.data = (unsigned long) dev;
715 lp->media.expires = jiffies + HZ; 689 lp->media.expires = jiffies + HZ;
716 add_timer(&lp->media); 690 add_timer(&lp->media);
@@ -725,7 +699,7 @@ static void el3_tx_timeout(struct net_device *dev)
725{ 699{
726 unsigned int ioaddr = dev->base_addr; 700 unsigned int ioaddr = dev->base_addr;
727 701
728 printk(KERN_NOTICE "%s: Transmit timed out!\n", dev->name); 702 netdev_notice(dev, "Transmit timed out!\n");
729 dump_status(dev); 703 dump_status(dev);
730 dev->stats.tx_errors++; 704 dev->stats.tx_errors++;
731 dev->trans_start = jiffies; /* prevent tx timeout */ 705 dev->trans_start = jiffies; /* prevent tx timeout */
@@ -848,8 +822,8 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id)
848 EL3WINDOW(4); 822 EL3WINDOW(4);
849 fifo_diag = inw(ioaddr + Wn4_FIFODiag); 823 fifo_diag = inw(ioaddr + Wn4_FIFODiag);
850 EL3WINDOW(1); 824 EL3WINDOW(1);
851 printk(KERN_NOTICE "%s: adapter failure, FIFO diagnostic" 825 netdev_notice(dev, "adapter failure, FIFO diagnostic register %04x\n",
852 " register %04x.\n", dev->name, fifo_diag); 826 fifo_diag);
853 if (fifo_diag & 0x0400) { 827 if (fifo_diag & 0x0400) {
854 /* Tx overrun */ 828 /* Tx overrun */
855 tc574_wait_for_completion(dev, TxReset); 829 tc574_wait_for_completion(dev, TxReset);
@@ -903,7 +877,7 @@ static void media_check(unsigned long arg)
903 this, we can limp along even if the interrupt is blocked */ 877 this, we can limp along even if the interrupt is blocked */
904 if ((inw(ioaddr + EL3_STATUS) & IntLatch) && (inb(ioaddr + Timer) == 0xff)) { 878 if ((inw(ioaddr + EL3_STATUS) & IntLatch) && (inb(ioaddr + Timer) == 0xff)) {
905 if (!lp->fast_poll) 879 if (!lp->fast_poll)
906 printk(KERN_INFO "%s: interrupt(s) dropped!\n", dev->name); 880 netdev_info(dev, "interrupt(s) dropped!\n");
907 881
908 local_irq_save(flags); 882 local_irq_save(flags);
909 el3_interrupt(dev->irq, dev); 883 el3_interrupt(dev->irq, dev);
@@ -926,23 +900,21 @@ static void media_check(unsigned long arg)
926 900
927 if (media != lp->media_status) { 901 if (media != lp->media_status) {
928 if ((media ^ lp->media_status) & 0x0004) 902 if ((media ^ lp->media_status) & 0x0004)
929 printk(KERN_INFO "%s: %s link beat\n", dev->name, 903 netdev_info(dev, "%s link beat\n",
930 (lp->media_status & 0x0004) ? "lost" : "found"); 904 (lp->media_status & 0x0004) ? "lost" : "found");
931 if ((media ^ lp->media_status) & 0x0020) { 905 if ((media ^ lp->media_status) & 0x0020) {
932 lp->partner = 0; 906 lp->partner = 0;
933 if (lp->media_status & 0x0020) { 907 if (lp->media_status & 0x0020) {
934 printk(KERN_INFO "%s: autonegotiation restarted\n", 908 netdev_info(dev, "autonegotiation restarted\n");
935 dev->name);
936 } else if (partner) { 909 } else if (partner) {
937 partner &= lp->advertising; 910 partner &= lp->advertising;
938 lp->partner = partner; 911 lp->partner = partner;
939 printk(KERN_INFO "%s: autonegotiation complete: " 912 netdev_info(dev, "autonegotiation complete: "
940 "%sbaseT-%cD selected\n", dev->name, 913 "%dbaseT-%cD selected\n",
941 ((partner & 0x0180) ? "100" : "10"), 914 (partner & 0x0180) ? 100 : 10,
942 ((partner & 0x0140) ? 'F' : 'H')); 915 (partner & 0x0140) ? 'F' : 'H');
943 } else { 916 } else {
944 printk(KERN_INFO "%s: link partner did not autonegotiate\n", 917 netdev_info(dev, "link partner did not autonegotiate\n");
945 dev->name);
946 } 918 }
947 919
948 EL3WINDOW(3); 920 EL3WINDOW(3);
@@ -952,10 +924,9 @@ static void media_check(unsigned long arg)
952 924
953 } 925 }
954 if (media & 0x0010) 926 if (media & 0x0010)
955 printk(KERN_INFO "%s: remote fault detected\n", 927 netdev_info(dev, "remote fault detected\n");
956 dev->name);
957 if (media & 0x0002) 928 if (media & 0x0002)
958 printk(KERN_INFO "%s: jabber detected\n", dev->name); 929 netdev_info(dev, "jabber detected\n");
959 lp->media_status = media; 930 lp->media_status = media;
960 } 931 }
961 spin_unlock_irqrestore(&lp->window_lock, flags); 932 spin_unlock_irqrestore(&lp->window_lock, flags);
@@ -979,7 +950,7 @@ static struct net_device_stats *el3_get_stats(struct net_device *dev)
979} 950}
980 951
981/* Update statistics. 952/* Update statistics.
982 Suprisingly this need not be run single-threaded, but it effectively is. 953 Surprisingly this need not be run single-threaded, but it effectively is.
983 The counters clear when read, so the adds must merely be atomic. 954 The counters clear when read, so the adds must merely be atomic.
984 */ 955 */
985static void update_stats(struct net_device *dev) 956static void update_stats(struct net_device *dev)
@@ -1065,16 +1036,6 @@ static int el3_rx(struct net_device *dev, int worklimit)
1065 return worklimit; 1036 return worklimit;
1066} 1037}
1067 1038
1068static void netdev_get_drvinfo(struct net_device *dev,
1069 struct ethtool_drvinfo *info)
1070{
1071 strcpy(info->driver, "3c574_cs");
1072}
1073
1074static const struct ethtool_ops netdev_ethtool_ops = {
1075 .get_drvinfo = netdev_get_drvinfo,
1076};
1077
1078/* Provide ioctl() calls to examine the MII xcvr state. */ 1039/* Provide ioctl() calls to examine the MII xcvr state. */
1079static int el3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) 1040static int el3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
1080{ 1041{
@@ -1189,7 +1150,7 @@ static int el3_close(struct net_device *dev)
1189 return 0; 1150 return 0;
1190} 1151}
1191 1152
1192static struct pcmcia_device_id tc574_ids[] = { 1153static const struct pcmcia_device_id tc574_ids[] = {
1193 PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0574), 1154 PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0574),
1194 PCMCIA_MFC_DEVICE_CIS_MANF_CARD(0, 0x0101, 0x0556, "cis/3CCFEM556.cis"), 1155 PCMCIA_MFC_DEVICE_CIS_MANF_CARD(0, 0x0101, 0x0556, "cis/3CCFEM556.cis"),
1195 PCMCIA_DEVICE_NULL, 1156 PCMCIA_DEVICE_NULL,
@@ -1198,9 +1159,7 @@ MODULE_DEVICE_TABLE(pcmcia, tc574_ids);
1198 1159
1199static struct pcmcia_driver tc574_driver = { 1160static struct pcmcia_driver tc574_driver = {
1200 .owner = THIS_MODULE, 1161 .owner = THIS_MODULE,
1201 .drv = { 1162 .name = "3c574_cs",
1202 .name = "3c574_cs",
1203 },
1204 .probe = tc574_probe, 1163 .probe = tc574_probe,
1205 .remove = tc574_detach, 1164 .remove = tc574_detach,
1206 .id_table = tc574_ids, 1165 .id_table = tc574_ids,
diff --git a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c
index 61f9cf2100ff..4a1a35809807 100644
--- a/drivers/net/pcmcia/3c589_cs.c
+++ b/drivers/net/pcmcia/3c589_cs.c
@@ -19,6 +19,8 @@
19 19
20======================================================================*/ 20======================================================================*/
21 21
22#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
23
22#define DRV_NAME "3c589_cs" 24#define DRV_NAME "3c589_cs"
23#define DRV_VERSION "1.162-ac" 25#define DRV_VERSION "1.162-ac"
24 26
@@ -41,7 +43,6 @@
41#include <linux/bitops.h> 43#include <linux/bitops.h>
42#include <linux/jiffies.h> 44#include <linux/jiffies.h>
43 45
44#include <pcmcia/cs.h>
45#include <pcmcia/cistpl.h> 46#include <pcmcia/cistpl.h>
46#include <pcmcia/cisreg.h> 47#include <pcmcia/cisreg.h>
47#include <pcmcia/ciscode.h> 48#include <pcmcia/ciscode.h>
@@ -176,14 +177,6 @@ static const struct ethtool_ops netdev_ethtool_ops;
176 177
177static void tc589_detach(struct pcmcia_device *p_dev); 178static void tc589_detach(struct pcmcia_device *p_dev);
178 179
179/*======================================================================
180
181 tc589_attach() creates an "instance" of the driver, allocating
182 local data structures for one device. The device is registered
183 with Card Services.
184
185======================================================================*/
186
187static const struct net_device_ops el3_netdev_ops = { 180static const struct net_device_ops el3_netdev_ops = {
188 .ndo_open = el3_open, 181 .ndo_open = el3_open,
189 .ndo_stop = el3_close, 182 .ndo_stop = el3_close,
@@ -216,9 +209,8 @@ static int tc589_probe(struct pcmcia_device *link)
216 link->resource[0]->end = 16; 209 link->resource[0]->end = 16;
217 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16; 210 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16;
218 211
219 link->conf.Attributes = CONF_ENABLE_IRQ; 212 link->config_flags |= CONF_ENABLE_IRQ;
220 link->conf.IntType = INT_MEMORY_AND_IO; 213 link->config_index = 1;
221 link->conf.ConfigIndex = 1;
222 214
223 dev->netdev_ops = &el3_netdev_ops; 215 dev->netdev_ops = &el3_netdev_ops;
224 dev->watchdog_timeo = TX_TIMEOUT; 216 dev->watchdog_timeo = TX_TIMEOUT;
@@ -226,16 +218,7 @@ static int tc589_probe(struct pcmcia_device *link)
226 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); 218 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
227 219
228 return tc589_config(link); 220 return tc589_config(link);
229} /* tc589_attach */ 221}
230
231/*======================================================================
232
233 This deletes a driver "instance". The device is de-registered
234 with Card Services. If it has been released, all local data
235 structures are freed. Otherwise, the structures will be freed
236 when the device is released.
237
238======================================================================*/
239 222
240static void tc589_detach(struct pcmcia_device *link) 223static void tc589_detach(struct pcmcia_device *link)
241{ 224{
@@ -250,21 +233,13 @@ static void tc589_detach(struct pcmcia_device *link)
250 free_netdev(dev); 233 free_netdev(dev);
251} /* tc589_detach */ 234} /* tc589_detach */
252 235
253/*======================================================================
254
255 tc589_config() is scheduled to run after a CARD_INSERTION event
256 is received, to configure the PCMCIA socket, and to make the
257 ethernet device available to the system.
258
259======================================================================*/
260
261static int tc589_config(struct pcmcia_device *link) 236static int tc589_config(struct pcmcia_device *link)
262{ 237{
263 struct net_device *dev = link->priv; 238 struct net_device *dev = link->priv;
264 __be16 *phys_addr; 239 __be16 *phys_addr;
265 int ret, i, j, multi = 0, fifo; 240 int ret, i, j, multi = 0, fifo;
266 unsigned int ioaddr; 241 unsigned int ioaddr;
267 char *ram_split[] = {"5:3", "3:1", "1:1", "3:5"}; 242 static const char * const ram_split[] = {"5:3", "3:1", "1:1", "3:5"};
268 u8 *buf; 243 u8 *buf;
269 size_t len; 244 size_t len;
270 245
@@ -273,8 +248,7 @@ static int tc589_config(struct pcmcia_device *link)
273 phys_addr = (__be16 *)dev->dev_addr; 248 phys_addr = (__be16 *)dev->dev_addr;
274 /* Is this a 3c562? */ 249 /* Is this a 3c562? */
275 if (link->manf_id != MANFID_3COM) 250 if (link->manf_id != MANFID_3COM)
276 printk(KERN_INFO "3c589_cs: hmmm, is this really a " 251 dev_info(&link->dev, "hmmm, is this really a 3Com card??\n");
277 "3Com card??\n");
278 multi = (link->card_id == PRODID_3COM_3C562); 252 multi = (link->card_id == PRODID_3COM_3C562);
279 253
280 link->io_lines = 16; 254 link->io_lines = 16;
@@ -294,7 +268,7 @@ static int tc589_config(struct pcmcia_device *link)
294 if (ret) 268 if (ret)
295 goto failed; 269 goto failed;
296 270
297 ret = pcmcia_request_configuration(link, &link->conf); 271 ret = pcmcia_enable_device(link);
298 if (ret) 272 if (ret)
299 goto failed; 273 goto failed;
300 274
@@ -315,8 +289,8 @@ static int tc589_config(struct pcmcia_device *link)
315 for (i = 0; i < 3; i++) 289 for (i = 0; i < 3; i++)
316 phys_addr[i] = htons(read_eeprom(ioaddr, i)); 290 phys_addr[i] = htons(read_eeprom(ioaddr, i));
317 if (phys_addr[0] == htons(0x6060)) { 291 if (phys_addr[0] == htons(0x6060)) {
318 printk(KERN_ERR "3c589_cs: IO port conflict at 0x%03lx" 292 dev_err(&link->dev, "IO port conflict at 0x%03lx-0x%03lx\n",
319 "-0x%03lx\n", dev->base_addr, dev->base_addr+15); 293 dev->base_addr, dev->base_addr+15);
320 goto failed; 294 goto failed;
321 } 295 }
322 } 296 }
@@ -330,12 +304,12 @@ static int tc589_config(struct pcmcia_device *link)
330 if ((if_port >= 0) && (if_port <= 3)) 304 if ((if_port >= 0) && (if_port <= 3))
331 dev->if_port = if_port; 305 dev->if_port = if_port;
332 else 306 else
333 printk(KERN_ERR "3c589_cs: invalid if_port requested\n"); 307 dev_err(&link->dev, "invalid if_port requested\n");
334 308
335 SET_NETDEV_DEV(dev, &link->dev); 309 SET_NETDEV_DEV(dev, &link->dev);
336 310
337 if (register_netdev(dev) != 0) { 311 if (register_netdev(dev) != 0) {
338 printk(KERN_ERR "3c589_cs: register_netdev() failed\n"); 312 dev_err(&link->dev, "register_netdev() failed\n");
339 goto failed; 313 goto failed;
340 } 314 }
341 315
@@ -352,14 +326,6 @@ failed:
352 return -ENODEV; 326 return -ENODEV;
353} /* tc589_config */ 327} /* tc589_config */
354 328
355/*======================================================================
356
357 After a card is removed, tc589_release() will unregister the net
358 device, and release the PCMCIA configuration. If the device is
359 still open, this will be postponed until it is closed.
360
361======================================================================*/
362
363static void tc589_release(struct pcmcia_device *link) 329static void tc589_release(struct pcmcia_device *link)
364{ 330{
365 pcmcia_disable_device(link); 331 pcmcia_disable_device(link);
@@ -537,7 +503,7 @@ static int el3_open(struct net_device *dev)
537 503
538 tc589_reset(dev); 504 tc589_reset(dev);
539 init_timer(&lp->media); 505 init_timer(&lp->media);
540 lp->media.function = &media_check; 506 lp->media.function = media_check;
541 lp->media.data = (unsigned long) dev; 507 lp->media.data = (unsigned long) dev;
542 lp->media.expires = jiffies + HZ; 508 lp->media.expires = jiffies + HZ;
543 add_timer(&lp->media); 509 add_timer(&lp->media);
@@ -942,7 +908,7 @@ static int el3_close(struct net_device *dev)
942 return 0; 908 return 0;
943} 909}
944 910
945static struct pcmcia_device_id tc589_ids[] = { 911static const struct pcmcia_device_id tc589_ids[] = {
946 PCMCIA_MFC_DEVICE_MANF_CARD(0, 0x0101, 0x0562), 912 PCMCIA_MFC_DEVICE_MANF_CARD(0, 0x0101, 0x0562),
947 PCMCIA_MFC_DEVICE_PROD_ID1(0, "Motorola MARQUIS", 0xf03e4e77), 913 PCMCIA_MFC_DEVICE_PROD_ID1(0, "Motorola MARQUIS", 0xf03e4e77),
948 PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0589), 914 PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0589),
@@ -955,9 +921,7 @@ MODULE_DEVICE_TABLE(pcmcia, tc589_ids);
955 921
956static struct pcmcia_driver tc589_driver = { 922static struct pcmcia_driver tc589_driver = {
957 .owner = THIS_MODULE, 923 .owner = THIS_MODULE,
958 .drv = { 924 .name = "3c589_cs",
959 .name = "3c589_cs",
960 },
961 .probe = tc589_probe, 925 .probe = tc589_probe,
962 .remove = tc589_detach, 926 .remove = tc589_detach,
963 .id_table = tc589_ids, 927 .id_table = tc589_ids,
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c
index 5f05ffb240cc..9953db711969 100644
--- a/drivers/net/pcmcia/axnet_cs.c
+++ b/drivers/net/pcmcia/axnet_cs.c
@@ -24,6 +24,8 @@
24 24
25======================================================================*/ 25======================================================================*/
26 26
27#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
28
27#include <linux/kernel.h> 29#include <linux/kernel.h>
28#include <linux/module.h> 30#include <linux/module.h>
29#include <linux/init.h> 31#include <linux/init.h>
@@ -32,14 +34,12 @@
32#include <linux/timer.h> 34#include <linux/timer.h>
33#include <linux/delay.h> 35#include <linux/delay.h>
34#include <linux/spinlock.h> 36#include <linux/spinlock.h>
35#include <linux/ethtool.h>
36#include <linux/netdevice.h> 37#include <linux/netdevice.h>
37#include <linux/etherdevice.h> 38#include <linux/etherdevice.h>
38#include <linux/crc32.h> 39#include <linux/crc32.h>
39#include <linux/mii.h> 40#include <linux/mii.h>
40#include "../8390.h" 41#include "../8390.h"
41 42
42#include <pcmcia/cs.h>
43#include <pcmcia/cistpl.h> 43#include <pcmcia/cistpl.h>
44#include <pcmcia/ciscode.h> 44#include <pcmcia/ciscode.h>
45#include <pcmcia/ds.h> 45#include <pcmcia/ds.h>
@@ -86,7 +86,6 @@ static netdev_tx_t axnet_start_xmit(struct sk_buff *skb,
86static struct net_device_stats *get_stats(struct net_device *dev); 86static struct net_device_stats *get_stats(struct net_device *dev);
87static void set_multicast_list(struct net_device *dev); 87static void set_multicast_list(struct net_device *dev);
88static void axnet_tx_timeout(struct net_device *dev); 88static void axnet_tx_timeout(struct net_device *dev);
89static const struct ethtool_ops netdev_ethtool_ops;
90static irqreturn_t ei_irq_wrapper(int irq, void *dev_id); 89static irqreturn_t ei_irq_wrapper(int irq, void *dev_id);
91static void ei_watchdog(u_long arg); 90static void ei_watchdog(u_long arg);
92static void axnet_reset_8390(struct net_device *dev); 91static void axnet_reset_8390(struct net_device *dev);
@@ -112,13 +111,14 @@ static irqreturn_t ax_interrupt(int irq, void *dev_id);
112 111
113typedef struct axnet_dev_t { 112typedef struct axnet_dev_t {
114 struct pcmcia_device *p_dev; 113 struct pcmcia_device *p_dev;
115 caddr_t base; 114 caddr_t base;
116 struct timer_list watchdog; 115 struct timer_list watchdog;
117 int stale, fast_poll; 116 int stale, fast_poll;
118 u_short link_status; 117 u_short link_status;
119 u_char duplex_flag; 118 u_char duplex_flag;
120 int phy_id; 119 int phy_id;
121 int flags; 120 int flags;
121 int active_low;
122} axnet_dev_t; 122} axnet_dev_t;
123 123
124static inline axnet_dev_t *PRIV(struct net_device *dev) 124static inline axnet_dev_t *PRIV(struct net_device *dev)
@@ -140,14 +140,6 @@ static const struct net_device_ops axnet_netdev_ops = {
140 .ndo_validate_addr = eth_validate_addr, 140 .ndo_validate_addr = eth_validate_addr,
141}; 141};
142 142
143/*======================================================================
144
145 axnet_attach() creates an "instance" of the driver, allocating
146 local data structures for one device. The device is registered
147 with Card Services.
148
149======================================================================*/
150
151static int axnet_probe(struct pcmcia_device *link) 143static int axnet_probe(struct pcmcia_device *link)
152{ 144{
153 axnet_dev_t *info; 145 axnet_dev_t *info;
@@ -166,26 +158,15 @@ static int axnet_probe(struct pcmcia_device *link)
166 info = PRIV(dev); 158 info = PRIV(dev);
167 info->p_dev = link; 159 info->p_dev = link;
168 link->priv = dev; 160 link->priv = dev;
169 link->conf.Attributes = CONF_ENABLE_IRQ; 161 link->config_flags |= CONF_ENABLE_IRQ;
170 link->conf.IntType = INT_MEMORY_AND_IO;
171 162
172 dev->netdev_ops = &axnet_netdev_ops; 163 dev->netdev_ops = &axnet_netdev_ops;
173 164
174 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
175 dev->watchdog_timeo = TX_TIMEOUT; 165 dev->watchdog_timeo = TX_TIMEOUT;
176 166
177 return axnet_config(link); 167 return axnet_config(link);
178} /* axnet_attach */ 168} /* axnet_attach */
179 169
180/*======================================================================
181
182 This deletes a driver "instance". The device is de-registered
183 with Card Services. If it has been released, all local data
184 structures are freed. Otherwise, the structures will be freed
185 when the device is released.
186
187======================================================================*/
188
189static void axnet_detach(struct pcmcia_device *link) 170static void axnet_detach(struct pcmcia_device *link)
190{ 171{
191 struct net_device *dev = link->priv; 172 struct net_device *dev = link->priv;
@@ -231,7 +212,7 @@ static int get_prom(struct pcmcia_device *link)
231 }; 212 };
232 213
233 /* Not much of a test, but the alternatives are messy */ 214 /* Not much of a test, but the alternatives are messy */
234 if (link->conf.ConfigBase != 0x03c0) 215 if (link->config_base != 0x03c0)
235 return 0; 216 return 0;
236 217
237 axnet_reset_8390(dev); 218 axnet_reset_8390(dev);
@@ -248,14 +229,6 @@ static int get_prom(struct pcmcia_device *link)
248 return 1; 229 return 1;
249} /* get_prom */ 230} /* get_prom */
250 231
251/*======================================================================
252
253 axnet_config() is scheduled to run after a CARD_INSERTION event
254 is received, to configure the PCMCIA socket, and to make the
255 ethernet device available to the system.
256
257======================================================================*/
258
259static int try_io_port(struct pcmcia_device *link) 232static int try_io_port(struct pcmcia_device *link)
260{ 233{
261 int j, ret; 234 int j, ret;
@@ -286,35 +259,16 @@ static int try_io_port(struct pcmcia_device *link)
286 } 259 }
287} 260}
288 261
289static int axnet_configcheck(struct pcmcia_device *p_dev, 262static int axnet_configcheck(struct pcmcia_device *p_dev, void *priv_data)
290 cistpl_cftable_entry_t *cfg,
291 cistpl_cftable_entry_t *dflt,
292 unsigned int vcc,
293 void *priv_data)
294{ 263{
295 int i; 264 if (p_dev->config_index == 0)
296 cistpl_io_t *io = &cfg->io; 265 return -EINVAL;
297 266
298 if (cfg->index == 0 || cfg->io.nwin == 0) 267 p_dev->config_index = 0x05;
268 if (p_dev->resource[0]->end + p_dev->resource[1]->end < 32)
299 return -ENODEV; 269 return -ENODEV;
300 270
301 p_dev->conf.ConfigIndex = 0x05; 271 return try_io_port(p_dev);
302 /* For multifunction cards, by convention, we configure the
303 network function with window 0, and serial with window 1 */
304 if (io->nwin > 1) {
305 i = (io->win[1].len > io->win[0].len);
306 p_dev->resource[1]->start = io->win[1-i].base;
307 p_dev->resource[1]->end = io->win[1-i].len;
308 } else {
309 i = p_dev->resource[1]->end = 0;
310 }
311 p_dev->resource[0]->start = io->win[i].base;
312 p_dev->resource[0]->end = io->win[i].len;
313 p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK;
314 if (p_dev->resource[0]->end + p_dev->resource[1]->end >= 32)
315 return try_io_port(p_dev);
316
317 return -ENODEV;
318} 272}
319 273
320static int axnet_config(struct pcmcia_device *link) 274static int axnet_config(struct pcmcia_device *link)
@@ -326,20 +280,19 @@ static int axnet_config(struct pcmcia_device *link)
326 dev_dbg(&link->dev, "axnet_config(0x%p)\n", link); 280 dev_dbg(&link->dev, "axnet_config(0x%p)\n", link);
327 281
328 /* don't trust the CIS on this; Linksys got it wrong */ 282 /* don't trust the CIS on this; Linksys got it wrong */
329 link->conf.Present = 0x63; 283 link->config_regs = 0x63;
284 link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO;
330 ret = pcmcia_loop_config(link, axnet_configcheck, NULL); 285 ret = pcmcia_loop_config(link, axnet_configcheck, NULL);
331 if (ret != 0) 286 if (ret != 0)
332 goto failed; 287 goto failed;
333 288
334 if (!link->irq) 289 if (!link->irq)
335 goto failed; 290 goto failed;
291
292 if (resource_size(link->resource[1]) == 8)
293 link->config_flags |= CONF_ENABLE_SPKR;
336 294
337 if (resource_size(link->resource[1]) == 8) { 295 ret = pcmcia_enable_device(link);
338 link->conf.Attributes |= CONF_ENABLE_SPKR;
339 link->conf.Status = CCSR_AUDIO_ENA;
340 }
341
342 ret = pcmcia_request_configuration(link, &link->conf);
343 if (ret) 296 if (ret)
344 goto failed; 297 goto failed;
345 298
@@ -347,8 +300,8 @@ static int axnet_config(struct pcmcia_device *link)
347 dev->base_addr = link->resource[0]->start; 300 dev->base_addr = link->resource[0]->start;
348 301
349 if (!get_prom(link)) { 302 if (!get_prom(link)) {
350 printk(KERN_NOTICE "axnet_cs: this is not an AX88190 card!\n"); 303 pr_notice("this is not an AX88190 card!\n");
351 printk(KERN_NOTICE "axnet_cs: use pcnet_cs instead.\n"); 304 pr_notice("use pcnet_cs instead.\n");
352 goto failed; 305 goto failed;
353 } 306 }
354 307
@@ -357,10 +310,10 @@ static int axnet_config(struct pcmcia_device *link)
357 ei_status.tx_start_page = AXNET_START_PG; 310 ei_status.tx_start_page = AXNET_START_PG;
358 ei_status.rx_start_page = AXNET_START_PG + TX_PAGES; 311 ei_status.rx_start_page = AXNET_START_PG + TX_PAGES;
359 ei_status.stop_page = AXNET_STOP_PG; 312 ei_status.stop_page = AXNET_STOP_PG;
360 ei_status.reset_8390 = &axnet_reset_8390; 313 ei_status.reset_8390 = axnet_reset_8390;
361 ei_status.get_8390_hdr = &get_8390_hdr; 314 ei_status.get_8390_hdr = get_8390_hdr;
362 ei_status.block_input = &block_input; 315 ei_status.block_input = block_input;
363 ei_status.block_output = &block_output; 316 ei_status.block_output = block_output;
364 317
365 if (inb(dev->base_addr + AXNET_TEST) != 0) 318 if (inb(dev->base_addr + AXNET_TEST) != 0)
366 info->flags |= IS_AX88790; 319 info->flags |= IS_AX88790;
@@ -370,6 +323,8 @@ static int axnet_config(struct pcmcia_device *link)
370 if (info->flags & IS_AX88790) 323 if (info->flags & IS_AX88790)
371 outb(0x10, dev->base_addr + AXNET_GPIO); /* select Internal PHY */ 324 outb(0x10, dev->base_addr + AXNET_GPIO); /* select Internal PHY */
372 325
326 info->active_low = 0;
327
373 for (i = 0; i < 32; i++) { 328 for (i = 0; i < 32; i++) {
374 j = mdio_read(dev->base_addr + AXNET_MII_EEP, i, 1); 329 j = mdio_read(dev->base_addr + AXNET_MII_EEP, i, 1);
375 j2 = mdio_read(dev->base_addr + AXNET_MII_EEP, i, 2); 330 j2 = mdio_read(dev->base_addr + AXNET_MII_EEP, i, 2);
@@ -377,15 +332,18 @@ static int axnet_config(struct pcmcia_device *link)
377 if ((j != 0) && (j != 0xffff)) break; 332 if ((j != 0) && (j != 0xffff)) break;
378 } 333 }
379 334
380 /* Maybe PHY is in power down mode. (PPD_SET = 1)
381 Bit 2 of CCSR is active low. */
382 if (i == 32) { 335 if (i == 32) {
336 /* Maybe PHY is in power down mode. (PPD_SET = 1)
337 Bit 2 of CCSR is active low. */
383 pcmcia_write_config_byte(link, CISREG_CCSR, 0x04); 338 pcmcia_write_config_byte(link, CISREG_CCSR, 0x04);
384 for (i = 0; i < 32; i++) { 339 for (i = 0; i < 32; i++) {
385 j = mdio_read(dev->base_addr + AXNET_MII_EEP, i, 1); 340 j = mdio_read(dev->base_addr + AXNET_MII_EEP, i, 1);
386 j2 = mdio_read(dev->base_addr + AXNET_MII_EEP, i, 2); 341 j2 = mdio_read(dev->base_addr + AXNET_MII_EEP, i, 2);
387 if (j == j2) continue; 342 if (j == j2) continue;
388 if ((j != 0) && (j != 0xffff)) break; 343 if ((j != 0) && (j != 0xffff)) {
344 info->active_low = 1;
345 break;
346 }
389 } 347 }
390 } 348 }
391 349
@@ -393,19 +351,18 @@ static int axnet_config(struct pcmcia_device *link)
393 SET_NETDEV_DEV(dev, &link->dev); 351 SET_NETDEV_DEV(dev, &link->dev);
394 352
395 if (register_netdev(dev) != 0) { 353 if (register_netdev(dev) != 0) {
396 printk(KERN_NOTICE "axnet_cs: register_netdev() failed\n"); 354 pr_notice("register_netdev() failed\n");
397 goto failed; 355 goto failed;
398 } 356 }
399 357
400 printk(KERN_INFO "%s: Asix AX88%d90: io %#3lx, irq %d, " 358 netdev_info(dev, "Asix AX88%d90: io %#3lx, irq %d, hw_addr %pM\n",
401 "hw_addr %pM\n", 359 ((info->flags & IS_AX88790) ? 7 : 1),
402 dev->name, ((info->flags & IS_AX88790) ? 7 : 1), 360 dev->base_addr, dev->irq, dev->dev_addr);
403 dev->base_addr, dev->irq,
404 dev->dev_addr);
405 if (info->phy_id != -1) { 361 if (info->phy_id != -1) {
406 dev_dbg(&link->dev, " MII transceiver at index %d, status %x.\n", info->phy_id, j); 362 netdev_dbg(dev, " MII transceiver at index %d, status %x\n",
363 info->phy_id, j);
407 } else { 364 } else {
408 printk(KERN_NOTICE " No MII transceivers found!\n"); 365 netdev_notice(dev, " No MII transceivers found!\n");
409 } 366 }
410 return 0; 367 return 0;
411 368
@@ -414,14 +371,6 @@ failed:
414 return -ENODEV; 371 return -ENODEV;
415} /* axnet_config */ 372} /* axnet_config */
416 373
417/*======================================================================
418
419 After a card is removed, axnet_release() will unregister the net
420 device, and release the PCMCIA configuration. If the device is
421 still open, this will be postponed until it is closed.
422
423======================================================================*/
424
425static void axnet_release(struct pcmcia_device *link) 374static void axnet_release(struct pcmcia_device *link)
426{ 375{
427 pcmcia_disable_device(link); 376 pcmcia_disable_device(link);
@@ -440,8 +389,12 @@ static int axnet_suspend(struct pcmcia_device *link)
440static int axnet_resume(struct pcmcia_device *link) 389static int axnet_resume(struct pcmcia_device *link)
441{ 390{
442 struct net_device *dev = link->priv; 391 struct net_device *dev = link->priv;
392 axnet_dev_t *info = PRIV(dev);
443 393
444 if (link->open) { 394 if (link->open) {
395 if (info->active_low == 1)
396 pcmcia_write_config_byte(link, CISREG_CCSR, 0x04);
397
445 axnet_reset_8390(dev); 398 axnet_reset_8390(dev);
446 AX88190_init(dev, 1); 399 AX88190_init(dev, 1);
447 netif_device_attach(dev); 400 netif_device_attach(dev);
@@ -532,7 +485,7 @@ static int axnet_open(struct net_device *dev)
532 485
533 info->link_status = 0x00; 486 info->link_status = 0x00;
534 init_timer(&info->watchdog); 487 init_timer(&info->watchdog);
535 info->watchdog.function = &ei_watchdog; 488 info->watchdog.function = ei_watchdog;
536 info->watchdog.data = (u_long)dev; 489 info->watchdog.data = (u_long)dev;
537 info->watchdog.expires = jiffies + HZ; 490 info->watchdog.expires = jiffies + HZ;
538 add_timer(&info->watchdog); 491 add_timer(&info->watchdog);
@@ -585,8 +538,7 @@ static void axnet_reset_8390(struct net_device *dev)
585 outb_p(ENISR_RESET, nic_base + EN0_ISR); /* Ack intr. */ 538 outb_p(ENISR_RESET, nic_base + EN0_ISR); /* Ack intr. */
586 539
587 if (i == 100) 540 if (i == 100)
588 printk(KERN_ERR "%s: axnet_reset_8390() did not complete.\n", 541 netdev_err(dev, "axnet_reset_8390() did not complete\n");
589 dev->name);
590 542
591} /* axnet_reset_8390 */ 543} /* axnet_reset_8390 */
592 544
@@ -613,7 +565,7 @@ static void ei_watchdog(u_long arg)
613 this, we can limp along even if the interrupt is blocked */ 565 this, we can limp along even if the interrupt is blocked */
614 if (info->stale++ && (inb_p(nic_base + EN0_ISR) & ENISR_ALL)) { 566 if (info->stale++ && (inb_p(nic_base + EN0_ISR) & ENISR_ALL)) {
615 if (!info->fast_poll) 567 if (!info->fast_poll)
616 printk(KERN_INFO "%s: interrupt(s) dropped!\n", dev->name); 568 netdev_info(dev, "interrupt(s) dropped!\n");
617 ei_irq_wrapper(dev->irq, dev); 569 ei_irq_wrapper(dev->irq, dev);
618 info->fast_poll = HZ; 570 info->fast_poll = HZ;
619 } 571 }
@@ -628,7 +580,7 @@ static void ei_watchdog(u_long arg)
628 goto reschedule; 580 goto reschedule;
629 link = mdio_read(mii_addr, info->phy_id, 1); 581 link = mdio_read(mii_addr, info->phy_id, 1);
630 if (!link || (link == 0xffff)) { 582 if (!link || (link == 0xffff)) {
631 printk(KERN_INFO "%s: MII is missing!\n", dev->name); 583 netdev_info(dev, "MII is missing!\n");
632 info->phy_id = -1; 584 info->phy_id = -1;
633 goto reschedule; 585 goto reschedule;
634 } 586 }
@@ -636,18 +588,14 @@ static void ei_watchdog(u_long arg)
636 link &= 0x0004; 588 link &= 0x0004;
637 if (link != info->link_status) { 589 if (link != info->link_status) {
638 u_short p = mdio_read(mii_addr, info->phy_id, 5); 590 u_short p = mdio_read(mii_addr, info->phy_id, 5);
639 printk(KERN_INFO "%s: %s link beat\n", dev->name, 591 netdev_info(dev, "%s link beat\n", link ? "found" : "lost");
640 (link) ? "found" : "lost");
641 if (link) { 592 if (link) {
642 info->duplex_flag = (p & 0x0140) ? 0x80 : 0x00; 593 info->duplex_flag = (p & 0x0140) ? 0x80 : 0x00;
643 if (p) 594 if (p)
644 printk(KERN_INFO "%s: autonegotiation complete: " 595 netdev_info(dev, "autonegotiation complete: %dbaseT-%cD selected\n",
645 "%sbaseT-%cD selected\n", dev->name, 596 (p & 0x0180) ? 100 : 10, (p & 0x0140) ? 'F' : 'H');
646 ((p & 0x0180) ? "100" : "10"),
647 ((p & 0x0140) ? 'F' : 'H'));
648 else 597 else
649 printk(KERN_INFO "%s: link partner did not autonegotiate\n", 598 netdev_info(dev, "link partner did not autonegotiate\n");
650 dev->name);
651 AX88190_init(dev, 1); 599 AX88190_init(dev, 1);
652 } 600 }
653 info->link_status = link; 601 info->link_status = link;
@@ -658,16 +606,6 @@ reschedule:
658 add_timer(&info->watchdog); 606 add_timer(&info->watchdog);
659} 607}
660 608
661static void netdev_get_drvinfo(struct net_device *dev,
662 struct ethtool_drvinfo *info)
663{
664 strcpy(info->driver, "axnet_cs");
665}
666
667static const struct ethtool_ops netdev_ethtool_ops = {
668 .get_drvinfo = netdev_get_drvinfo,
669};
670
671/*====================================================================*/ 609/*====================================================================*/
672 610
673static int axnet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) 611static int axnet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
@@ -749,9 +687,10 @@ static void block_output(struct net_device *dev, int count,
749 outsw(nic_base + AXNET_DATAPORT, buf, count>>1); 687 outsw(nic_base + AXNET_DATAPORT, buf, count>>1);
750} 688}
751 689
752static struct pcmcia_device_id axnet_ids[] = { 690static const struct pcmcia_device_id axnet_ids[] = {
753 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x016c, 0x0081), 691 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x016c, 0x0081),
754 PCMCIA_DEVICE_MANF_CARD(0x018a, 0x0301), 692 PCMCIA_DEVICE_MANF_CARD(0x018a, 0x0301),
693 PCMCIA_DEVICE_MANF_CARD(0x01bf, 0x2328),
755 PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0301), 694 PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0301),
756 PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0303), 695 PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0303),
757 PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0309), 696 PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0309),
@@ -783,9 +722,7 @@ MODULE_DEVICE_TABLE(pcmcia, axnet_ids);
783 722
784static struct pcmcia_driver axnet_cs_driver = { 723static struct pcmcia_driver axnet_cs_driver = {
785 .owner = THIS_MODULE, 724 .owner = THIS_MODULE,
786 .drv = { 725 .name = "axnet_cs",
787 .name = "axnet_cs",
788 },
789 .probe = axnet_probe, 726 .probe = axnet_probe,
790 .remove = axnet_detach, 727 .remove = axnet_detach,
791 .id_table = axnet_ids, 728 .id_table = axnet_ids,
@@ -843,7 +780,7 @@ module_exit(exit_axnet_cs);
843 Alexey Kuznetsov : use the 8390's six bit hash multicast filter. 780 Alexey Kuznetsov : use the 8390's six bit hash multicast filter.
844 Paul Gortmaker : tweak ANK's above multicast changes a bit. 781 Paul Gortmaker : tweak ANK's above multicast changes a bit.
845 Paul Gortmaker : update packet statistics for v2.1.x 782 Paul Gortmaker : update packet statistics for v2.1.x
846 Alan Cox : support arbitary stupid port mappings on the 783 Alan Cox : support arbitrary stupid port mappings on the
847 68K Macintosh. Support >16bit I/O spaces 784 68K Macintosh. Support >16bit I/O spaces
848 Paul Gortmaker : add kmod support for auto-loading of the 8390 785 Paul Gortmaker : add kmod support for auto-loading of the 8390
849 module by all drivers that require it. 786 module by all drivers that require it.
@@ -855,9 +792,6 @@ module_exit(exit_axnet_cs);
855 792
856 */ 793 */
857 794
858static const char version_8390[] = KERN_INFO \
859 "8390.c:v1.10cvs 9/23/94 Donald Becker (becker@scyld.com)\n";
860
861#include <linux/bitops.h> 795#include <linux/bitops.h>
862#include <asm/irq.h> 796#include <asm/irq.h>
863#include <linux/fcntl.h> 797#include <linux/fcntl.h>
@@ -908,7 +842,7 @@ static void do_set_multicast_list(struct net_device *dev);
908/* 842/*
909 * SMP and the 8390 setup. 843 * SMP and the 8390 setup.
910 * 844 *
911 * The 8390 isnt exactly designed to be multithreaded on RX/TX. There is 845 * The 8390 isn't exactly designed to be multithreaded on RX/TX. There is
912 * a page register that controls bank and packet buffer access. We guard 846 * a page register that controls bank and packet buffer access. We guard
913 * this with ei_local->page_lock. Nobody should assume or set the page other 847 * this with ei_local->page_lock. Nobody should assume or set the page other
914 * than zero when the lock is not held. Lock holders must restore page 0 848 * than zero when the lock is not held. Lock holders must restore page 0
@@ -942,7 +876,7 @@ static void do_set_multicast_list(struct net_device *dev);
942static int ax_open(struct net_device *dev) 876static int ax_open(struct net_device *dev)
943{ 877{
944 unsigned long flags; 878 unsigned long flags;
945 struct ei_device *ei_local = (struct ei_device *) netdev_priv(dev); 879 struct ei_device *ei_local = netdev_priv(dev);
946 880
947 /* 881 /*
948 * Grab the page lock so we own the register set, then call 882 * Grab the page lock so we own the register set, then call
@@ -993,7 +927,7 @@ static int ax_close(struct net_device *dev)
993static void axnet_tx_timeout(struct net_device *dev) 927static void axnet_tx_timeout(struct net_device *dev)
994{ 928{
995 long e8390_base = dev->base_addr; 929 long e8390_base = dev->base_addr;
996 struct ei_device *ei_local = (struct ei_device *) netdev_priv(dev); 930 struct ei_device *ei_local = netdev_priv(dev);
997 int txsr, isr, tickssofar = jiffies - dev_trans_start(dev); 931 int txsr, isr, tickssofar = jiffies - dev_trans_start(dev);
998 unsigned long flags; 932 unsigned long flags;
999 933
@@ -1004,9 +938,11 @@ static void axnet_tx_timeout(struct net_device *dev)
1004 isr = inb(e8390_base+EN0_ISR); 938 isr = inb(e8390_base+EN0_ISR);
1005 spin_unlock_irqrestore(&ei_local->page_lock, flags); 939 spin_unlock_irqrestore(&ei_local->page_lock, flags);
1006 940
1007 printk(KERN_DEBUG "%s: Tx timed out, %s TSR=%#2x, ISR=%#2x, t=%d.\n", 941 netdev_printk(KERN_DEBUG, dev,
1008 dev->name, (txsr & ENTSR_ABT) ? "excess collisions." : 942 "Tx timed out, %s TSR=%#2x, ISR=%#2x, t=%d.\n",
1009 (isr) ? "lost interrupt?" : "cable problem?", txsr, isr, tickssofar); 943 (txsr & ENTSR_ABT) ? "excess collisions." :
944 (isr) ? "lost interrupt?" : "cable problem?",
945 txsr, isr, tickssofar);
1010 946
1011 if (!isr && !dev->stats.tx_packets) 947 if (!isr && !dev->stats.tx_packets)
1012 { 948 {
@@ -1038,7 +974,7 @@ static netdev_tx_t axnet_start_xmit(struct sk_buff *skb,
1038 struct net_device *dev) 974 struct net_device *dev)
1039{ 975{
1040 long e8390_base = dev->base_addr; 976 long e8390_base = dev->base_addr;
1041 struct ei_device *ei_local = (struct ei_device *) netdev_priv(dev); 977 struct ei_device *ei_local = netdev_priv(dev);
1042 int length, send_length, output_page; 978 int length, send_length, output_page;
1043 unsigned long flags; 979 unsigned long flags;
1044 u8 packet[ETH_ZLEN]; 980 u8 packet[ETH_ZLEN];
@@ -1076,22 +1012,28 @@ static netdev_tx_t axnet_start_xmit(struct sk_buff *skb,
1076 output_page = ei_local->tx_start_page; 1012 output_page = ei_local->tx_start_page;
1077 ei_local->tx1 = send_length; 1013 ei_local->tx1 = send_length;
1078 if (ei_debug && ei_local->tx2 > 0) 1014 if (ei_debug && ei_local->tx2 > 0)
1079 printk(KERN_DEBUG "%s: idle transmitter tx2=%d, lasttx=%d, txing=%d.\n", 1015 netdev_printk(KERN_DEBUG, dev,
1080 dev->name, ei_local->tx2, ei_local->lasttx, ei_local->txing); 1016 "idle transmitter tx2=%d, lasttx=%d, txing=%d\n",
1017 ei_local->tx2, ei_local->lasttx,
1018 ei_local->txing);
1081 } 1019 }
1082 else if (ei_local->tx2 == 0) 1020 else if (ei_local->tx2 == 0)
1083 { 1021 {
1084 output_page = ei_local->tx_start_page + TX_PAGES/2; 1022 output_page = ei_local->tx_start_page + TX_PAGES/2;
1085 ei_local->tx2 = send_length; 1023 ei_local->tx2 = send_length;
1086 if (ei_debug && ei_local->tx1 > 0) 1024 if (ei_debug && ei_local->tx1 > 0)
1087 printk(KERN_DEBUG "%s: idle transmitter, tx1=%d, lasttx=%d, txing=%d.\n", 1025 netdev_printk(KERN_DEBUG, dev,
1088 dev->name, ei_local->tx1, ei_local->lasttx, ei_local->txing); 1026 "idle transmitter, tx1=%d, lasttx=%d, txing=%d\n",
1027 ei_local->tx1, ei_local->lasttx,
1028 ei_local->txing);
1089 } 1029 }
1090 else 1030 else
1091 { /* We should never get here. */ 1031 { /* We should never get here. */
1092 if (ei_debug) 1032 if (ei_debug)
1093 printk(KERN_DEBUG "%s: No Tx buffers free! tx1=%d tx2=%d last=%d\n", 1033 netdev_printk(KERN_DEBUG, dev,
1094 dev->name, ei_local->tx1, ei_local->tx2, ei_local->lasttx); 1034 "No Tx buffers free! tx1=%d tx2=%d last=%d\n",
1035 ei_local->tx1, ei_local->tx2,
1036 ei_local->lasttx);
1095 ei_local->irqlock = 0; 1037 ei_local->irqlock = 0;
1096 netif_stop_queue(dev); 1038 netif_stop_queue(dev);
1097 outb_p(ENISR_ALL, e8390_base + EN0_IMR); 1039 outb_p(ENISR_ALL, e8390_base + EN0_IMR);
@@ -1179,23 +1121,26 @@ static irqreturn_t ax_interrupt(int irq, void *dev_id)
1179 1121
1180 spin_lock_irqsave(&ei_local->page_lock, flags); 1122 spin_lock_irqsave(&ei_local->page_lock, flags);
1181 1123
1182 if (ei_local->irqlock) 1124 if (ei_local->irqlock) {
1183 {
1184#if 1 /* This might just be an interrupt for a PCI device sharing this line */ 1125#if 1 /* This might just be an interrupt for a PCI device sharing this line */
1126 const char *msg;
1185 /* The "irqlock" check is only for testing. */ 1127 /* The "irqlock" check is only for testing. */
1186 printk(ei_local->irqlock 1128 if (ei_local->irqlock)
1187 ? "%s: Interrupted while interrupts are masked! isr=%#2x imr=%#2x.\n" 1129 msg = "Interrupted while interrupts are masked!";
1188 : "%s: Reentering the interrupt handler! isr=%#2x imr=%#2x.\n", 1130 else
1189 dev->name, inb_p(e8390_base + EN0_ISR), 1131 msg = "Reentering the interrupt handler!";
1190 inb_p(e8390_base + EN0_IMR)); 1132 netdev_info(dev, "%s, isr=%#2x imr=%#2x\n",
1133 msg,
1134 inb_p(e8390_base + EN0_ISR),
1135 inb_p(e8390_base + EN0_IMR));
1191#endif 1136#endif
1192 spin_unlock_irqrestore(&ei_local->page_lock, flags); 1137 spin_unlock_irqrestore(&ei_local->page_lock, flags);
1193 return IRQ_NONE; 1138 return IRQ_NONE;
1194 } 1139 }
1195 1140
1196 if (ei_debug > 3) 1141 if (ei_debug > 3)
1197 printk(KERN_DEBUG "%s: interrupt(isr=%#2.2x).\n", dev->name, 1142 netdev_printk(KERN_DEBUG, dev, "interrupt(isr=%#2.2x)\n",
1198 inb_p(e8390_base + EN0_ISR)); 1143 inb_p(e8390_base + EN0_ISR));
1199 1144
1200 outb_p(0x00, e8390_base + EN0_ISR); 1145 outb_p(0x00, e8390_base + EN0_ISR);
1201 ei_local->irqlock = 1; 1146 ei_local->irqlock = 1;
@@ -1206,7 +1151,8 @@ static irqreturn_t ax_interrupt(int irq, void *dev_id)
1206 { 1151 {
1207 if (!netif_running(dev) || (interrupts == 0xff)) { 1152 if (!netif_running(dev) || (interrupts == 0xff)) {
1208 if (ei_debug > 1) 1153 if (ei_debug > 1)
1209 printk(KERN_WARNING "%s: interrupt from stopped card\n", dev->name); 1154 netdev_warn(dev,
1155 "interrupt from stopped card\n");
1210 outb_p(interrupts, e8390_base + EN0_ISR); 1156 outb_p(interrupts, e8390_base + EN0_ISR);
1211 interrupts = 0; 1157 interrupts = 0;
1212 break; 1158 break;
@@ -1249,11 +1195,12 @@ static irqreturn_t ax_interrupt(int irq, void *dev_id)
1249 { 1195 {
1250 /* 0xFF is valid for a card removal */ 1196 /* 0xFF is valid for a card removal */
1251 if(interrupts!=0xFF) 1197 if(interrupts!=0xFF)
1252 printk(KERN_WARNING "%s: Too much work at interrupt, status %#2.2x\n", 1198 netdev_warn(dev, "Too much work at interrupt, status %#2.2x\n",
1253 dev->name, interrupts); 1199 interrupts);
1254 outb_p(ENISR_ALL, e8390_base + EN0_ISR); /* Ack. most intrs. */ 1200 outb_p(ENISR_ALL, e8390_base + EN0_ISR); /* Ack. most intrs. */
1255 } else { 1201 } else {
1256 printk(KERN_WARNING "%s: unknown interrupt %#2x\n", dev->name, interrupts); 1202 netdev_warn(dev, "unknown interrupt %#2x\n",
1203 interrupts);
1257 outb_p(0xff, e8390_base + EN0_ISR); /* Ack. all intrs. */ 1204 outb_p(0xff, e8390_base + EN0_ISR); /* Ack. all intrs. */
1258 } 1205 }
1259 } 1206 }
@@ -1287,18 +1234,19 @@ static void ei_tx_err(struct net_device *dev)
1287 unsigned char tx_was_aborted = txsr & (ENTSR_ABT+ENTSR_FU); 1234 unsigned char tx_was_aborted = txsr & (ENTSR_ABT+ENTSR_FU);
1288 1235
1289#ifdef VERBOSE_ERROR_DUMP 1236#ifdef VERBOSE_ERROR_DUMP
1290 printk(KERN_DEBUG "%s: transmitter error (%#2x): ", dev->name, txsr); 1237 netdev_printk(KERN_DEBUG, dev,
1238 "transmitter error (%#2x):", txsr);
1291 if (txsr & ENTSR_ABT) 1239 if (txsr & ENTSR_ABT)
1292 printk("excess-collisions "); 1240 pr_cont(" excess-collisions");
1293 if (txsr & ENTSR_ND) 1241 if (txsr & ENTSR_ND)
1294 printk("non-deferral "); 1242 pr_cont(" non-deferral");
1295 if (txsr & ENTSR_CRS) 1243 if (txsr & ENTSR_CRS)
1296 printk("lost-carrier "); 1244 pr_cont(" lost-carrier");
1297 if (txsr & ENTSR_FU) 1245 if (txsr & ENTSR_FU)
1298 printk("FIFO-underrun "); 1246 pr_cont(" FIFO-underrun");
1299 if (txsr & ENTSR_CDH) 1247 if (txsr & ENTSR_CDH)
1300 printk("lost-heartbeat "); 1248 pr_cont(" lost-heartbeat");
1301 printk("\n"); 1249 pr_cont("\n");
1302#endif 1250#endif
1303 1251
1304 if (tx_was_aborted) 1252 if (tx_was_aborted)
@@ -1323,7 +1271,7 @@ static void ei_tx_err(struct net_device *dev)
1323static void ei_tx_intr(struct net_device *dev) 1271static void ei_tx_intr(struct net_device *dev)
1324{ 1272{
1325 long e8390_base = dev->base_addr; 1273 long e8390_base = dev->base_addr;
1326 struct ei_device *ei_local = (struct ei_device *) netdev_priv(dev); 1274 struct ei_device *ei_local = netdev_priv(dev);
1327 int status = inb(e8390_base + EN0_TSR); 1275 int status = inb(e8390_base + EN0_TSR);
1328 1276
1329 /* 1277 /*
@@ -1335,8 +1283,9 @@ static void ei_tx_intr(struct net_device *dev)
1335 if (ei_local->tx1 < 0) 1283 if (ei_local->tx1 < 0)
1336 { 1284 {
1337 if (ei_local->lasttx != 1 && ei_local->lasttx != -1) 1285 if (ei_local->lasttx != 1 && ei_local->lasttx != -1)
1338 printk(KERN_ERR "%s: bogus last_tx_buffer %d, tx1=%d.\n", 1286 netdev_err(dev, "%s: bogus last_tx_buffer %d, tx1=%d\n",
1339 ei_local->name, ei_local->lasttx, ei_local->tx1); 1287 ei_local->name, ei_local->lasttx,
1288 ei_local->tx1);
1340 ei_local->tx1 = 0; 1289 ei_local->tx1 = 0;
1341 if (ei_local->tx2 > 0) 1290 if (ei_local->tx2 > 0)
1342 { 1291 {
@@ -1351,8 +1300,9 @@ static void ei_tx_intr(struct net_device *dev)
1351 else if (ei_local->tx2 < 0) 1300 else if (ei_local->tx2 < 0)
1352 { 1301 {
1353 if (ei_local->lasttx != 2 && ei_local->lasttx != -2) 1302 if (ei_local->lasttx != 2 && ei_local->lasttx != -2)
1354 printk("%s: bogus last_tx_buffer %d, tx2=%d.\n", 1303 netdev_info(dev, "%s: bogus last_tx_buffer %d, tx2=%d\n",
1355 ei_local->name, ei_local->lasttx, ei_local->tx2); 1304 ei_local->name, ei_local->lasttx,
1305 ei_local->tx2);
1356 ei_local->tx2 = 0; 1306 ei_local->tx2 = 0;
1357 if (ei_local->tx1 > 0) 1307 if (ei_local->tx1 > 0)
1358 { 1308 {
@@ -1365,8 +1315,9 @@ static void ei_tx_intr(struct net_device *dev)
1365 else 1315 else
1366 ei_local->lasttx = 10, ei_local->txing = 0; 1316 ei_local->lasttx = 10, ei_local->txing = 0;
1367 } 1317 }
1368// else printk(KERN_WARNING "%s: unexpected TX-done interrupt, lasttx=%d.\n", 1318// else
1369// dev->name, ei_local->lasttx); 1319// netdev_warn(dev, "unexpected TX-done interrupt, lasttx=%d\n",
1320// ei_local->lasttx);
1370 1321
1371 /* Minimize Tx latency: update the statistics after we restart TXing. */ 1322 /* Minimize Tx latency: update the statistics after we restart TXing. */
1372 if (status & ENTSR_COL) 1323 if (status & ENTSR_COL)
@@ -1404,7 +1355,7 @@ static void ei_tx_intr(struct net_device *dev)
1404static void ei_receive(struct net_device *dev) 1355static void ei_receive(struct net_device *dev)
1405{ 1356{
1406 long e8390_base = dev->base_addr; 1357 long e8390_base = dev->base_addr;
1407 struct ei_device *ei_local = (struct ei_device *) netdev_priv(dev); 1358 struct ei_device *ei_local = netdev_priv(dev);
1408 unsigned char rxing_page, this_frame, next_frame; 1359 unsigned char rxing_page, this_frame, next_frame;
1409 unsigned short current_offset; 1360 unsigned short current_offset;
1410 int rx_pkt_count = 0; 1361 int rx_pkt_count = 0;
@@ -1429,8 +1380,8 @@ static void ei_receive(struct net_device *dev)
1429 is that some clones crash in roughly the same way. 1380 is that some clones crash in roughly the same way.
1430 */ 1381 */
1431 if (ei_debug > 0 && this_frame != ei_local->current_page && (this_frame!=0x0 || rxing_page!=0xFF)) 1382 if (ei_debug > 0 && this_frame != ei_local->current_page && (this_frame!=0x0 || rxing_page!=0xFF))
1432 printk(KERN_ERR "%s: mismatched read page pointers %2x vs %2x.\n", 1383 netdev_err(dev, "mismatched read page pointers %2x vs %2x\n",
1433 dev->name, this_frame, ei_local->current_page); 1384 this_frame, ei_local->current_page);
1434 1385
1435 if (this_frame == rxing_page) /* Read all the frames? */ 1386 if (this_frame == rxing_page) /* Read all the frames? */
1436 break; /* Done for now */ 1387 break; /* Done for now */
@@ -1446,9 +1397,10 @@ static void ei_receive(struct net_device *dev)
1446 if (pkt_len < 60 || pkt_len > 1518) 1397 if (pkt_len < 60 || pkt_len > 1518)
1447 { 1398 {
1448 if (ei_debug) 1399 if (ei_debug)
1449 printk(KERN_DEBUG "%s: bogus packet size: %d, status=%#2x nxpg=%#2x.\n", 1400 netdev_printk(KERN_DEBUG, dev,
1450 dev->name, rx_frame.count, rx_frame.status, 1401 "bogus packet size: %d, status=%#2x nxpg=%#2x\n",
1451 rx_frame.next); 1402 rx_frame.count, rx_frame.status,
1403 rx_frame.next);
1452 dev->stats.rx_errors++; 1404 dev->stats.rx_errors++;
1453 dev->stats.rx_length_errors++; 1405 dev->stats.rx_length_errors++;
1454 } 1406 }
@@ -1460,8 +1412,9 @@ static void ei_receive(struct net_device *dev)
1460 if (skb == NULL) 1412 if (skb == NULL)
1461 { 1413 {
1462 if (ei_debug > 1) 1414 if (ei_debug > 1)
1463 printk(KERN_DEBUG "%s: Couldn't allocate a sk_buff of size %d.\n", 1415 netdev_printk(KERN_DEBUG, dev,
1464 dev->name, pkt_len); 1416 "Couldn't allocate a sk_buff of size %d\n",
1417 pkt_len);
1465 dev->stats.rx_dropped++; 1418 dev->stats.rx_dropped++;
1466 break; 1419 break;
1467 } 1420 }
@@ -1481,9 +1434,10 @@ static void ei_receive(struct net_device *dev)
1481 else 1434 else
1482 { 1435 {
1483 if (ei_debug) 1436 if (ei_debug)
1484 printk(KERN_DEBUG "%s: bogus packet: status=%#2x nxpg=%#2x size=%d\n", 1437 netdev_printk(KERN_DEBUG, dev,
1485 dev->name, rx_frame.status, rx_frame.next, 1438 "bogus packet: status=%#2x nxpg=%#2x size=%d\n",
1486 rx_frame.count); 1439 rx_frame.status, rx_frame.next,
1440 rx_frame.count);
1487 dev->stats.rx_errors++; 1441 dev->stats.rx_errors++;
1488 /* NB: The NIC counts CRC, frame and missed errors. */ 1442 /* NB: The NIC counts CRC, frame and missed errors. */
1489 if (pkt_stat & ENRSR_FO) 1443 if (pkt_stat & ENRSR_FO)
@@ -1493,8 +1447,8 @@ static void ei_receive(struct net_device *dev)
1493 1447
1494 /* This _should_ never happen: it's here for avoiding bad clones. */ 1448 /* This _should_ never happen: it's here for avoiding bad clones. */
1495 if (next_frame >= ei_local->stop_page) { 1449 if (next_frame >= ei_local->stop_page) {
1496 printk("%s: next frame inconsistency, %#2x\n", dev->name, 1450 netdev_info(dev, "next frame inconsistency, %#2x\n",
1497 next_frame); 1451 next_frame);
1498 next_frame = ei_local->rx_start_page; 1452 next_frame = ei_local->rx_start_page;
1499 } 1453 }
1500 ei_local->current_page = next_frame; 1454 ei_local->current_page = next_frame;
@@ -1529,17 +1483,15 @@ static void ei_rx_overrun(struct net_device *dev)
1529 outb_p(E8390_NODMA+E8390_PAGE0+E8390_STOP, e8390_base+E8390_CMD); 1483 outb_p(E8390_NODMA+E8390_PAGE0+E8390_STOP, e8390_base+E8390_CMD);
1530 1484
1531 if (ei_debug > 1) 1485 if (ei_debug > 1)
1532 printk(KERN_DEBUG "%s: Receiver overrun.\n", dev->name); 1486 netdev_printk(KERN_DEBUG, dev, "Receiver overrun\n");
1533 dev->stats.rx_over_errors++; 1487 dev->stats.rx_over_errors++;
1534 1488
1535 /* 1489 /*
1536 * Wait a full Tx time (1.2ms) + some guard time, NS says 1.6ms total. 1490 * Wait a full Tx time (1.2ms) + some guard time, NS says 1.6ms total.
1537 * Early datasheets said to poll the reset bit, but now they say that 1491 * We wait at least 2ms.
1538 * it "is not a reliable indicator and subsequently should be ignored."
1539 * We wait at least 10ms.
1540 */ 1492 */
1541 1493
1542 mdelay(10); 1494 mdelay(2);
1543 1495
1544 /* 1496 /*
1545 * Reset RBCR[01] back to zero as per magic incantation. 1497 * Reset RBCR[01] back to zero as per magic incantation.
@@ -1586,7 +1538,7 @@ static void ei_rx_overrun(struct net_device *dev)
1586static struct net_device_stats *get_stats(struct net_device *dev) 1538static struct net_device_stats *get_stats(struct net_device *dev)
1587{ 1539{
1588 long ioaddr = dev->base_addr; 1540 long ioaddr = dev->base_addr;
1589 struct ei_device *ei_local = (struct ei_device *) netdev_priv(dev); 1541 struct ei_device *ei_local = netdev_priv(dev);
1590 unsigned long flags; 1542 unsigned long flags;
1591 1543
1592 /* If the card is stopped, just return the present stats. */ 1544 /* If the card is stopped, just return the present stats. */
@@ -1635,7 +1587,7 @@ static void do_set_multicast_list(struct net_device *dev)
1635{ 1587{
1636 long e8390_base = dev->base_addr; 1588 long e8390_base = dev->base_addr;
1637 int i; 1589 int i;
1638 struct ei_device *ei_local = (struct ei_device*)netdev_priv(dev); 1590 struct ei_device *ei_local = netdev_priv(dev);
1639 1591
1640 if (!(dev->flags&(IFF_PROMISC|IFF_ALLMULTI))) { 1592 if (!(dev->flags&(IFF_PROMISC|IFF_ALLMULTI))) {
1641 memset(ei_local->mcfilter, 0, 8); 1593 memset(ei_local->mcfilter, 0, 8);
@@ -1693,7 +1645,7 @@ static void AX88190_init(struct net_device *dev, int startp)
1693{ 1645{
1694 axnet_dev_t *info = PRIV(dev); 1646 axnet_dev_t *info = PRIV(dev);
1695 long e8390_base = dev->base_addr; 1647 long e8390_base = dev->base_addr;
1696 struct ei_device *ei_local = (struct ei_device *) netdev_priv(dev); 1648 struct ei_device *ei_local = netdev_priv(dev);
1697 int i; 1649 int i;
1698 int endcfg = ei_local->word16 ? (0x48 | ENDCFG_WTS) : 0x48; 1650 int endcfg = ei_local->word16 ? (0x48 | ENDCFG_WTS) : 0x48;
1699 1651
@@ -1726,7 +1678,7 @@ static void AX88190_init(struct net_device *dev, int startp)
1726 { 1678 {
1727 outb_p(dev->dev_addr[i], e8390_base + EN1_PHYS_SHIFT(i)); 1679 outb_p(dev->dev_addr[i], e8390_base + EN1_PHYS_SHIFT(i));
1728 if(inb_p(e8390_base + EN1_PHYS_SHIFT(i))!=dev->dev_addr[i]) 1680 if(inb_p(e8390_base + EN1_PHYS_SHIFT(i))!=dev->dev_addr[i])
1729 printk(KERN_ERR "Hw. address read/write mismap %d\n",i); 1681 netdev_err(dev, "Hw. address read/write mismap %d\n", i);
1730 } 1682 }
1731 1683
1732 outb_p(ei_local->rx_start_page, e8390_base + EN1_CURPAG); 1684 outb_p(ei_local->rx_start_page, e8390_base + EN1_CURPAG);
@@ -1759,12 +1711,11 @@ static void NS8390_trigger_send(struct net_device *dev, unsigned int length,
1759 int start_page) 1711 int start_page)
1760{ 1712{
1761 long e8390_base = dev->base_addr; 1713 long e8390_base = dev->base_addr;
1762 struct ei_device *ei_local __attribute((unused)) = (struct ei_device *) netdev_priv(dev); 1714 struct ei_device *ei_local __attribute((unused)) = netdev_priv(dev);
1763 1715
1764 if (inb_p(e8390_base) & E8390_TRANS) 1716 if (inb_p(e8390_base) & E8390_TRANS)
1765 { 1717 {
1766 printk(KERN_WARNING "%s: trigger_send() called with the transmitter busy.\n", 1718 netdev_warn(dev, "trigger_send() called with the transmitter busy\n");
1767 dev->name);
1768 return; 1719 return;
1769 } 1720 }
1770 outb_p(length & 0xff, e8390_base + EN0_TCNTLO); 1721 outb_p(length & 0xff, e8390_base + EN0_TCNTLO);
diff --git a/drivers/net/pcmcia/com20020_cs.c b/drivers/net/pcmcia/com20020_cs.c
index 3c400cfa82ae..980e65c14936 100644
--- a/drivers/net/pcmcia/com20020_cs.c
+++ b/drivers/net/pcmcia/com20020_cs.c
@@ -43,7 +43,6 @@
43#include <linux/arcdevice.h> 43#include <linux/arcdevice.h>
44#include <linux/com20020.h> 44#include <linux/com20020.h>
45 45
46#include <pcmcia/cs.h>
47#include <pcmcia/cistpl.h> 46#include <pcmcia/cistpl.h>
48#include <pcmcia/ds.h> 47#include <pcmcia/ds.h>
49 48
@@ -52,23 +51,23 @@
52 51
53#define VERSION "arcnet: COM20020 PCMCIA support loaded.\n" 52#define VERSION "arcnet: COM20020 PCMCIA support loaded.\n"
54 53
55#ifdef DEBUG
56 54
57static void regdump(struct net_device *dev) 55static void regdump(struct net_device *dev)
58{ 56{
57#ifdef DEBUG
59 int ioaddr = dev->base_addr; 58 int ioaddr = dev->base_addr;
60 int count; 59 int count;
61 60
62 printk("com20020 register dump:\n"); 61 netdev_dbg(dev, "register dump:\n");
63 for (count = ioaddr; count < ioaddr + 16; count++) 62 for (count = ioaddr; count < ioaddr + 16; count++)
64 { 63 {
65 if (!(count % 16)) 64 if (!(count % 16))
66 printk("\n%04X: ", count); 65 pr_cont("%04X:", count);
67 printk("%02X ", inb(count)); 66 pr_cont(" %02X", inb(count));
68 } 67 }
69 printk("\n"); 68 pr_cont("\n");
70 69
71 printk("buffer0 dump:\n"); 70 netdev_dbg(dev, "buffer0 dump:\n");
72 /* set up the address register */ 71 /* set up the address register */
73 count = 0; 72 count = 0;
74 outb((count >> 8) | RDDATAflag | AUTOINCflag, _ADDR_HI); 73 outb((count >> 8) | RDDATAflag | AUTOINCflag, _ADDR_HI);
@@ -77,19 +76,15 @@ static void regdump(struct net_device *dev)
77 for (count = 0; count < 256+32; count++) 76 for (count = 0; count < 256+32; count++)
78 { 77 {
79 if (!(count % 16)) 78 if (!(count % 16))
80 printk("\n%04X: ", count); 79 pr_cont("%04X:", count);
81 80
82 /* copy the data */ 81 /* copy the data */
83 printk("%02X ", inb(_MEMDATA)); 82 pr_cont(" %02X", inb(_MEMDATA));
84 } 83 }
85 printk("\n"); 84 pr_cont("\n");
85#endif
86} 86}
87 87
88#else
89
90static inline void regdump(struct net_device *dev) { }
91
92#endif
93 88
94 89
95/*====================================================================*/ 90/*====================================================================*/
@@ -123,14 +118,6 @@ typedef struct com20020_dev_t {
123 struct net_device *dev; 118 struct net_device *dev;
124} com20020_dev_t; 119} com20020_dev_t;
125 120
126/*======================================================================
127
128 com20020_attach() creates an "instance" of the driver, allocating
129 local data structures for one device. The device is registered
130 with Card Services.
131
132======================================================================*/
133
134static int com20020_probe(struct pcmcia_device *p_dev) 121static int com20020_probe(struct pcmcia_device *p_dev)
135{ 122{
136 com20020_dev_t *info; 123 com20020_dev_t *info;
@@ -160,8 +147,7 @@ static int com20020_probe(struct pcmcia_device *p_dev)
160 147
161 p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 148 p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
162 p_dev->resource[0]->end = 16; 149 p_dev->resource[0]->end = 16;
163 p_dev->conf.Attributes = CONF_ENABLE_IRQ; 150 p_dev->config_flags |= CONF_ENABLE_IRQ;
164 p_dev->conf.IntType = INT_MEMORY_AND_IO;
165 151
166 info->dev = dev; 152 info->dev = dev;
167 p_dev->priv = info; 153 p_dev->priv = info;
@@ -174,15 +160,6 @@ fail_alloc_info:
174 return -ENOMEM; 160 return -ENOMEM;
175} /* com20020_attach */ 161} /* com20020_attach */
176 162
177/*======================================================================
178
179 This deletes a driver "instance". The device is de-registered
180 with Card Services. If it has been released, all local data
181 structures are freed. Otherwise, the structures will be freed
182 when the device is released.
183
184======================================================================*/
185
186static void com20020_detach(struct pcmcia_device *link) 163static void com20020_detach(struct pcmcia_device *link)
187{ 164{
188 struct com20020_dev_t *info = link->priv; 165 struct com20020_dev_t *info = link->priv;
@@ -221,14 +198,6 @@ static void com20020_detach(struct pcmcia_device *link)
221 198
222} /* com20020_detach */ 199} /* com20020_detach */
223 200
224/*======================================================================
225
226 com20020_config() is scheduled to run after a CARD_INSERTION event
227 is received, to configure the PCMCIA socket, and to make the
228 device available to the system.
229
230======================================================================*/
231
232static int com20020_config(struct pcmcia_device *link) 201static int com20020_config(struct pcmcia_device *link)
233{ 202{
234 struct arcnet_local *lp; 203 struct arcnet_local *lp;
@@ -282,7 +251,7 @@ static int com20020_config(struct pcmcia_device *link)
282 251
283 dev->irq = link->irq; 252 dev->irq = link->irq;
284 253
285 ret = pcmcia_request_configuration(link, &link->conf); 254 ret = pcmcia_enable_device(link);
286 if (ret) 255 if (ret)
287 goto failed; 256 goto failed;
288 257
@@ -301,13 +270,13 @@ static int com20020_config(struct pcmcia_device *link)
301 i = com20020_found(dev, 0); /* calls register_netdev */ 270 i = com20020_found(dev, 0); /* calls register_netdev */
302 271
303 if (i != 0) { 272 if (i != 0) {
304 dev_printk(KERN_NOTICE, &link->dev, 273 dev_notice(&link->dev,
305 "com20020_cs: com20020_found() failed\n"); 274 "com20020_found() failed\n");
306 goto failed; 275 goto failed;
307 } 276 }
308 277
309 dev_dbg(&link->dev,KERN_INFO "%s: port %#3lx, irq %d\n", 278 netdev_dbg(dev, "port %#3lx, irq %d\n",
310 dev->name, dev->base_addr, dev->irq); 279 dev->base_addr, dev->irq);
311 return 0; 280 return 0;
312 281
313failed: 282failed:
@@ -316,14 +285,6 @@ failed:
316 return -ENODEV; 285 return -ENODEV;
317} /* com20020_config */ 286} /* com20020_config */
318 287
319/*======================================================================
320
321 After a card is removed, com20020_release() will unregister the net
322 device, and release the PCMCIA configuration. If the device is
323 still open, this will be postponed until it is closed.
324
325======================================================================*/
326
327static void com20020_release(struct pcmcia_device *link) 288static void com20020_release(struct pcmcia_device *link)
328{ 289{
329 dev_dbg(&link->dev, "com20020_release\n"); 290 dev_dbg(&link->dev, "com20020_release\n");
@@ -355,7 +316,7 @@ static int com20020_resume(struct pcmcia_device *link)
355 return 0; 316 return 0;
356} 317}
357 318
358static struct pcmcia_device_id com20020_ids[] = { 319static const struct pcmcia_device_id com20020_ids[] = {
359 PCMCIA_DEVICE_PROD_ID12("Contemporary Control Systems, Inc.", 320 PCMCIA_DEVICE_PROD_ID12("Contemporary Control Systems, Inc.",
360 "PCM20 Arcnet Adapter", 0x59991666, 0x95dfffaf), 321 "PCM20 Arcnet Adapter", 0x59991666, 0x95dfffaf),
361 PCMCIA_DEVICE_PROD_ID12("SoHard AG", 322 PCMCIA_DEVICE_PROD_ID12("SoHard AG",
@@ -366,9 +327,7 @@ MODULE_DEVICE_TABLE(pcmcia, com20020_ids);
366 327
367static struct pcmcia_driver com20020_cs_driver = { 328static struct pcmcia_driver com20020_cs_driver = {
368 .owner = THIS_MODULE, 329 .owner = THIS_MODULE,
369 .drv = { 330 .name = "com20020_cs",
370 .name = "com20020_cs",
371 },
372 .probe = com20020_probe, 331 .probe = com20020_probe,
373 .remove = com20020_detach, 332 .remove = com20020_detach,
374 .id_table = com20020_ids, 333 .id_table = com20020_ids,
diff --git a/drivers/net/pcmcia/fmvj18x_cs.c b/drivers/net/pcmcia/fmvj18x_cs.c
index 98fffb03ecd7..723815e7a997 100644
--- a/drivers/net/pcmcia/fmvj18x_cs.c
+++ b/drivers/net/pcmcia/fmvj18x_cs.c
@@ -28,6 +28,8 @@
28 28
29======================================================================*/ 29======================================================================*/
30 30
31#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
32
31#define DRV_NAME "fmvj18x_cs" 33#define DRV_NAME "fmvj18x_cs"
32#define DRV_VERSION "2.9" 34#define DRV_VERSION "2.9"
33 35
@@ -49,7 +51,6 @@
49#include <linux/ioport.h> 51#include <linux/ioport.h>
50#include <linux/crc32.h> 52#include <linux/crc32.h>
51 53
52#include <pcmcia/cs.h>
53#include <pcmcia/cistpl.h> 54#include <pcmcia/cistpl.h>
54#include <pcmcia/ciscode.h> 55#include <pcmcia/ciscode.h>
55#include <pcmcia/ds.h> 56#include <pcmcia/ds.h>
@@ -252,8 +253,7 @@ static int fmvj18x_probe(struct pcmcia_device *link)
252 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 253 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
253 254
254 /* General socket configuration */ 255 /* General socket configuration */
255 link->conf.Attributes = CONF_ENABLE_IRQ; 256 link->config_flags |= CONF_ENABLE_IRQ;
256 link->conf.IntType = INT_MEMORY_AND_IO;
257 257
258 dev->netdev_ops = &fjn_netdev_ops; 258 dev->netdev_ops = &fjn_netdev_ops;
259 dev->watchdog_timeo = TX_TIMEOUT; 259 dev->watchdog_timeo = TX_TIMEOUT;
@@ -291,7 +291,7 @@ static int mfc_try_io_port(struct pcmcia_device *link)
291 link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; 291 link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8;
292 if (link->resource[1]->start == 0) { 292 if (link->resource[1]->start == 0) {
293 link->resource[1]->end = 0; 293 link->resource[1]->end = 0;
294 printk(KERN_NOTICE "fmvj18x_cs: out of resource for serial\n"); 294 pr_notice("out of resource for serial\n");
295 } 295 }
296 ret = pcmcia_request_io(link); 296 ret = pcmcia_request_io(link);
297 if (ret == 0) 297 if (ret == 0)
@@ -313,7 +313,7 @@ static int ungermann_try_io_port(struct pcmcia_device *link)
313 ret = pcmcia_request_io(link); 313 ret = pcmcia_request_io(link);
314 if (ret == 0) { 314 if (ret == 0) {
315 /* calculate ConfigIndex value */ 315 /* calculate ConfigIndex value */
316 link->conf.ConfigIndex = 316 link->config_index =
317 ((link->resource[0]->start & 0x0f0) >> 3) | 0x22; 317 ((link->resource[0]->start & 0x0f0) >> 3) | 0x22;
318 return ret; 318 return ret;
319 } 319 }
@@ -321,11 +321,7 @@ static int ungermann_try_io_port(struct pcmcia_device *link)
321 return ret; /* RequestIO failed */ 321 return ret; /* RequestIO failed */
322} 322}
323 323
324static int fmvj18x_ioprobe(struct pcmcia_device *p_dev, 324static int fmvj18x_ioprobe(struct pcmcia_device *p_dev, void *priv_data)
325 cistpl_cftable_entry_t *cfg,
326 cistpl_cftable_entry_t *dflt,
327 unsigned int vcc,
328 void *priv_data)
329{ 325{
330 return 0; /* strange, but that's what the code did already before... */ 326 return 0; /* strange, but that's what the code did already before... */
331} 327}
@@ -362,28 +358,28 @@ static int fmvj18x_config(struct pcmcia_device *link)
362 link->card_id == PRODID_TDK_NP9610 || 358 link->card_id == PRODID_TDK_NP9610 ||
363 link->card_id == PRODID_TDK_MN3200) { 359 link->card_id == PRODID_TDK_MN3200) {
364 /* MultiFunction Card */ 360 /* MultiFunction Card */
365 link->conf.ConfigBase = 0x800; 361 link->config_base = 0x800;
366 link->conf.ConfigIndex = 0x47; 362 link->config_index = 0x47;
367 link->resource[1]->end = 8; 363 link->resource[1]->end = 8;
368 } 364 }
369 break; 365 break;
370 case MANFID_NEC: 366 case MANFID_NEC:
371 cardtype = NEC; /* MultiFunction Card */ 367 cardtype = NEC; /* MultiFunction Card */
372 link->conf.ConfigBase = 0x800; 368 link->config_base = 0x800;
373 link->conf.ConfigIndex = 0x47; 369 link->config_index = 0x47;
374 link->resource[1]->end = 8; 370 link->resource[1]->end = 8;
375 break; 371 break;
376 case MANFID_KME: 372 case MANFID_KME:
377 cardtype = KME; /* MultiFunction Card */ 373 cardtype = KME; /* MultiFunction Card */
378 link->conf.ConfigBase = 0x800; 374 link->config_base = 0x800;
379 link->conf.ConfigIndex = 0x47; 375 link->config_index = 0x47;
380 link->resource[1]->end = 8; 376 link->resource[1]->end = 8;
381 break; 377 break;
382 case MANFID_CONTEC: 378 case MANFID_CONTEC:
383 cardtype = CONTEC; 379 cardtype = CONTEC;
384 break; 380 break;
385 case MANFID_FUJITSU: 381 case MANFID_FUJITSU:
386 if (link->conf.ConfigBase == 0x0fe0) 382 if (link->config_base == 0x0fe0)
387 cardtype = MBH10302; 383 cardtype = MBH10302;
388 else if (link->card_id == PRODID_FUJITSU_MBH10302) 384 else if (link->card_id == PRODID_FUJITSU_MBH10302)
389 /* RATOC REX-5588/9822/4886's PRODID are 0004(=MBH10302), 385 /* RATOC REX-5588/9822/4886's PRODID are 0004(=MBH10302),
@@ -403,10 +399,10 @@ static int fmvj18x_config(struct pcmcia_device *link)
403 case MANFID_FUJITSU: 399 case MANFID_FUJITSU:
404 if (link->card_id == PRODID_FUJITSU_MBH10304) { 400 if (link->card_id == PRODID_FUJITSU_MBH10304) {
405 cardtype = XXX10304; /* MBH10304 with buggy CIS */ 401 cardtype = XXX10304; /* MBH10304 with buggy CIS */
406 link->conf.ConfigIndex = 0x20; 402 link->config_index = 0x20;
407 } else { 403 } else {
408 cardtype = MBH10302; /* NextCom NC5310, etc. */ 404 cardtype = MBH10302; /* NextCom NC5310, etc. */
409 link->conf.ConfigIndex = 1; 405 link->config_index = 1;
410 } 406 }
411 break; 407 break;
412 case MANFID_UNGERMANN: 408 case MANFID_UNGERMANN:
@@ -414,7 +410,7 @@ static int fmvj18x_config(struct pcmcia_device *link)
414 break; 410 break;
415 default: 411 default:
416 cardtype = MBH10302; 412 cardtype = MBH10302;
417 link->conf.ConfigIndex = 1; 413 link->config_index = 1;
418 } 414 }
419 } 415 }
420 416
@@ -432,7 +428,7 @@ static int fmvj18x_config(struct pcmcia_device *link)
432 ret = pcmcia_request_irq(link, fjn_interrupt); 428 ret = pcmcia_request_irq(link, fjn_interrupt);
433 if (ret) 429 if (ret)
434 goto failed; 430 goto failed;
435 ret = pcmcia_request_configuration(link, &link->conf); 431 ret = pcmcia_enable_device(link);
436 if (ret) 432 if (ret)
437 goto failed; 433 goto failed;
438 434
@@ -503,7 +499,7 @@ static int fmvj18x_config(struct pcmcia_device *link)
503 case XXX10304: 499 case XXX10304:
504 /* Read MACID from Buggy CIS */ 500 /* Read MACID from Buggy CIS */
505 if (fmvj18x_get_hwinfo(link, buggybuf) == -1) { 501 if (fmvj18x_get_hwinfo(link, buggybuf) == -1) {
506 printk(KERN_NOTICE "fmvj18x_cs: unable to read hardware net address.\n"); 502 pr_notice("unable to read hardware net address\n");
507 goto failed; 503 goto failed;
508 } 504 }
509 for (i = 0 ; i < 6; i++) { 505 for (i = 0 ; i < 6; i++) {
@@ -524,15 +520,14 @@ static int fmvj18x_config(struct pcmcia_device *link)
524 SET_NETDEV_DEV(dev, &link->dev); 520 SET_NETDEV_DEV(dev, &link->dev);
525 521
526 if (register_netdev(dev) != 0) { 522 if (register_netdev(dev) != 0) {
527 printk(KERN_NOTICE "fmvj18x_cs: register_netdev() failed\n"); 523 pr_notice("register_netdev() failed\n");
528 goto failed; 524 goto failed;
529 } 525 }
530 526
531 /* print current configuration */ 527 /* print current configuration */
532 printk(KERN_INFO "%s: %s, sram %s, port %#3lx, irq %d, " 528 netdev_info(dev, "%s, sram %s, port %#3lx, irq %d, hw_addr %pM\n",
533 "hw_addr %pM\n", 529 card_name, sram_config == 0 ? "4K TX*2" : "8K TX*2",
534 dev->name, card_name, sram_config == 0 ? "4K TX*2" : "8K TX*2", 530 dev->base_addr, dev->irq, dev->dev_addr);
535 dev->base_addr, dev->irq, dev->dev_addr);
536 531
537 return 0; 532 return 0;
538 533
@@ -544,20 +539,18 @@ failed:
544 539
545static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id) 540static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id)
546{ 541{
547 win_req_t req;
548 u_char __iomem *base; 542 u_char __iomem *base;
549 int i, j; 543 int i, j;
550 544
551 /* Allocate a small memory window */ 545 /* Allocate a small memory window */
552 req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; 546 link->resource[2]->flags |= WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE;
553 req.Base = 0; req.Size = 0; 547 link->resource[2]->start = 0; link->resource[2]->end = 0;
554 req.AccessSpeed = 0; 548 i = pcmcia_request_window(link, link->resource[2], 0);
555 i = pcmcia_request_window(link, &req, &link->win);
556 if (i != 0) 549 if (i != 0)
557 return -1; 550 return -1;
558 551
559 base = ioremap(req.Base, req.Size); 552 base = ioremap(link->resource[2]->start, resource_size(link->resource[2]));
560 pcmcia_map_mem_page(link, link->win, 0); 553 pcmcia_map_mem_page(link, link->resource[2], 0);
561 554
562 /* 555 /*
563 * MBH10304 CISTPL_FUNCE_LAN_NODE_ID format 556 * MBH10304 CISTPL_FUNCE_LAN_NODE_ID format
@@ -582,7 +575,7 @@ static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id)
582 } 575 }
583 576
584 iounmap(base); 577 iounmap(base);
585 j = pcmcia_release_window(link, link->win); 578 j = pcmcia_release_window(link, link->resource[2]);
586 return (i != 0x200) ? 0 : -1; 579 return (i != 0x200) ? 0 : -1;
587 580
588} /* fmvj18x_get_hwinfo */ 581} /* fmvj18x_get_hwinfo */
@@ -590,27 +583,26 @@ static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id)
590 583
591static int fmvj18x_setup_mfc(struct pcmcia_device *link) 584static int fmvj18x_setup_mfc(struct pcmcia_device *link)
592{ 585{
593 win_req_t req;
594 int i; 586 int i;
595 struct net_device *dev = link->priv; 587 struct net_device *dev = link->priv;
596 unsigned int ioaddr; 588 unsigned int ioaddr;
597 local_info_t *lp = netdev_priv(dev); 589 local_info_t *lp = netdev_priv(dev);
598 590
599 /* Allocate a small memory window */ 591 /* Allocate a small memory window */
600 req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; 592 link->resource[3]->flags = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE;
601 req.Base = 0; req.Size = 0; 593 link->resource[3]->start = link->resource[3]->end = 0;
602 req.AccessSpeed = 0; 594 i = pcmcia_request_window(link, link->resource[3], 0);
603 i = pcmcia_request_window(link, &req, &link->win);
604 if (i != 0) 595 if (i != 0)
605 return -1; 596 return -1;
606 597
607 lp->base = ioremap(req.Base, req.Size); 598 lp->base = ioremap(link->resource[3]->start,
599 resource_size(link->resource[3]));
608 if (lp->base == NULL) { 600 if (lp->base == NULL) {
609 printk(KERN_NOTICE "fmvj18x_cs: ioremap failed\n"); 601 netdev_notice(dev, "ioremap failed\n");
610 return -1; 602 return -1;
611 } 603 }
612 604
613 i = pcmcia_map_mem_page(link, link->win, 0); 605 i = pcmcia_map_mem_page(link, link->resource[3], 0);
614 if (i != 0) { 606 if (i != 0) {
615 iounmap(lp->base); 607 iounmap(lp->base);
616 lp->base = NULL; 608 lp->base = NULL;
@@ -638,7 +630,6 @@ static void fmvj18x_release(struct pcmcia_device *link)
638 struct net_device *dev = link->priv; 630 struct net_device *dev = link->priv;
639 local_info_t *lp = netdev_priv(dev); 631 local_info_t *lp = netdev_priv(dev);
640 u_char __iomem *tmp; 632 u_char __iomem *tmp;
641 int j;
642 633
643 dev_dbg(&link->dev, "fmvj18x_release\n"); 634 dev_dbg(&link->dev, "fmvj18x_release\n");
644 635
@@ -646,7 +637,6 @@ static void fmvj18x_release(struct pcmcia_device *link)
646 tmp = lp->base; 637 tmp = lp->base;
647 lp->base = NULL; /* set NULL before iounmap */ 638 lp->base = NULL; /* set NULL before iounmap */
648 iounmap(tmp); 639 iounmap(tmp);
649 j = pcmcia_release_window(link, link->win);
650 } 640 }
651 641
652 pcmcia_disable_device(link); 642 pcmcia_disable_device(link);
@@ -677,7 +667,7 @@ static int fmvj18x_resume(struct pcmcia_device *link)
677 667
678/*====================================================================*/ 668/*====================================================================*/
679 669
680static struct pcmcia_device_id fmvj18x_ids[] = { 670static const struct pcmcia_device_id fmvj18x_ids[] = {
681 PCMCIA_DEVICE_MANF_CARD(0x0004, 0x0004), 671 PCMCIA_DEVICE_MANF_CARD(0x0004, 0x0004),
682 PCMCIA_DEVICE_PROD_ID12("EAGLE Technology", "NE200 ETHERNET LAN MBH10302 04", 0x528c88c4, 0x74f91e59), 672 PCMCIA_DEVICE_PROD_ID12("EAGLE Technology", "NE200 ETHERNET LAN MBH10302 04", 0x528c88c4, 0x74f91e59),
683 PCMCIA_DEVICE_PROD_ID12("Eiger Labs,Inc", "EPX-10BT PC Card Ethernet 10BT", 0x53af556e, 0x877f9922), 673 PCMCIA_DEVICE_PROD_ID12("Eiger Labs,Inc", "EPX-10BT PC Card Ethernet 10BT", 0x53af556e, 0x877f9922),
@@ -701,6 +691,7 @@ static struct pcmcia_device_id fmvj18x_ids[] = {
701 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0105, 0x0e0a), 691 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0105, 0x0e0a),
702 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0032, 0x0e01), 692 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0032, 0x0e01),
703 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0032, 0x0a05), 693 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0032, 0x0a05),
694 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0032, 0x0b05),
704 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0032, 0x1101), 695 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0032, 0x1101),
705 PCMCIA_DEVICE_NULL, 696 PCMCIA_DEVICE_NULL,
706}; 697};
@@ -708,9 +699,7 @@ MODULE_DEVICE_TABLE(pcmcia, fmvj18x_ids);
708 699
709static struct pcmcia_driver fmvj18x_cs_driver = { 700static struct pcmcia_driver fmvj18x_cs_driver = {
710 .owner = THIS_MODULE, 701 .owner = THIS_MODULE,
711 .drv = { 702 .name = "fmvj18x_cs",
712 .name = "fmvj18x_cs",
713 },
714 .probe = fmvj18x_probe, 703 .probe = fmvj18x_probe,
715 .remove = fmvj18x_detach, 704 .remove = fmvj18x_detach,
716 .id_table = fmvj18x_ids, 705 .id_table = fmvj18x_ids,
@@ -800,17 +789,16 @@ static void fjn_tx_timeout(struct net_device *dev)
800 struct local_info_t *lp = netdev_priv(dev); 789 struct local_info_t *lp = netdev_priv(dev);
801 unsigned int ioaddr = dev->base_addr; 790 unsigned int ioaddr = dev->base_addr;
802 791
803 printk(KERN_NOTICE "%s: transmit timed out with status %04x, %s?\n", 792 netdev_notice(dev, "transmit timed out with status %04x, %s?\n",
804 dev->name, htons(inw(ioaddr + TX_STATUS)), 793 htons(inw(ioaddr + TX_STATUS)),
805 inb(ioaddr + TX_STATUS) & F_TMT_RDY 794 inb(ioaddr + TX_STATUS) & F_TMT_RDY
806 ? "IRQ conflict" : "network cable problem"); 795 ? "IRQ conflict" : "network cable problem");
807 printk(KERN_NOTICE "%s: timeout registers: %04x %04x %04x " 796 netdev_notice(dev, "timeout registers: %04x %04x %04x "
808 "%04x %04x %04x %04x %04x.\n", 797 "%04x %04x %04x %04x %04x.\n",
809 dev->name, htons(inw(ioaddr + 0)), 798 htons(inw(ioaddr + 0)), htons(inw(ioaddr + 2)),
810 htons(inw(ioaddr + 2)), htons(inw(ioaddr + 4)), 799 htons(inw(ioaddr + 4)), htons(inw(ioaddr + 6)),
811 htons(inw(ioaddr + 6)), htons(inw(ioaddr + 8)), 800 htons(inw(ioaddr + 8)), htons(inw(ioaddr + 10)),
812 htons(inw(ioaddr +10)), htons(inw(ioaddr +12)), 801 htons(inw(ioaddr + 12)), htons(inw(ioaddr + 14)));
813 htons(inw(ioaddr +14)));
814 dev->stats.tx_errors++; 802 dev->stats.tx_errors++;
815 /* ToDo: We should try to restart the adaptor... */ 803 /* ToDo: We should try to restart the adaptor... */
816 local_irq_disable(); 804 local_irq_disable();
@@ -845,13 +833,13 @@ static netdev_tx_t fjn_start_xmit(struct sk_buff *skb,
845 unsigned char *buf = skb->data; 833 unsigned char *buf = skb->data;
846 834
847 if (length > ETH_FRAME_LEN) { 835 if (length > ETH_FRAME_LEN) {
848 printk(KERN_NOTICE "%s: Attempting to send a large packet" 836 netdev_notice(dev, "Attempting to send a large packet (%d bytes)\n",
849 " (%d bytes).\n", dev->name, length); 837 length);
850 return NETDEV_TX_BUSY; 838 return NETDEV_TX_BUSY;
851 } 839 }
852 840
853 pr_debug("%s: Transmitting a packet of length %lu.\n", 841 netdev_dbg(dev, "Transmitting a packet of length %lu\n",
854 dev->name, (unsigned long)skb->len); 842 (unsigned long)skb->len);
855 dev->stats.tx_bytes += skb->len; 843 dev->stats.tx_bytes += skb->len;
856 844
857 /* Disable both interrupts. */ 845 /* Disable both interrupts. */
@@ -904,7 +892,7 @@ static void fjn_reset(struct net_device *dev)
904 unsigned int ioaddr = dev->base_addr; 892 unsigned int ioaddr = dev->base_addr;
905 int i; 893 int i;
906 894
907 pr_debug("fjn_reset(%s) called.\n",dev->name); 895 netdev_dbg(dev, "fjn_reset() called\n");
908 896
909 /* Reset controller */ 897 /* Reset controller */
910 if( sram_config == 0 ) 898 if( sram_config == 0 )
@@ -988,8 +976,8 @@ static void fjn_rx(struct net_device *dev)
988 while ((inb(ioaddr + RX_MODE) & F_BUF_EMP) == 0) { 976 while ((inb(ioaddr + RX_MODE) & F_BUF_EMP) == 0) {
989 u_short status = inw(ioaddr + DATAPORT); 977 u_short status = inw(ioaddr + DATAPORT);
990 978
991 pr_debug("%s: Rxing packet mode %02x status %04x.\n", 979 netdev_dbg(dev, "Rxing packet mode %02x status %04x.\n",
992 dev->name, inb(ioaddr + RX_MODE), status); 980 inb(ioaddr + RX_MODE), status);
993#ifndef final_version 981#ifndef final_version
994 if (status == 0) { 982 if (status == 0) {
995 outb(F_SKP_PKT, ioaddr + RX_SKIP); 983 outb(F_SKP_PKT, ioaddr + RX_SKIP);
@@ -1008,16 +996,16 @@ static void fjn_rx(struct net_device *dev)
1008 struct sk_buff *skb; 996 struct sk_buff *skb;
1009 997
1010 if (pkt_len > 1550) { 998 if (pkt_len > 1550) {
1011 printk(KERN_NOTICE "%s: The FMV-18x claimed a very " 999 netdev_notice(dev, "The FMV-18x claimed a very large packet, size %d\n",
1012 "large packet, size %d.\n", dev->name, pkt_len); 1000 pkt_len);
1013 outb(F_SKP_PKT, ioaddr + RX_SKIP); 1001 outb(F_SKP_PKT, ioaddr + RX_SKIP);
1014 dev->stats.rx_errors++; 1002 dev->stats.rx_errors++;
1015 break; 1003 break;
1016 } 1004 }
1017 skb = dev_alloc_skb(pkt_len+2); 1005 skb = dev_alloc_skb(pkt_len+2);
1018 if (skb == NULL) { 1006 if (skb == NULL) {
1019 printk(KERN_NOTICE "%s: Memory squeeze, dropping " 1007 netdev_notice(dev, "Memory squeeze, dropping packet (len %d)\n",
1020 "packet (len %d).\n", dev->name, pkt_len); 1008 pkt_len);
1021 outb(F_SKP_PKT, ioaddr + RX_SKIP); 1009 outb(F_SKP_PKT, ioaddr + RX_SKIP);
1022 dev->stats.rx_dropped++; 1010 dev->stats.rx_dropped++;
1023 break; 1011 break;
diff --git a/drivers/net/pcmcia/ibmtr_cs.c b/drivers/net/pcmcia/ibmtr_cs.c
index b0d06a3d962f..6006d5488fbe 100644
--- a/drivers/net/pcmcia/ibmtr_cs.c
+++ b/drivers/net/pcmcia/ibmtr_cs.c
@@ -45,6 +45,8 @@
45 45
46======================================================================*/ 46======================================================================*/
47 47
48#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
49
48#include <linux/kernel.h> 50#include <linux/kernel.h>
49#include <linux/init.h> 51#include <linux/init.h>
50#include <linux/ptrace.h> 52#include <linux/ptrace.h>
@@ -52,12 +54,10 @@
52#include <linux/string.h> 54#include <linux/string.h>
53#include <linux/timer.h> 55#include <linux/timer.h>
54#include <linux/module.h> 56#include <linux/module.h>
55#include <linux/ethtool.h>
56#include <linux/netdevice.h> 57#include <linux/netdevice.h>
57#include <linux/trdevice.h> 58#include <linux/trdevice.h>
58#include <linux/ibmtr.h> 59#include <linux/ibmtr.h>
59 60
60#include <pcmcia/cs.h>
61#include <pcmcia/cistpl.h> 61#include <pcmcia/cistpl.h>
62#include <pcmcia/ds.h> 62#include <pcmcia/ds.h>
63 63
@@ -102,35 +102,16 @@ static void ibmtr_detach(struct pcmcia_device *p_dev);
102 102
103typedef struct ibmtr_dev_t { 103typedef struct ibmtr_dev_t {
104 struct pcmcia_device *p_dev; 104 struct pcmcia_device *p_dev;
105 struct net_device *dev; 105 struct net_device *dev;
106 window_handle_t sram_win_handle; 106 struct tok_info *ti;
107 struct tok_info *ti;
108} ibmtr_dev_t; 107} ibmtr_dev_t;
109 108
110static void netdev_get_drvinfo(struct net_device *dev,
111 struct ethtool_drvinfo *info)
112{
113 strcpy(info->driver, "ibmtr_cs");
114}
115
116static const struct ethtool_ops netdev_ethtool_ops = {
117 .get_drvinfo = netdev_get_drvinfo,
118};
119
120static irqreturn_t ibmtr_interrupt(int irq, void *dev_id) { 109static irqreturn_t ibmtr_interrupt(int irq, void *dev_id) {
121 ibmtr_dev_t *info = dev_id; 110 ibmtr_dev_t *info = dev_id;
122 struct net_device *dev = info->dev; 111 struct net_device *dev = info->dev;
123 return tok_interrupt(irq, dev); 112 return tok_interrupt(irq, dev);
124}; 113};
125 114
126/*======================================================================
127
128 ibmtr_attach() creates an "instance" of the driver, allocating
129 local data structures for one device. The device is registered
130 with Card Services.
131
132======================================================================*/
133
134static int __devinit ibmtr_attach(struct pcmcia_device *link) 115static int __devinit ibmtr_attach(struct pcmcia_device *link)
135{ 116{
136 ibmtr_dev_t *info; 117 ibmtr_dev_t *info;
@@ -153,26 +134,14 @@ static int __devinit ibmtr_attach(struct pcmcia_device *link)
153 134
154 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 135 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
155 link->resource[0]->end = 4; 136 link->resource[0]->end = 4;
156 link->conf.Attributes = CONF_ENABLE_IRQ; 137 link->config_flags |= CONF_ENABLE_IRQ;
157 link->conf.IntType = INT_MEMORY_AND_IO; 138 link->config_regs = PRESENT_OPTION;
158 link->conf.Present = PRESENT_OPTION;
159 139
160 info->dev = dev; 140 info->dev = dev;
161 141
162 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
163
164 return ibmtr_config(link); 142 return ibmtr_config(link);
165} /* ibmtr_attach */ 143} /* ibmtr_attach */
166 144
167/*======================================================================
168
169 This deletes a driver "instance". The device is de-registered
170 with Card Services. If it has been released, all local data
171 structures are freed. Otherwise, the structures will be freed
172 when the device is released.
173
174======================================================================*/
175
176static void ibmtr_detach(struct pcmcia_device *link) 145static void ibmtr_detach(struct pcmcia_device *link)
177{ 146{
178 struct ibmtr_dev_t *info = link->priv; 147 struct ibmtr_dev_t *info = link->priv;
@@ -197,26 +166,17 @@ static void ibmtr_detach(struct pcmcia_device *link)
197 kfree(info); 166 kfree(info);
198} /* ibmtr_detach */ 167} /* ibmtr_detach */
199 168
200/*======================================================================
201
202 ibmtr_config() is scheduled to run after a CARD_INSERTION event
203 is received, to configure the PCMCIA socket, and to make the
204 token-ring device available to the system.
205
206======================================================================*/
207
208static int __devinit ibmtr_config(struct pcmcia_device *link) 169static int __devinit ibmtr_config(struct pcmcia_device *link)
209{ 170{
210 ibmtr_dev_t *info = link->priv; 171 ibmtr_dev_t *info = link->priv;
211 struct net_device *dev = info->dev; 172 struct net_device *dev = info->dev;
212 struct tok_info *ti = netdev_priv(dev); 173 struct tok_info *ti = netdev_priv(dev);
213 win_req_t req;
214 int i, ret; 174 int i, ret;
215 175
216 dev_dbg(&link->dev, "ibmtr_config\n"); 176 dev_dbg(&link->dev, "ibmtr_config\n");
217 177
218 link->conf.ConfigIndex = 0x61;
219 link->io_lines = 16; 178 link->io_lines = 16;
179 link->config_index = 0x61;
220 180
221 /* Determine if this is PRIMARY or ALTERNATE. */ 181 /* Determine if this is PRIMARY or ALTERNATE. */
222 182
@@ -240,39 +200,39 @@ static int __devinit ibmtr_config(struct pcmcia_device *link)
240 ti->global_int_enable=GLOBAL_INT_ENABLE+((dev->irq==9) ? 2 : dev->irq); 200 ti->global_int_enable=GLOBAL_INT_ENABLE+((dev->irq==9) ? 2 : dev->irq);
241 201
242 /* Allocate the MMIO memory window */ 202 /* Allocate the MMIO memory window */
243 req.Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM|WIN_ENABLE; 203 link->resource[2]->flags |= WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM|WIN_ENABLE;
244 req.Attributes |= WIN_USE_WAIT; 204 link->resource[2]->flags |= WIN_USE_WAIT;
245 req.Base = 0; 205 link->resource[2]->start = 0;
246 req.Size = 0x2000; 206 link->resource[2]->end = 0x2000;
247 req.AccessSpeed = 250; 207 ret = pcmcia_request_window(link, link->resource[2], 250);
248 ret = pcmcia_request_window(link, &req, &link->win);
249 if (ret) 208 if (ret)
250 goto failed; 209 goto failed;
251 210
252 ret = pcmcia_map_mem_page(link, link->win, mmiobase); 211 ret = pcmcia_map_mem_page(link, link->resource[2], mmiobase);
253 if (ret) 212 if (ret)
254 goto failed; 213 goto failed;
255 ti->mmio = ioremap(req.Base, req.Size); 214 ti->mmio = ioremap(link->resource[2]->start,
215 resource_size(link->resource[2]));
256 216
257 /* Allocate the SRAM memory window */ 217 /* Allocate the SRAM memory window */
258 req.Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM|WIN_ENABLE; 218 link->resource[3]->flags = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM|WIN_ENABLE;
259 req.Attributes |= WIN_USE_WAIT; 219 link->resource[3]->flags |= WIN_USE_WAIT;
260 req.Base = 0; 220 link->resource[3]->start = 0;
261 req.Size = sramsize * 1024; 221 link->resource[3]->end = sramsize * 1024;
262 req.AccessSpeed = 250; 222 ret = pcmcia_request_window(link, link->resource[3], 250);
263 ret = pcmcia_request_window(link, &req, &info->sram_win_handle);
264 if (ret) 223 if (ret)
265 goto failed; 224 goto failed;
266 225
267 ret = pcmcia_map_mem_page(link, info->sram_win_handle, srambase); 226 ret = pcmcia_map_mem_page(link, link->resource[3], srambase);
268 if (ret) 227 if (ret)
269 goto failed; 228 goto failed;
270 229
271 ti->sram_base = srambase >> 12; 230 ti->sram_base = srambase >> 12;
272 ti->sram_virt = ioremap(req.Base, req.Size); 231 ti->sram_virt = ioremap(link->resource[3]->start,
273 ti->sram_phys = req.Base; 232 resource_size(link->resource[3]));
233 ti->sram_phys = link->resource[3]->start;
274 234
275 ret = pcmcia_request_configuration(link, &link->conf); 235 ret = pcmcia_enable_device(link);
276 if (ret) 236 if (ret)
277 goto failed; 237 goto failed;
278 238
@@ -285,15 +245,14 @@ static int __devinit ibmtr_config(struct pcmcia_device *link)
285 245
286 i = ibmtr_probe_card(dev); 246 i = ibmtr_probe_card(dev);
287 if (i != 0) { 247 if (i != 0) {
288 printk(KERN_NOTICE "ibmtr_cs: register_netdev() failed\n"); 248 pr_notice("register_netdev() failed\n");
289 goto failed; 249 goto failed;
290 } 250 }
291 251
292 printk(KERN_INFO 252 netdev_info(dev, "port %#3lx, irq %d, mmio %#5lx, sram %#5lx, hwaddr=%pM\n",
293 "%s: port %#3lx, irq %d, mmio %#5lx, sram %#5lx, hwaddr=%pM\n", 253 dev->base_addr, dev->irq,
294 dev->name, dev->base_addr, dev->irq, 254 (u_long)ti->mmio, (u_long)(ti->sram_base << 12),
295 (u_long)ti->mmio, (u_long)(ti->sram_base << 12), 255 dev->dev_addr);
296 dev->dev_addr);
297 return 0; 256 return 0;
298 257
299failed: 258failed:
@@ -301,14 +260,6 @@ failed:
301 return -ENODEV; 260 return -ENODEV;
302} /* ibmtr_config */ 261} /* ibmtr_config */
303 262
304/*======================================================================
305
306 After a card is removed, ibmtr_release() will unregister the net
307 device, and release the PCMCIA configuration. If the device is
308 still open, this will be postponed until it is closed.
309
310======================================================================*/
311
312static void ibmtr_release(struct pcmcia_device *link) 263static void ibmtr_release(struct pcmcia_device *link)
313{ 264{
314 ibmtr_dev_t *info = link->priv; 265 ibmtr_dev_t *info = link->priv;
@@ -316,7 +267,7 @@ static void ibmtr_release(struct pcmcia_device *link)
316 267
317 dev_dbg(&link->dev, "ibmtr_release\n"); 268 dev_dbg(&link->dev, "ibmtr_release\n");
318 269
319 if (link->win) { 270 if (link->resource[2]->end) {
320 struct tok_info *ti = netdev_priv(dev); 271 struct tok_info *ti = netdev_priv(dev);
321 iounmap(ti->mmio); 272 iounmap(ti->mmio);
322 } 273 }
@@ -389,7 +340,7 @@ static void ibmtr_hw_setup(struct net_device *dev, u_int mmiobase)
389 outb(0x40, dev->base_addr); 340 outb(0x40, dev->base_addr);
390} 341}
391 342
392static struct pcmcia_device_id ibmtr_ids[] = { 343static const struct pcmcia_device_id ibmtr_ids[] = {
393 PCMCIA_DEVICE_PROD_ID12("3Com", "TokenLink Velocity PC Card", 0x41240e5b, 0x82c3734e), 344 PCMCIA_DEVICE_PROD_ID12("3Com", "TokenLink Velocity PC Card", 0x41240e5b, 0x82c3734e),
394 PCMCIA_DEVICE_PROD_ID12("IBM", "TOKEN RING", 0xb569a6e5, 0xbf8eed47), 345 PCMCIA_DEVICE_PROD_ID12("IBM", "TOKEN RING", 0xb569a6e5, 0xbf8eed47),
395 PCMCIA_DEVICE_NULL, 346 PCMCIA_DEVICE_NULL,
@@ -398,9 +349,7 @@ MODULE_DEVICE_TABLE(pcmcia, ibmtr_ids);
398 349
399static struct pcmcia_driver ibmtr_cs_driver = { 350static struct pcmcia_driver ibmtr_cs_driver = {
400 .owner = THIS_MODULE, 351 .owner = THIS_MODULE,
401 .drv = { 352 .name = "ibmtr_cs",
402 .name = "ibmtr_cs",
403 },
404 .probe = ibmtr_attach, 353 .probe = ibmtr_attach,
405 .remove = ibmtr_detach, 354 .remove = ibmtr_detach,
406 .id_table = ibmtr_ids, 355 .id_table = ibmtr_ids,
diff --git a/drivers/net/pcmcia/nmclan_cs.c b/drivers/net/pcmcia/nmclan_cs.c
index 68f2deeb3ade..9d70b6595220 100644
--- a/drivers/net/pcmcia/nmclan_cs.c
+++ b/drivers/net/pcmcia/nmclan_cs.c
@@ -111,6 +111,8 @@ Log: nmclan_cs.c,v
111 111
112---------------------------------------------------------------------------- */ 112---------------------------------------------------------------------------- */
113 113
114#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
115
114#define DRV_NAME "nmclan_cs" 116#define DRV_NAME "nmclan_cs"
115#define DRV_VERSION "0.16" 117#define DRV_VERSION "0.16"
116 118
@@ -146,7 +148,6 @@ Include Files
146#include <linux/ioport.h> 148#include <linux/ioport.h>
147#include <linux/bitops.h> 149#include <linux/bitops.h>
148 150
149#include <pcmcia/cs.h>
150#include <pcmcia/cisreg.h> 151#include <pcmcia/cisreg.h>
151#include <pcmcia/cistpl.h> 152#include <pcmcia/cistpl.h>
152#include <pcmcia/ds.h> 153#include <pcmcia/ds.h>
@@ -435,13 +436,6 @@ static const struct net_device_ops mace_netdev_ops = {
435 .ndo_validate_addr = eth_validate_addr, 436 .ndo_validate_addr = eth_validate_addr,
436}; 437};
437 438
438/* ----------------------------------------------------------------------------
439nmclan_attach
440 Creates an "instance" of the driver, allocating local data
441 structures for one device. The device is registered with Card
442 Services.
443---------------------------------------------------------------------------- */
444
445static int nmclan_probe(struct pcmcia_device *link) 439static int nmclan_probe(struct pcmcia_device *link)
446{ 440{
447 mace_private *lp; 441 mace_private *lp;
@@ -460,10 +454,9 @@ static int nmclan_probe(struct pcmcia_device *link)
460 spin_lock_init(&lp->bank_lock); 454 spin_lock_init(&lp->bank_lock);
461 link->resource[0]->end = 32; 455 link->resource[0]->end = 32;
462 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 456 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
463 link->conf.Attributes = CONF_ENABLE_IRQ; 457 link->config_flags |= CONF_ENABLE_IRQ;
464 link->conf.IntType = INT_MEMORY_AND_IO; 458 link->config_index = 1;
465 link->conf.ConfigIndex = 1; 459 link->config_regs = PRESENT_OPTION;
466 link->conf.Present = PRESENT_OPTION;
467 460
468 lp->tx_free_frames=AM2150_MAX_TX_FRAMES; 461 lp->tx_free_frames=AM2150_MAX_TX_FRAMES;
469 462
@@ -474,14 +467,6 @@ static int nmclan_probe(struct pcmcia_device *link)
474 return nmclan_config(link); 467 return nmclan_config(link);
475} /* nmclan_attach */ 468} /* nmclan_attach */
476 469
477/* ----------------------------------------------------------------------------
478nmclan_detach
479 This deletes a driver "instance". The device is de-registered
480 with Card Services. If it has been released, all local data
481 structures are freed. Otherwise, the structures will be freed
482 when the device is released.
483---------------------------------------------------------------------------- */
484
485static void nmclan_detach(struct pcmcia_device *link) 470static void nmclan_detach(struct pcmcia_device *link)
486{ 471{
487 struct net_device *dev = link->priv; 472 struct net_device *dev = link->priv;
@@ -519,7 +504,7 @@ static int mace_read(mace_private *lp, unsigned int ioaddr, int reg)
519 spin_unlock_irqrestore(&lp->bank_lock, flags); 504 spin_unlock_irqrestore(&lp->bank_lock, flags);
520 break; 505 break;
521 } 506 }
522 return (data & 0xFF); 507 return data & 0xFF;
523} /* mace_read */ 508} /* mace_read */
524 509
525/* ---------------------------------------------------------------------------- 510/* ----------------------------------------------------------------------------
@@ -563,7 +548,7 @@ static int mace_init(mace_private *lp, unsigned int ioaddr, char *enet_addr)
563 /* Wait for reset bit to be cleared automatically after <= 200ns */; 548 /* Wait for reset bit to be cleared automatically after <= 200ns */;
564 if(++ct > 500) 549 if(++ct > 500)
565 { 550 {
566 printk(KERN_ERR "mace: reset failed, card removed ?\n"); 551 pr_err("reset failed, card removed?\n");
567 return -1; 552 return -1;
568 } 553 }
569 udelay(1); 554 udelay(1);
@@ -610,7 +595,7 @@ static int mace_init(mace_private *lp, unsigned int ioaddr, char *enet_addr)
610 { 595 {
611 if(++ ct > 500) 596 if(++ ct > 500)
612 { 597 {
613 printk(KERN_ERR "mace: ADDRCHG timeout, card removed ?\n"); 598 pr_err("ADDRCHG timeout, card removed?\n");
614 return -1; 599 return -1;
615 } 600 }
616 } 601 }
@@ -625,13 +610,6 @@ static int mace_init(mace_private *lp, unsigned int ioaddr, char *enet_addr)
625 return 0; 610 return 0;
626} /* mace_init */ 611} /* mace_init */
627 612
628/* ----------------------------------------------------------------------------
629nmclan_config
630 This routine is scheduled to run after a CARD_INSERTION event
631 is received, to configure the PCMCIA socket, and to make the
632 ethernet device available to the system.
633---------------------------------------------------------------------------- */
634
635static int nmclan_config(struct pcmcia_device *link) 613static int nmclan_config(struct pcmcia_device *link)
636{ 614{
637 struct net_device *dev = link->priv; 615 struct net_device *dev = link->priv;
@@ -650,7 +628,7 @@ static int nmclan_config(struct pcmcia_device *link)
650 ret = pcmcia_request_exclusive_irq(link, mace_interrupt); 628 ret = pcmcia_request_exclusive_irq(link, mace_interrupt);
651 if (ret) 629 if (ret)
652 goto failed; 630 goto failed;
653 ret = pcmcia_request_configuration(link, &link->conf); 631 ret = pcmcia_enable_device(link);
654 if (ret) 632 if (ret)
655 goto failed; 633 goto failed;
656 634
@@ -678,8 +656,8 @@ static int nmclan_config(struct pcmcia_device *link)
678 dev_dbg(&link->dev, "nmclan_cs configured: mace id=%x %x\n", 656 dev_dbg(&link->dev, "nmclan_cs configured: mace id=%x %x\n",
679 sig[0], sig[1]); 657 sig[0], sig[1]);
680 } else { 658 } else {
681 printk(KERN_NOTICE "nmclan_cs: mace id not found: %x %x should" 659 pr_notice("mace id not found: %x %x should be 0x40 0x?9\n",
682 " be 0x40 0x?9\n", sig[0], sig[1]); 660 sig[0], sig[1]);
683 return -ENODEV; 661 return -ENODEV;
684 } 662 }
685 } 663 }
@@ -691,20 +669,18 @@ static int nmclan_config(struct pcmcia_device *link)
691 if (if_port <= 2) 669 if (if_port <= 2)
692 dev->if_port = if_port; 670 dev->if_port = if_port;
693 else 671 else
694 printk(KERN_NOTICE "nmclan_cs: invalid if_port requested\n"); 672 pr_notice("invalid if_port requested\n");
695 673
696 SET_NETDEV_DEV(dev, &link->dev); 674 SET_NETDEV_DEV(dev, &link->dev);
697 675
698 i = register_netdev(dev); 676 i = register_netdev(dev);
699 if (i != 0) { 677 if (i != 0) {
700 printk(KERN_NOTICE "nmclan_cs: register_netdev() failed\n"); 678 pr_notice("register_netdev() failed\n");
701 goto failed; 679 goto failed;
702 } 680 }
703 681
704 printk(KERN_INFO "%s: nmclan: port %#3lx, irq %d, %s port," 682 netdev_info(dev, "nmclan: port %#3lx, irq %d, %s port, hw_addr %pM\n",
705 " hw_addr %pM\n", 683 dev->base_addr, dev->irq, if_names[dev->if_port], dev->dev_addr);
706 dev->name, dev->base_addr, dev->irq, if_names[dev->if_port],
707 dev->dev_addr);
708 return 0; 684 return 0;
709 685
710failed: 686failed:
@@ -712,12 +688,6 @@ failed:
712 return -ENODEV; 688 return -ENODEV;
713} /* nmclan_config */ 689} /* nmclan_config */
714 690
715/* ----------------------------------------------------------------------------
716nmclan_release
717 After a card is removed, nmclan_release() will unregister the
718 net device, and release the PCMCIA configuration. If the device
719 is still open, this will be postponed until it is closed.
720---------------------------------------------------------------------------- */
721static void nmclan_release(struct pcmcia_device *link) 691static void nmclan_release(struct pcmcia_device *link)
722{ 692{
723 dev_dbg(&link->dev, "nmclan_release\n"); 693 dev_dbg(&link->dev, "nmclan_release\n");
@@ -798,8 +768,7 @@ static int mace_config(struct net_device *dev, struct ifmap *map)
798 if ((map->port != (u_char)(-1)) && (map->port != dev->if_port)) { 768 if ((map->port != (u_char)(-1)) && (map->port != dev->if_port)) {
799 if (map->port <= 2) { 769 if (map->port <= 2) {
800 dev->if_port = map->port; 770 dev->if_port = map->port;
801 printk(KERN_INFO "%s: switched to %s port\n", dev->name, 771 netdev_info(dev, "switched to %s port\n", if_names[dev->if_port]);
802 if_names[dev->if_port]);
803 } else 772 } else
804 return -EINVAL; 773 return -EINVAL;
805 } 774 }
@@ -878,12 +847,12 @@ static void mace_tx_timeout(struct net_device *dev)
878 mace_private *lp = netdev_priv(dev); 847 mace_private *lp = netdev_priv(dev);
879 struct pcmcia_device *link = lp->p_dev; 848 struct pcmcia_device *link = lp->p_dev;
880 849
881 printk(KERN_NOTICE "%s: transmit timed out -- ", dev->name); 850 netdev_notice(dev, "transmit timed out -- ");
882#if RESET_ON_TIMEOUT 851#if RESET_ON_TIMEOUT
883 printk("resetting card\n"); 852 pr_cont("resetting card\n");
884 pcmcia_reset_card(link->socket); 853 pcmcia_reset_card(link->socket);
885#else /* #if RESET_ON_TIMEOUT */ 854#else /* #if RESET_ON_TIMEOUT */
886 printk("NOT resetting card\n"); 855 pr_cont("NOT resetting card\n");
887#endif /* #if RESET_ON_TIMEOUT */ 856#endif /* #if RESET_ON_TIMEOUT */
888 dev->trans_start = jiffies; /* prevent tx timeout */ 857 dev->trans_start = jiffies; /* prevent tx timeout */
889 netif_wake_queue(dev); 858 netif_wake_queue(dev);
@@ -965,22 +934,21 @@ static irqreturn_t mace_interrupt(int irq, void *dev_id)
965 ioaddr = dev->base_addr; 934 ioaddr = dev->base_addr;
966 935
967 if (lp->tx_irq_disabled) { 936 if (lp->tx_irq_disabled) {
968 printk( 937 const char *msg;
969 (lp->tx_irq_disabled? 938 if (lp->tx_irq_disabled)
970 KERN_NOTICE "%s: Interrupt with tx_irq_disabled " 939 msg = "Interrupt with tx_irq_disabled";
971 "[isr=%02X, imr=%02X]\n": 940 else
972 KERN_NOTICE "%s: Re-entering the interrupt handler " 941 msg = "Re-entering the interrupt handler";
973 "[isr=%02X, imr=%02X]\n"), 942 netdev_notice(dev, "%s [isr=%02X, imr=%02X]\n",
974 dev->name, 943 msg,
975 inb(ioaddr + AM2150_MACE_BASE + MACE_IR), 944 inb(ioaddr + AM2150_MACE_BASE + MACE_IR),
976 inb(ioaddr + AM2150_MACE_BASE + MACE_IMR) 945 inb(ioaddr + AM2150_MACE_BASE + MACE_IMR));
977 );
978 /* WARNING: MACE_IR has been read! */ 946 /* WARNING: MACE_IR has been read! */
979 return IRQ_NONE; 947 return IRQ_NONE;
980 } 948 }
981 949
982 if (!netif_device_present(dev)) { 950 if (!netif_device_present(dev)) {
983 pr_debug("%s: interrupt from dead card\n", dev->name); 951 netdev_dbg(dev, "interrupt from dead card\n");
984 return IRQ_NONE; 952 return IRQ_NONE;
985 } 953 }
986 954
@@ -1323,7 +1291,7 @@ updateCRC
1323 1291
1324static void updateCRC(int *CRC, int bit) 1292static void updateCRC(int *CRC, int bit)
1325{ 1293{
1326 int poly[]={ 1294 static const int poly[]={
1327 1,1,1,0, 1,1,0,1, 1295 1,1,1,0, 1,1,0,1,
1328 1,0,1,1, 1,0,0,0, 1296 1,0,1,1, 1,0,0,0,
1329 1,0,0,0, 0,0,1,1, 1297 1,0,0,0, 0,0,1,1,
@@ -1378,8 +1346,8 @@ static void BuildLAF(int *ladrf, int *adr)
1378 printk(KERN_DEBUG " adr =%pM\n", adr); 1346 printk(KERN_DEBUG " adr =%pM\n", adr);
1379 printk(KERN_DEBUG " hashcode = %d(decimal), ladrf[0:63] =", hashcode); 1347 printk(KERN_DEBUG " hashcode = %d(decimal), ladrf[0:63] =", hashcode);
1380 for (i = 0; i < 8; i++) 1348 for (i = 0; i < 8; i++)
1381 printk(KERN_CONT " %02X", ladrf[i]); 1349 pr_cont(" %02X", ladrf[i]);
1382 printk(KERN_CONT "\n"); 1350 pr_cont("\n");
1383#endif 1351#endif
1384} /* BuildLAF */ 1352} /* BuildLAF */
1385 1353
@@ -1526,7 +1494,7 @@ static void set_multicast_list(struct net_device *dev)
1526 1494
1527} /* set_multicast_list */ 1495} /* set_multicast_list */
1528 1496
1529static struct pcmcia_device_id nmclan_ids[] = { 1497static const struct pcmcia_device_id nmclan_ids[] = {
1530 PCMCIA_DEVICE_PROD_ID12("New Media Corporation", "Ethernet", 0x085a850b, 0x00b2e941), 1498 PCMCIA_DEVICE_PROD_ID12("New Media Corporation", "Ethernet", 0x085a850b, 0x00b2e941),
1531 PCMCIA_DEVICE_PROD_ID12("Portable Add-ons", "Ethernet+", 0xebf1d60, 0xad673aaf), 1499 PCMCIA_DEVICE_PROD_ID12("Portable Add-ons", "Ethernet+", 0xebf1d60, 0xad673aaf),
1532 PCMCIA_DEVICE_NULL, 1500 PCMCIA_DEVICE_NULL,
@@ -1535,9 +1503,7 @@ MODULE_DEVICE_TABLE(pcmcia, nmclan_ids);
1535 1503
1536static struct pcmcia_driver nmclan_cs_driver = { 1504static struct pcmcia_driver nmclan_cs_driver = {
1537 .owner = THIS_MODULE, 1505 .owner = THIS_MODULE,
1538 .drv = { 1506 .name = "nmclan_cs",
1539 .name = "nmclan_cs",
1540 },
1541 .probe = nmclan_probe, 1507 .probe = nmclan_probe,
1542 .remove = nmclan_detach, 1508 .remove = nmclan_detach,
1543 .id_table = nmclan_ids, 1509 .id_table = nmclan_ids,
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,
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c
index 377367d03b41..1cd9394c3359 100644
--- a/drivers/net/pcmcia/smc91c92_cs.c
+++ b/drivers/net/pcmcia/smc91c92_cs.c
@@ -25,6 +25,8 @@
25 25
26======================================================================*/ 26======================================================================*/
27 27
28#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
29
28#include <linux/module.h> 30#include <linux/module.h>
29#include <linux/kernel.h> 31#include <linux/kernel.h>
30#include <linux/init.h> 32#include <linux/init.h>
@@ -44,7 +46,6 @@
44#include <linux/jiffies.h> 46#include <linux/jiffies.h>
45#include <linux/firmware.h> 47#include <linux/firmware.h>
46 48
47#include <pcmcia/cs.h>
48#include <pcmcia/cistpl.h> 49#include <pcmcia/cistpl.h>
49#include <pcmcia/cisreg.h> 50#include <pcmcia/cisreg.h>
50#include <pcmcia/ciscode.h> 51#include <pcmcia/ciscode.h>
@@ -294,20 +295,12 @@ static const struct net_device_ops smc_netdev_ops = {
294 .ndo_tx_timeout = smc_tx_timeout, 295 .ndo_tx_timeout = smc_tx_timeout,
295 .ndo_set_config = s9k_config, 296 .ndo_set_config = s9k_config,
296 .ndo_set_multicast_list = set_rx_mode, 297 .ndo_set_multicast_list = set_rx_mode,
297 .ndo_do_ioctl = &smc_ioctl, 298 .ndo_do_ioctl = smc_ioctl,
298 .ndo_change_mtu = eth_change_mtu, 299 .ndo_change_mtu = eth_change_mtu,
299 .ndo_set_mac_address = eth_mac_addr, 300 .ndo_set_mac_address = eth_mac_addr,
300 .ndo_validate_addr = eth_validate_addr, 301 .ndo_validate_addr = eth_validate_addr,
301}; 302};
302 303
303/*======================================================================
304
305 smc91c92_attach() creates an "instance" of the driver, allocating
306 local data structures for one device. The device is registered
307 with Card Services.
308
309======================================================================*/
310
311static int smc91c92_probe(struct pcmcia_device *link) 304static int smc91c92_probe(struct pcmcia_device *link)
312{ 305{
313 struct smc_private *smc; 306 struct smc_private *smc;
@@ -324,10 +317,6 @@ static int smc91c92_probe(struct pcmcia_device *link)
324 link->priv = dev; 317 link->priv = dev;
325 318
326 spin_lock_init(&smc->lock); 319 spin_lock_init(&smc->lock);
327 link->resource[0]->end = 16;
328 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
329 link->conf.Attributes = CONF_ENABLE_IRQ;
330 link->conf.IntType = INT_MEMORY_AND_IO;
331 320
332 /* The SMC91c92-specific entries in the device structure. */ 321 /* The SMC91c92-specific entries in the device structure. */
333 dev->netdev_ops = &smc_netdev_ops; 322 dev->netdev_ops = &smc_netdev_ops;
@@ -343,15 +332,6 @@ static int smc91c92_probe(struct pcmcia_device *link)
343 return smc91c92_config(link); 332 return smc91c92_config(link);
344} /* smc91c92_attach */ 333} /* smc91c92_attach */
345 334
346/*======================================================================
347
348 This deletes a driver "instance". The device is de-registered
349 with Card Services. If it has been released, all local data
350 structures are freed. Otherwise, the structures will be freed
351 when the device is released.
352
353======================================================================*/
354
355static void smc91c92_detach(struct pcmcia_device *link) 335static void smc91c92_detach(struct pcmcia_device *link)
356{ 336{
357 struct net_device *dev = link->priv; 337 struct net_device *dev = link->priv;
@@ -412,26 +392,28 @@ static int mhz_3288_power(struct pcmcia_device *link)
412 mdelay(200); 392 mdelay(200);
413 393
414 /* Now read and write the COR... */ 394 /* Now read and write the COR... */
415 tmp = readb(smc->base + link->conf.ConfigBase + CISREG_COR); 395 tmp = readb(smc->base + link->config_base + CISREG_COR);
416 udelay(5); 396 udelay(5);
417 writeb(tmp, smc->base + link->conf.ConfigBase + CISREG_COR); 397 writeb(tmp, smc->base + link->config_base + CISREG_COR);
418 398
419 return 0; 399 return 0;
420} 400}
421 401
422static int mhz_mfc_config_check(struct pcmcia_device *p_dev, 402static int mhz_mfc_config_check(struct pcmcia_device *p_dev, void *priv_data)
423 cistpl_cftable_entry_t *cf,
424 cistpl_cftable_entry_t *dflt,
425 unsigned int vcc,
426 void *priv_data)
427{ 403{
428 int k; 404 int k;
429 p_dev->resource[1]->start = cf->io.win[0].base; 405 p_dev->io_lines = 16;
406 p_dev->resource[1]->start = p_dev->resource[0]->start;
407 p_dev->resource[1]->end = 8;
408 p_dev->resource[1]->flags &= ~IO_DATA_PATH_WIDTH;
409 p_dev->resource[1]->flags |= IO_DATA_PATH_WIDTH_8;
410 p_dev->resource[0]->end = 16;
411 p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
412 p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
430 for (k = 0; k < 0x400; k += 0x10) { 413 for (k = 0; k < 0x400; k += 0x10) {
431 if (k & 0x80) 414 if (k & 0x80)
432 continue; 415 continue;
433 p_dev->resource[0]->start = k ^ 0x300; 416 p_dev->resource[0]->start = k ^ 0x300;
434 p_dev->io_lines = 16;
435 if (!pcmcia_request_io(p_dev)) 417 if (!pcmcia_request_io(p_dev))
436 return 0; 418 return 0;
437 } 419 }
@@ -442,14 +424,11 @@ static int mhz_mfc_config(struct pcmcia_device *link)
442{ 424{
443 struct net_device *dev = link->priv; 425 struct net_device *dev = link->priv;
444 struct smc_private *smc = netdev_priv(dev); 426 struct smc_private *smc = netdev_priv(dev);
445 win_req_t req;
446 unsigned int offset; 427 unsigned int offset;
447 int i; 428 int i;
448 429
449 link->conf.Attributes |= CONF_ENABLE_SPKR; 430 link->config_flags |= CONF_ENABLE_SPKR | CONF_ENABLE_IRQ |
450 link->conf.Status = CCSR_AUDIO_ENA; 431 CONF_AUTO_SET_IO;
451 link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8;
452 link->resource[1]->end = 8;
453 432
454 /* The Megahertz combo cards have modem-like CIS entries, so 433 /* The Megahertz combo cards have modem-like CIS entries, so
455 we have to explicitly try a bunch of port combinations. */ 434 we have to explicitly try a bunch of port combinations. */
@@ -459,16 +438,16 @@ static int mhz_mfc_config(struct pcmcia_device *link)
459 dev->base_addr = link->resource[0]->start; 438 dev->base_addr = link->resource[0]->start;
460 439
461 /* Allocate a memory window, for accessing the ISR */ 440 /* Allocate a memory window, for accessing the ISR */
462 req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; 441 link->resource[2]->flags = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE;
463 req.Base = req.Size = 0; 442 link->resource[2]->start = link->resource[2]->end = 0;
464 req.AccessSpeed = 0; 443 i = pcmcia_request_window(link, link->resource[2], 0);
465 i = pcmcia_request_window(link, &req, &link->win);
466 if (i != 0) 444 if (i != 0)
467 return -ENODEV; 445 return -ENODEV;
468 446
469 smc->base = ioremap(req.Base, req.Size); 447 smc->base = ioremap(link->resource[2]->start,
470 offset = (smc->manfid == MANFID_MOTOROLA) ? link->conf.ConfigBase : 0; 448 resource_size(link->resource[2]));
471 i = pcmcia_map_mem_page(link, link->win, offset); 449 offset = (smc->manfid == MANFID_MOTOROLA) ? link->config_base : 0;
450 i = pcmcia_map_mem_page(link, link->resource[2], offset);
472 if ((i == 0) && 451 if ((i == 0) &&
473 (smc->manfid == MANFID_MEGAHERTZ) && 452 (smc->manfid == MANFID_MEGAHERTZ) &&
474 (smc->cardid == PRODID_MEGAHERTZ_EM3288)) 453 (smc->cardid == PRODID_MEGAHERTZ_EM3288))
@@ -591,14 +570,12 @@ static int mot_setup(struct pcmcia_device *link)
591 570
592/*====================================================================*/ 571/*====================================================================*/
593 572
594static int smc_configcheck(struct pcmcia_device *p_dev, 573static int smc_configcheck(struct pcmcia_device *p_dev, void *priv_data)
595 cistpl_cftable_entry_t *cf,
596 cistpl_cftable_entry_t *dflt,
597 unsigned int vcc,
598 void *priv_data)
599{ 574{
600 p_dev->resource[0]->start = cf->io.win[0].base; 575 p_dev->resource[0]->end = 16;
601 p_dev->io_lines = cf->io.flags & CISTPL_IO_LINES_MASK; 576 p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
577 p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
578
602 return pcmcia_request_io(p_dev); 579 return pcmcia_request_io(p_dev);
603} 580}
604 581
@@ -607,7 +584,8 @@ static int smc_config(struct pcmcia_device *link)
607 struct net_device *dev = link->priv; 584 struct net_device *dev = link->priv;
608 int i; 585 int i;
609 586
610 link->resource[0]->end = 16; 587 link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO;
588
611 i = pcmcia_loop_config(link, smc_configcheck, NULL); 589 i = pcmcia_loop_config(link, smc_configcheck, NULL);
612 if (!i) 590 if (!i)
613 dev->base_addr = link->resource[0]->start; 591 dev->base_addr = link->resource[0]->start;
@@ -640,15 +618,14 @@ static int osi_config(struct pcmcia_device *link)
640 static const unsigned int com[4] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8 }; 618 static const unsigned int com[4] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8 };
641 int i, j; 619 int i, j;
642 620
643 link->conf.Attributes |= CONF_ENABLE_SPKR; 621 link->config_flags |= CONF_ENABLE_SPKR | CONF_ENABLE_IRQ;
644 link->conf.Status = CCSR_AUDIO_ENA;
645 link->resource[0]->end = 64; 622 link->resource[0]->end = 64;
646 link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; 623 link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8;
647 link->resource[1]->end = 8; 624 link->resource[1]->end = 8;
648 625
649 /* Enable Hard Decode, LAN, Modem */ 626 /* Enable Hard Decode, LAN, Modem */
650 link->conf.ConfigIndex = 0x23;
651 link->io_lines = 16; 627 link->io_lines = 16;
628 link->config_index = 0x23;
652 629
653 for (i = j = 0; j < 4; j++) { 630 for (i = j = 0; j < 4; j++) {
654 link->resource[1]->start = com[j]; 631 link->resource[1]->start = com[j];
@@ -658,7 +635,7 @@ static int osi_config(struct pcmcia_device *link)
658 } 635 }
659 if (i != 0) { 636 if (i != 0) {
660 /* Fallback: turn off hard decode */ 637 /* Fallback: turn off hard decode */
661 link->conf.ConfigIndex = 0x03; 638 link->config_index = 0x03;
662 link->resource[1]->end = 0; 639 link->resource[1]->end = 0;
663 i = pcmcia_request_io(link); 640 i = pcmcia_request_io(link);
664 } 641 }
@@ -813,31 +790,20 @@ static int check_sig(struct pcmcia_device *link)
813 ((s >> 8) != (s & 0xff))) { 790 ((s >> 8) != (s & 0xff))) {
814 SMC_SELECT_BANK(3); 791 SMC_SELECT_BANK(3);
815 s = inw(ioaddr + REVISION); 792 s = inw(ioaddr + REVISION);
816 return (s & 0xff); 793 return s & 0xff;
817 } 794 }
818 795
819 if (width) { 796 if (width) {
820 modconf_t mod = { 797 pr_info("using 8-bit IO window\n");
821 .Attributes = CONF_IO_CHANGE_WIDTH,
822 };
823 printk(KERN_INFO "smc91c92_cs: using 8-bit IO window.\n");
824 798
825 smc91c92_suspend(link); 799 smc91c92_suspend(link);
826 pcmcia_modify_configuration(link, &mod); 800 pcmcia_fixup_iowidth(link);
827 smc91c92_resume(link); 801 smc91c92_resume(link);
828 return check_sig(link); 802 return check_sig(link);
829 } 803 }
830 return -ENODEV; 804 return -ENODEV;
831} 805}
832 806
833/*======================================================================
834
835 smc91c92_config() is scheduled to run after a CARD_INSERTION event
836 is received, to configure the PCMCIA socket, and to make the
837 ethernet device available to the system.
838
839======================================================================*/
840
841static int smc91c92_config(struct pcmcia_device *link) 807static int smc91c92_config(struct pcmcia_device *link)
842{ 808{
843 struct net_device *dev = link->priv; 809 struct net_device *dev = link->priv;
@@ -869,7 +835,7 @@ static int smc91c92_config(struct pcmcia_device *link)
869 i = pcmcia_request_irq(link, smc_interrupt); 835 i = pcmcia_request_irq(link, smc_interrupt);
870 if (i) 836 if (i)
871 goto config_failed; 837 goto config_failed;
872 i = pcmcia_request_configuration(link, &link->conf); 838 i = pcmcia_enable_device(link);
873 if (i) 839 if (i)
874 goto config_failed; 840 goto config_failed;
875 841
@@ -881,7 +847,7 @@ static int smc91c92_config(struct pcmcia_device *link)
881 if ((if_port >= 0) && (if_port <= 2)) 847 if ((if_port >= 0) && (if_port <= 2))
882 dev->if_port = if_port; 848 dev->if_port = if_port;
883 else 849 else
884 printk(KERN_NOTICE "smc91c92_cs: invalid if_port requested\n"); 850 dev_notice(&link->dev, "invalid if_port requested\n");
885 851
886 switch (smc->manfid) { 852 switch (smc->manfid) {
887 case MANFID_OSITECH: 853 case MANFID_OSITECH:
@@ -899,7 +865,7 @@ static int smc91c92_config(struct pcmcia_device *link)
899 } 865 }
900 866
901 if (i != 0) { 867 if (i != 0) {
902 printk(KERN_NOTICE "smc91c92_cs: Unable to find hardware address.\n"); 868 dev_notice(&link->dev, "Unable to find hardware address.\n");
903 goto config_failed; 869 goto config_failed;
904 } 870 }
905 871
@@ -952,30 +918,28 @@ static int smc91c92_config(struct pcmcia_device *link)
952 SET_NETDEV_DEV(dev, &link->dev); 918 SET_NETDEV_DEV(dev, &link->dev);
953 919
954 if (register_netdev(dev) != 0) { 920 if (register_netdev(dev) != 0) {
955 printk(KERN_ERR "smc91c92_cs: register_netdev() failed\n"); 921 dev_err(&link->dev, "register_netdev() failed\n");
956 goto config_undo; 922 goto config_undo;
957 } 923 }
958 924
959 printk(KERN_INFO "%s: smc91c%s rev %d: io %#3lx, irq %d, " 925 netdev_info(dev, "smc91c%s rev %d: io %#3lx, irq %d, hw_addr %pM\n",
960 "hw_addr %pM\n", 926 name, (rev & 0x0f), dev->base_addr, dev->irq, dev->dev_addr);
961 dev->name, name, (rev & 0x0f), dev->base_addr, dev->irq,
962 dev->dev_addr);
963 927
964 if (rev > 0) { 928 if (rev > 0) {
965 if (mir & 0x3ff) 929 if (mir & 0x3ff)
966 printk(KERN_INFO " %lu byte", mir); 930 netdev_info(dev, " %lu byte", mir);
967 else 931 else
968 printk(KERN_INFO " %lu kb", mir>>10); 932 netdev_info(dev, " %lu kb", mir>>10);
969 printk(" buffer, %s xcvr\n", (smc->cfg & CFG_MII_SELECT) ? 933 pr_cont(" buffer, %s xcvr\n",
970 "MII" : if_names[dev->if_port]); 934 (smc->cfg & CFG_MII_SELECT) ? "MII" : if_names[dev->if_port]);
971 } 935 }
972 936
973 if (smc->cfg & CFG_MII_SELECT) { 937 if (smc->cfg & CFG_MII_SELECT) {
974 if (smc->mii_if.phy_id != -1) { 938 if (smc->mii_if.phy_id != -1) {
975 dev_dbg(&link->dev, " MII transceiver at index %d, status %x.\n", 939 netdev_dbg(dev, " MII transceiver at index %d, status %x\n",
976 smc->mii_if.phy_id, j); 940 smc->mii_if.phy_id, j);
977 } else { 941 } else {
978 printk(KERN_NOTICE " No MII transceivers found!\n"); 942 netdev_notice(dev, " No MII transceivers found!\n");
979 } 943 }
980 } 944 }
981 return 0; 945 return 0;
@@ -988,18 +952,10 @@ config_failed:
988 return -ENODEV; 952 return -ENODEV;
989} /* smc91c92_config */ 953} /* smc91c92_config */
990 954
991/*======================================================================
992
993 After a card is removed, smc91c92_release() will unregister the net
994 device, and release the PCMCIA configuration. If the device is
995 still open, this will be postponed until it is closed.
996
997======================================================================*/
998
999static void smc91c92_release(struct pcmcia_device *link) 955static void smc91c92_release(struct pcmcia_device *link)
1000{ 956{
1001 dev_dbg(&link->dev, "smc91c92_release\n"); 957 dev_dbg(&link->dev, "smc91c92_release\n");
1002 if (link->win) { 958 if (link->resource[2]->end) {
1003 struct net_device *dev = link->priv; 959 struct net_device *dev = link->priv;
1004 struct smc_private *smc = netdev_priv(dev); 960 struct smc_private *smc = netdev_priv(dev);
1005 iounmap(smc->base); 961 iounmap(smc->base);
@@ -1081,10 +1037,10 @@ static void smc_dump(struct net_device *dev)
1081 save = inw(ioaddr + BANK_SELECT); 1037 save = inw(ioaddr + BANK_SELECT);
1082 for (w = 0; w < 4; w++) { 1038 for (w = 0; w < 4; w++) {
1083 SMC_SELECT_BANK(w); 1039 SMC_SELECT_BANK(w);
1084 printk(KERN_DEBUG "bank %d: ", w); 1040 netdev_printk(KERN_DEBUG, dev, "bank %d: ", w);
1085 for (i = 0; i < 14; i += 2) 1041 for (i = 0; i < 14; i += 2)
1086 printk(" %04x", inw(ioaddr + i)); 1042 pr_cont(" %04x", inw(ioaddr + i));
1087 printk("\n"); 1043 pr_cont("\n");
1088 } 1044 }
1089 outw(save, ioaddr + BANK_SELECT); 1045 outw(save, ioaddr + BANK_SELECT);
1090} 1046}
@@ -1106,7 +1062,7 @@ static int smc_open(struct net_device *dev)
1106 return -ENODEV; 1062 return -ENODEV;
1107 /* Physical device present signature. */ 1063 /* Physical device present signature. */
1108 if (check_sig(link) < 0) { 1064 if (check_sig(link) < 0) {
1109 printk("smc91c92_cs: Yikes! Bad chip signature!\n"); 1065 netdev_info(dev, "Yikes! Bad chip signature!\n");
1110 return -ENODEV; 1066 return -ENODEV;
1111 } 1067 }
1112 link->open++; 1068 link->open++;
@@ -1117,7 +1073,7 @@ static int smc_open(struct net_device *dev)
1117 1073
1118 smc_reset(dev); 1074 smc_reset(dev);
1119 init_timer(&smc->media); 1075 init_timer(&smc->media);
1120 smc->media.function = &media_check; 1076 smc->media.function = media_check;
1121 smc->media.data = (u_long) dev; 1077 smc->media.data = (u_long) dev;
1122 smc->media.expires = jiffies + HZ; 1078 smc->media.expires = jiffies + HZ;
1123 add_timer(&smc->media); 1079 add_timer(&smc->media);
@@ -1172,7 +1128,7 @@ static void smc_hardware_send_packet(struct net_device * dev)
1172 u_char packet_no; 1128 u_char packet_no;
1173 1129
1174 if (!skb) { 1130 if (!skb) {
1175 printk(KERN_ERR "%s: In XMIT with no packet to send.\n", dev->name); 1131 netdev_err(dev, "In XMIT with no packet to send\n");
1176 return; 1132 return;
1177 } 1133 }
1178 1134
@@ -1180,8 +1136,8 @@ static void smc_hardware_send_packet(struct net_device * dev)
1180 packet_no = inw(ioaddr + PNR_ARR) >> 8; 1136 packet_no = inw(ioaddr + PNR_ARR) >> 8;
1181 if (packet_no & 0x80) { 1137 if (packet_no & 0x80) {
1182 /* If not, there is a hardware problem! Likely an ejected card. */ 1138 /* If not, there is a hardware problem! Likely an ejected card. */
1183 printk(KERN_WARNING "%s: 91c92 hardware Tx buffer allocation" 1139 netdev_warn(dev, "hardware Tx buffer allocation failed, status %#2.2x\n",
1184 " failed, status %#2.2x.\n", dev->name, packet_no); 1140 packet_no);
1185 dev_kfree_skb_irq(skb); 1141 dev_kfree_skb_irq(skb);
1186 smc->saved_skb = NULL; 1142 smc->saved_skb = NULL;
1187 netif_start_queue(dev); 1143 netif_start_queue(dev);
@@ -1200,8 +1156,7 @@ static void smc_hardware_send_packet(struct net_device * dev)
1200 u_char *buf = skb->data; 1156 u_char *buf = skb->data;
1201 u_int length = skb->len; /* The chip will pad to ethernet min. */ 1157 u_int length = skb->len; /* The chip will pad to ethernet min. */
1202 1158
1203 pr_debug("%s: Trying to xmit packet of length %d.\n", 1159 netdev_dbg(dev, "Trying to xmit packet of length %d\n", length);
1204 dev->name, length);
1205 1160
1206 /* send the packet length: +6 for status word, length, and ctl */ 1161 /* send the packet length: +6 for status word, length, and ctl */
1207 outw(0, ioaddr + DATA_1); 1162 outw(0, ioaddr + DATA_1);
@@ -1233,9 +1188,8 @@ static void smc_tx_timeout(struct net_device *dev)
1233 struct smc_private *smc = netdev_priv(dev); 1188 struct smc_private *smc = netdev_priv(dev);
1234 unsigned int ioaddr = dev->base_addr; 1189 unsigned int ioaddr = dev->base_addr;
1235 1190
1236 printk(KERN_NOTICE "%s: SMC91c92 transmit timed out, " 1191 netdev_notice(dev, "transmit timed out, Tx_status %2.2x status %4.4x.\n",
1237 "Tx_status %2.2x status %4.4x.\n", 1192 inw(ioaddr)&0xff, inw(ioaddr + 2));
1238 dev->name, inw(ioaddr)&0xff, inw(ioaddr + 2));
1239 dev->stats.tx_errors++; 1193 dev->stats.tx_errors++;
1240 smc_reset(dev); 1194 smc_reset(dev);
1241 dev->trans_start = jiffies; /* prevent tx timeout */ 1195 dev->trans_start = jiffies; /* prevent tx timeout */
@@ -1254,14 +1208,14 @@ static netdev_tx_t smc_start_xmit(struct sk_buff *skb,
1254 1208
1255 netif_stop_queue(dev); 1209 netif_stop_queue(dev);
1256 1210
1257 pr_debug("%s: smc_start_xmit(length = %d) called," 1211 netdev_dbg(dev, "smc_start_xmit(length = %d) called, status %04x\n",
1258 " status %4.4x.\n", dev->name, skb->len, inw(ioaddr + 2)); 1212 skb->len, inw(ioaddr + 2));
1259 1213
1260 if (smc->saved_skb) { 1214 if (smc->saved_skb) {
1261 /* THIS SHOULD NEVER HAPPEN. */ 1215 /* THIS SHOULD NEVER HAPPEN. */
1262 dev->stats.tx_aborted_errors++; 1216 dev->stats.tx_aborted_errors++;
1263 printk(KERN_DEBUG "%s: Internal error -- sent packet while busy.\n", 1217 netdev_printk(KERN_DEBUG, dev,
1264 dev->name); 1218 "Internal error -- sent packet while busy\n");
1265 return NETDEV_TX_BUSY; 1219 return NETDEV_TX_BUSY;
1266 } 1220 }
1267 smc->saved_skb = skb; 1221 smc->saved_skb = skb;
@@ -1269,7 +1223,7 @@ static netdev_tx_t smc_start_xmit(struct sk_buff *skb,
1269 num_pages = skb->len >> 8; 1223 num_pages = skb->len >> 8;
1270 1224
1271 if (num_pages > 7) { 1225 if (num_pages > 7) {
1272 printk(KERN_ERR "%s: Far too big packet error.\n", dev->name); 1226 netdev_err(dev, "Far too big packet error: %d pages\n", num_pages);
1273 dev_kfree_skb (skb); 1227 dev_kfree_skb (skb);
1274 smc->saved_skb = NULL; 1228 smc->saved_skb = NULL;
1275 dev->stats.tx_dropped++; 1229 dev->stats.tx_dropped++;
@@ -1310,7 +1264,7 @@ static netdev_tx_t smc_start_xmit(struct sk_buff *skb,
1310 1264
1311/*====================================================================== 1265/*======================================================================
1312 1266
1313 Handle a Tx anomolous event. Entered while in Window 2. 1267 Handle a Tx anomalous event. Entered while in Window 2.
1314 1268
1315======================================================================*/ 1269======================================================================*/
1316 1270
@@ -1339,8 +1293,7 @@ static void smc_tx_err(struct net_device * dev)
1339 } 1293 }
1340 1294
1341 if (tx_status & TS_SUCCESS) { 1295 if (tx_status & TS_SUCCESS) {
1342 printk(KERN_NOTICE "%s: Successful packet caused error " 1296 netdev_notice(dev, "Successful packet caused error interrupt?\n");
1343 "interrupt?\n", dev->name);
1344 } 1297 }
1345 /* re-enable transmit */ 1298 /* re-enable transmit */
1346 SMC_SELECT_BANK(0); 1299 SMC_SELECT_BANK(0);
@@ -1530,8 +1483,7 @@ static void smc_rx(struct net_device *dev)
1530 /* Assertion: we are in Window 2. */ 1483 /* Assertion: we are in Window 2. */
1531 1484
1532 if (inw(ioaddr + FIFO_PORTS) & FP_RXEMPTY) { 1485 if (inw(ioaddr + FIFO_PORTS) & FP_RXEMPTY) {
1533 printk(KERN_ERR "%s: smc_rx() with nothing on Rx FIFO.\n", 1486 netdev_err(dev, "smc_rx() with nothing on Rx FIFO\n");
1534 dev->name);
1535 return; 1487 return;
1536 } 1488 }
1537 1489
@@ -1646,8 +1598,7 @@ static int s9k_config(struct net_device *dev, struct ifmap *map)
1646 else if (map->port > 2) 1598 else if (map->port > 2)
1647 return -EINVAL; 1599 return -EINVAL;
1648 dev->if_port = map->port; 1600 dev->if_port = map->port;
1649 printk(KERN_INFO "%s: switched to %s port\n", 1601 netdev_info(dev, "switched to %s port\n", if_names[dev->if_port]);
1650 dev->name, if_names[dev->if_port]);
1651 smc_reset(dev); 1602 smc_reset(dev);
1652 } 1603 }
1653 return 0; 1604 return 0;
@@ -1798,7 +1749,7 @@ static void media_check(u_long arg)
1798 this, we can limp along even if the interrupt is blocked */ 1749 this, we can limp along even if the interrupt is blocked */
1799 if (smc->watchdog++ && ((i>>8) & i)) { 1750 if (smc->watchdog++ && ((i>>8) & i)) {
1800 if (!smc->fast_poll) 1751 if (!smc->fast_poll)
1801 printk(KERN_INFO "%s: interrupt(s) dropped!\n", dev->name); 1752 netdev_info(dev, "interrupt(s) dropped!\n");
1802 local_irq_save(flags); 1753 local_irq_save(flags);
1803 smc_interrupt(dev->irq, dev); 1754 smc_interrupt(dev->irq, dev);
1804 local_irq_restore(flags); 1755 local_irq_restore(flags);
@@ -1822,7 +1773,7 @@ static void media_check(u_long arg)
1822 SMC_SELECT_BANK(3); 1773 SMC_SELECT_BANK(3);
1823 link = mdio_read(dev, smc->mii_if.phy_id, 1); 1774 link = mdio_read(dev, smc->mii_if.phy_id, 1);
1824 if (!link || (link == 0xffff)) { 1775 if (!link || (link == 0xffff)) {
1825 printk(KERN_INFO "%s: MII is missing!\n", dev->name); 1776 netdev_info(dev, "MII is missing!\n");
1826 smc->mii_if.phy_id = -1; 1777 smc->mii_if.phy_id = -1;
1827 goto reschedule; 1778 goto reschedule;
1828 } 1779 }
@@ -1830,15 +1781,13 @@ static void media_check(u_long arg)
1830 link &= 0x0004; 1781 link &= 0x0004;
1831 if (link != smc->link_status) { 1782 if (link != smc->link_status) {
1832 u_short p = mdio_read(dev, smc->mii_if.phy_id, 5); 1783 u_short p = mdio_read(dev, smc->mii_if.phy_id, 5);
1833 printk(KERN_INFO "%s: %s link beat\n", dev->name, 1784 netdev_info(dev, "%s link beat\n", link ? "found" : "lost");
1834 (link) ? "found" : "lost");
1835 smc->duplex = (((p & 0x0100) || ((p & 0x1c0) == 0x40)) 1785 smc->duplex = (((p & 0x0100) || ((p & 0x1c0) == 0x40))
1836 ? TCR_FDUPLX : 0); 1786 ? TCR_FDUPLX : 0);
1837 if (link) { 1787 if (link) {
1838 printk(KERN_INFO "%s: autonegotiation complete: " 1788 netdev_info(dev, "autonegotiation complete: "
1839 "%sbaseT-%cD selected\n", dev->name, 1789 "%dbaseT-%cD selected\n",
1840 ((p & 0x0180) ? "100" : "10"), 1790 (p & 0x0180) ? 100 : 10, smc->duplex ? 'F' : 'H');
1841 (smc->duplex ? 'F' : 'H'));
1842 } 1791 }
1843 SMC_SELECT_BANK(0); 1792 SMC_SELECT_BANK(0);
1844 outw(inw(ioaddr + TCR) | smc->duplex, ioaddr + TCR); 1793 outw(inw(ioaddr + TCR) | smc->duplex, ioaddr + TCR);
@@ -1857,25 +1806,23 @@ static void media_check(u_long arg)
1857 if (media != smc->media_status) { 1806 if (media != smc->media_status) {
1858 if ((media & smc->media_status & 1) && 1807 if ((media & smc->media_status & 1) &&
1859 ((smc->media_status ^ media) & EPH_LINK_OK)) 1808 ((smc->media_status ^ media) & EPH_LINK_OK))
1860 printk(KERN_INFO "%s: %s link beat\n", dev->name, 1809 netdev_info(dev, "%s link beat\n",
1861 (smc->media_status & EPH_LINK_OK ? "lost" : "found")); 1810 smc->media_status & EPH_LINK_OK ? "lost" : "found");
1862 else if ((media & smc->media_status & 2) && 1811 else if ((media & smc->media_status & 2) &&
1863 ((smc->media_status ^ media) & EPH_16COL)) 1812 ((smc->media_status ^ media) & EPH_16COL))
1864 printk(KERN_INFO "%s: coax cable %s\n", dev->name, 1813 netdev_info(dev, "coax cable %s\n",
1865 (media & EPH_16COL ? "problem" : "ok")); 1814 media & EPH_16COL ? "problem" : "ok");
1866 if (dev->if_port == 0) { 1815 if (dev->if_port == 0) {
1867 if (media & 1) { 1816 if (media & 1) {
1868 if (media & EPH_LINK_OK) 1817 if (media & EPH_LINK_OK)
1869 printk(KERN_INFO "%s: flipped to 10baseT\n", 1818 netdev_info(dev, "flipped to 10baseT\n");
1870 dev->name);
1871 else 1819 else
1872 smc_set_xcvr(dev, 2); 1820 smc_set_xcvr(dev, 2);
1873 } else { 1821 } else {
1874 if (media & EPH_16COL) 1822 if (media & EPH_16COL)
1875 smc_set_xcvr(dev, 1); 1823 smc_set_xcvr(dev, 1);
1876 else 1824 else
1877 printk(KERN_INFO "%s: flipped to 10base2\n", 1825 netdev_info(dev, "flipped to 10base2\n");
1878 dev->name);
1879 } 1826 }
1880 } 1827 }
1881 smc->media_status = media; 1828 smc->media_status = media;
@@ -1913,7 +1860,7 @@ static int smc_netdev_get_ecmd(struct net_device *dev, struct ethtool_cmd *ecmd)
1913 tmp = inw(ioaddr + CONFIG); 1860 tmp = inw(ioaddr + CONFIG);
1914 ecmd->port = (tmp & CFG_AUI_SELECT) ? PORT_AUI : PORT_TP; 1861 ecmd->port = (tmp & CFG_AUI_SELECT) ? PORT_AUI : PORT_TP;
1915 ecmd->transceiver = XCVR_INTERNAL; 1862 ecmd->transceiver = XCVR_INTERNAL;
1916 ecmd->speed = SPEED_10; 1863 ethtool_cmd_speed_set(ecmd, SPEED_10);
1917 ecmd->phy_address = ioaddr + MGMT; 1864 ecmd->phy_address = ioaddr + MGMT;
1918 1865
1919 SMC_SELECT_BANK(0); 1866 SMC_SELECT_BANK(0);
@@ -1928,8 +1875,8 @@ static int smc_netdev_set_ecmd(struct net_device *dev, struct ethtool_cmd *ecmd)
1928 u16 tmp; 1875 u16 tmp;
1929 unsigned int ioaddr = dev->base_addr; 1876 unsigned int ioaddr = dev->base_addr;
1930 1877
1931 if (ecmd->speed != SPEED_10) 1878 if (ethtool_cmd_speed(ecmd) != SPEED_10)
1932 return -EINVAL; 1879 return -EINVAL;
1933 if (ecmd->duplex != DUPLEX_HALF && ecmd->duplex != DUPLEX_FULL) 1880 if (ecmd->duplex != DUPLEX_HALF && ecmd->duplex != DUPLEX_FULL)
1934 return -EINVAL; 1881 return -EINVAL;
1935 if (ecmd->port != PORT_TP && ecmd->port != PORT_AUI) 1882 if (ecmd->port != PORT_TP && ecmd->port != PORT_AUI)
@@ -2067,7 +2014,7 @@ static int smc_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
2067 return rc; 2014 return rc;
2068} 2015}
2069 2016
2070static struct pcmcia_device_id smc91c92_ids[] = { 2017static const struct pcmcia_device_id smc91c92_ids[] = {
2071 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0109, 0x0501), 2018 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0109, 0x0501),
2072 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0140, 0x000a), 2019 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0140, 0x000a),
2073 PCMCIA_PFC_DEVICE_PROD_ID123(0, "MEGAHERTZ", "CC/XJEM3288", "DATA/FAX/CELL ETHERNET MODEM", 0xf510db04, 0x04cd2988, 0x46a52d63), 2020 PCMCIA_PFC_DEVICE_PROD_ID123(0, "MEGAHERTZ", "CC/XJEM3288", "DATA/FAX/CELL ETHERNET MODEM", 0xf510db04, 0x04cd2988, 0x46a52d63),
@@ -2101,9 +2048,7 @@ MODULE_DEVICE_TABLE(pcmcia, smc91c92_ids);
2101 2048
2102static struct pcmcia_driver smc91c92_cs_driver = { 2049static struct pcmcia_driver smc91c92_cs_driver = {
2103 .owner = THIS_MODULE, 2050 .owner = THIS_MODULE,
2104 .drv = { 2051 .name = "smc91c92_cs",
2105 .name = "smc91c92_cs",
2106 },
2107 .probe = smc91c92_probe, 2052 .probe = smc91c92_probe,
2108 .remove = smc91c92_detach, 2053 .remove = smc91c92_detach,
2109 .id_table = smc91c92_ids, 2054 .id_table = smc91c92_ids,
diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c
index f5819526b5ee..e33b190d716f 100644
--- a/drivers/net/pcmcia/xirc2ps_cs.c
+++ b/drivers/net/pcmcia/xirc2ps_cs.c
@@ -63,6 +63,8 @@
63 * OF THE POSSIBILITY OF SUCH DAMAGE. 63 * OF THE POSSIBILITY OF SUCH DAMAGE.
64 */ 64 */
65 65
66#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
67
66#include <linux/module.h> 68#include <linux/module.h>
67#include <linux/kernel.h> 69#include <linux/kernel.h>
68#include <linux/init.h> 70#include <linux/init.h>
@@ -82,7 +84,6 @@
82#include <linux/bitops.h> 84#include <linux/bitops.h>
83#include <linux/mii.h> 85#include <linux/mii.h>
84 86
85#include <pcmcia/cs.h>
86#include <pcmcia/cistpl.h> 87#include <pcmcia/cistpl.h>
87#include <pcmcia/cisreg.h> 88#include <pcmcia/cisreg.h>
88#include <pcmcia/ciscode.h> 89#include <pcmcia/ciscode.h>
@@ -210,13 +211,6 @@ enum xirc_cmd { /* Commands */
210 211
211static const char *if_names[] = { "Auto", "10BaseT", "10Base2", "AUI", "100BaseT" }; 212static const char *if_names[] = { "Auto", "10BaseT", "10Base2", "AUI", "100BaseT" };
212 213
213
214#define KDBG_XIRC KERN_DEBUG "xirc2ps_cs: "
215#define KERR_XIRC KERN_ERR "xirc2ps_cs: "
216#define KWRN_XIRC KERN_WARNING "xirc2ps_cs: "
217#define KNOT_XIRC KERN_NOTICE "xirc2ps_cs: "
218#define KINF_XIRC KERN_INFO "xirc2ps_cs: "
219
220/* card types */ 214/* card types */
221#define XIR_UNKNOWN 0 /* unknown: not supported */ 215#define XIR_UNKNOWN 0 /* unknown: not supported */
222#define XIR_CE 1 /* (prodid 1) different hardware: not supported */ 216#define XIR_CE 1 /* (prodid 1) different hardware: not supported */
@@ -267,33 +261,11 @@ static unsigned mii_rd(unsigned int ioaddr, u_char phyaddr, u_char phyreg);
267static void mii_wr(unsigned int ioaddr, u_char phyaddr, u_char phyreg, 261static void mii_wr(unsigned int ioaddr, u_char phyaddr, u_char phyreg,
268 unsigned data, int len); 262 unsigned data, int len);
269 263
270/*
271 * The event() function is this driver's Card Services event handler.
272 * It will be called by Card Services when an appropriate card status
273 * event is received. The config() and release() entry points are
274 * used to configure or release a socket, in response to card insertion
275 * and ejection events. They are invoked from the event handler.
276 */
277
278static int has_ce2_string(struct pcmcia_device * link); 264static int has_ce2_string(struct pcmcia_device * link);
279static int xirc2ps_config(struct pcmcia_device * link); 265static int xirc2ps_config(struct pcmcia_device * link);
280static void xirc2ps_release(struct pcmcia_device * link); 266static void xirc2ps_release(struct pcmcia_device * link);
281
282/****************
283 * The attach() and detach() entry points are used to create and destroy
284 * "instances" of the driver, where each instance represents everything
285 * needed to manage one actual PCMCIA card.
286 */
287
288static void xirc2ps_detach(struct pcmcia_device *p_dev); 267static void xirc2ps_detach(struct pcmcia_device *p_dev);
289 268
290/****************
291 * You'll also need to prototype all the functions that will actually
292 * be used to talk to your device. See 'pcmem_cs' for a good example
293 * of a fully self-sufficient driver; the other drivers rely more or
294 * less on other parts of the kernel.
295 */
296
297static irqreturn_t xirc2ps_interrupt(int irq, void *dev_id); 269static irqreturn_t xirc2ps_interrupt(int irq, void *dev_id);
298 270
299typedef struct local_info_t { 271typedef struct local_info_t {
@@ -350,26 +322,26 @@ PrintRegisters(struct net_device *dev)
350 if (pc_debug > 1) { 322 if (pc_debug > 1) {
351 int i, page; 323 int i, page;
352 324
353 printk(KDBG_XIRC "Register common: "); 325 printk(KERN_DEBUG pr_fmt("Register common: "));
354 for (i = 0; i < 8; i++) 326 for (i = 0; i < 8; i++)
355 printk(" %2.2x", GetByte(i)); 327 pr_cont(" %2.2x", GetByte(i));
356 printk("\n"); 328 pr_cont("\n");
357 for (page = 0; page <= 8; page++) { 329 for (page = 0; page <= 8; page++) {
358 printk(KDBG_XIRC "Register page %2x: ", page); 330 printk(KERN_DEBUG pr_fmt("Register page %2x: "), page);
359 SelectPage(page); 331 SelectPage(page);
360 for (i = 8; i < 16; i++) 332 for (i = 8; i < 16; i++)
361 printk(" %2.2x", GetByte(i)); 333 pr_cont(" %2.2x", GetByte(i));
362 printk("\n"); 334 pr_cont("\n");
363 } 335 }
364 for (page=0x40 ; page <= 0x5f; page++) { 336 for (page=0x40 ; page <= 0x5f; page++) {
365 if (page == 0x43 || (page >= 0x46 && page <= 0x4f) || 337 if (page == 0x43 || (page >= 0x46 && page <= 0x4f) ||
366 (page >= 0x51 && page <=0x5e)) 338 (page >= 0x51 && page <=0x5e))
367 continue; 339 continue;
368 printk(KDBG_XIRC "Register page %2x: ", page); 340 printk(KERN_DEBUG pr_fmt("Register page %2x: "), page);
369 SelectPage(page); 341 SelectPage(page);
370 for (i = 8; i < 16; i++) 342 for (i = 8; i < 16; i++)
371 printk(" %2.2x", GetByte(i)); 343 pr_cont(" %2.2x", GetByte(i));
372 printk("\n"); 344 pr_cont("\n");
373 } 345 }
374 } 346 }
375} 347}
@@ -501,16 +473,6 @@ static const struct net_device_ops netdev_ops = {
501 .ndo_validate_addr = eth_validate_addr, 473 .ndo_validate_addr = eth_validate_addr,
502}; 474};
503 475
504/****************
505 * xirc2ps_attach() creates an "instance" of the driver, allocating
506 * local data structures for one device. The device is registered
507 * with Card Services.
508 *
509 * The dev_link structure is initialized, but we don't actually
510 * configure the card at this point -- we wait until we receive a
511 * card insertion event.
512 */
513
514static int 476static int
515xirc2ps_probe(struct pcmcia_device *link) 477xirc2ps_probe(struct pcmcia_device *link)
516{ 478{
@@ -529,9 +491,7 @@ xirc2ps_probe(struct pcmcia_device *link)
529 link->priv = dev; 491 link->priv = dev;
530 492
531 /* General socket configuration */ 493 /* General socket configuration */
532 link->conf.Attributes = CONF_ENABLE_IRQ; 494 link->config_index = 1;
533 link->conf.IntType = INT_MEMORY_AND_IO;
534 link->conf.ConfigIndex = 1;
535 495
536 /* Fill in card specific entries */ 496 /* Fill in card specific entries */
537 dev->netdev_ops = &netdev_ops; 497 dev->netdev_ops = &netdev_ops;
@@ -542,13 +502,6 @@ xirc2ps_probe(struct pcmcia_device *link)
542 return xirc2ps_config(link); 502 return xirc2ps_config(link);
543} /* xirc2ps_attach */ 503} /* xirc2ps_attach */
544 504
545/****************
546 * This deletes a driver "instance". The device is de-registered
547 * with Card Services. If it has been released, all local data
548 * structures are freed. Otherwise, the structures will be freed
549 * when the device is released.
550 */
551
552static void 505static void
553xirc2ps_detach(struct pcmcia_device *link) 506xirc2ps_detach(struct pcmcia_device *link)
554{ 507{
@@ -608,11 +561,11 @@ set_card_type(struct pcmcia_device *link)
608 local->modem = 0; 561 local->modem = 0;
609 local->card_type = XIR_UNKNOWN; 562 local->card_type = XIR_UNKNOWN;
610 if (!(prodid & 0x40)) { 563 if (!(prodid & 0x40)) {
611 printk(KNOT_XIRC "Ooops: Not a creditcard\n"); 564 pr_notice("Oops: Not a creditcard\n");
612 return 0; 565 return 0;
613 } 566 }
614 if (!(mediaid & 0x01)) { 567 if (!(mediaid & 0x01)) {
615 printk(KNOT_XIRC "Not an Ethernet card\n"); 568 pr_notice("Not an Ethernet card\n");
616 return 0; 569 return 0;
617 } 570 }
618 if (mediaid & 0x10) { 571 if (mediaid & 0x10) {
@@ -643,12 +596,11 @@ set_card_type(struct pcmcia_device *link)
643 } 596 }
644 } 597 }
645 if (local->card_type == XIR_CE || local->card_type == XIR_CEM) { 598 if (local->card_type == XIR_CE || local->card_type == XIR_CEM) {
646 printk(KNOT_XIRC "Sorry, this is an old CE card\n"); 599 pr_notice("Sorry, this is an old CE card\n");
647 return 0; 600 return 0;
648 } 601 }
649 if (local->card_type == XIR_UNKNOWN) 602 if (local->card_type == XIR_UNKNOWN)
650 printk(KNOT_XIRC "unknown card (mediaid=%02x prodid=%02x)\n", 603 pr_notice("unknown card (mediaid=%02x prodid=%02x)\n", mediaid, prodid);
651 mediaid, prodid);
652 604
653 return 1; 605 return 1;
654} 606}
@@ -667,44 +619,53 @@ has_ce2_string(struct pcmcia_device * p_dev)
667} 619}
668 620
669static int 621static int
670xirc2ps_config_modem(struct pcmcia_device *p_dev, 622xirc2ps_config_modem(struct pcmcia_device *p_dev, void *priv_data)
671 cistpl_cftable_entry_t *cf,
672 cistpl_cftable_entry_t *dflt,
673 unsigned int vcc,
674 void *priv_data)
675{ 623{
676 unsigned int ioaddr; 624 unsigned int ioaddr;
677 625
678 if (cf->io.nwin > 0 && (cf->io.win[0].base & 0xf) == 8) { 626 if ((p_dev->resource[0]->start & 0xf) == 8)
679 for (ioaddr = 0x300; ioaddr < 0x400; ioaddr += 0x10) { 627 return -ENODEV;
680 p_dev->resource[1]->start = cf->io.win[0].base; 628
681 p_dev->resource[0]->start = ioaddr; 629 p_dev->resource[0]->end = 16;
682 if (!pcmcia_request_io(p_dev)) 630 p_dev->resource[1]->end = 8;
683 return 0; 631 p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
684 } 632 p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_16;
633 p_dev->resource[1]->flags &= ~IO_DATA_PATH_WIDTH;
634 p_dev->resource[1]->flags |= IO_DATA_PATH_WIDTH_8;
635 p_dev->io_lines = 10;
636
637 p_dev->resource[1]->start = p_dev->resource[0]->start;
638 for (ioaddr = 0x300; ioaddr < 0x400; ioaddr += 0x10) {
639 p_dev->resource[0]->start = ioaddr;
640 if (!pcmcia_request_io(p_dev))
641 return 0;
685 } 642 }
686 return -ENODEV; 643 return -ENODEV;
687} 644}
688 645
689static int 646static int
690xirc2ps_config_check(struct pcmcia_device *p_dev, 647xirc2ps_config_check(struct pcmcia_device *p_dev, void *priv_data)
691 cistpl_cftable_entry_t *cf,
692 cistpl_cftable_entry_t *dflt,
693 unsigned int vcc,
694 void *priv_data)
695{ 648{
696 int *pass = priv_data; 649 int *pass = priv_data;
650 resource_size_t tmp = p_dev->resource[1]->start;
697 651
698 if (cf->io.nwin > 0 && (cf->io.win[0].base & 0xf) == 8) { 652 tmp += (*pass ? (p_dev->config_index & 0x20 ? -24 : 8)
699 p_dev->resource[1]->start = cf->io.win[0].base; 653 : (p_dev->config_index & 0x20 ? 8 : -24));
700 p_dev->resource[0]->start = p_dev->resource[1]->start 654
701 + (*pass ? (cf->index & 0x20 ? -24:8) 655 if ((p_dev->resource[0]->start & 0xf) == 8)
702 : (cf->index & 0x20 ? 8:-24)); 656 return -ENODEV;
703 if (!pcmcia_request_io(p_dev))
704 return 0;
705 }
706 return -ENODEV;
707 657
658 p_dev->resource[0]->end = 18;
659 p_dev->resource[1]->end = 8;
660 p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
661 p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_16;
662 p_dev->resource[1]->flags &= ~IO_DATA_PATH_WIDTH;
663 p_dev->resource[1]->flags |= IO_DATA_PATH_WIDTH_8;
664 p_dev->io_lines = 10;
665
666 p_dev->resource[1]->start = p_dev->resource[0]->start;
667 p_dev->resource[0]->start = tmp;
668 return pcmcia_request_io(p_dev);
708} 669}
709 670
710 671
@@ -727,11 +688,6 @@ static int pcmcia_get_mac_ce(struct pcmcia_device *p_dev,
727}; 688};
728 689
729 690
730/****************
731 * xirc2ps_config() is scheduled to run after a CARD_INSERTION event
732 * is received, to configure the PCMCIA socket, and to make the
733 * ethernet device available to the system.
734 */
735static int 691static int
736xirc2ps_config(struct pcmcia_device * link) 692xirc2ps_config(struct pcmcia_device * link)
737{ 693{
@@ -748,7 +704,7 @@ xirc2ps_config(struct pcmcia_device * link)
748 704
749 /* Is this a valid card */ 705 /* Is this a valid card */
750 if (link->has_manf_id == 0) { 706 if (link->has_manf_id == 0) {
751 printk(KNOT_XIRC "manfid not found in CIS\n"); 707 pr_notice("manfid not found in CIS\n");
752 goto failure; 708 goto failure;
753 } 709 }
754 710
@@ -770,14 +726,14 @@ xirc2ps_config(struct pcmcia_device * link)
770 local->manf_str = "Toshiba"; 726 local->manf_str = "Toshiba";
771 break; 727 break;
772 default: 728 default:
773 printk(KNOT_XIRC "Unknown Card Manufacturer ID: 0x%04x\n", 729 pr_notice("Unknown Card Manufacturer ID: 0x%04x\n",
774 (unsigned)link->manf_id); 730 (unsigned)link->manf_id);
775 goto failure; 731 goto failure;
776 } 732 }
777 dev_dbg(&link->dev, "found %s card\n", local->manf_str); 733 dev_dbg(&link->dev, "found %s card\n", local->manf_str);
778 734
779 if (!set_card_type(link)) { 735 if (!set_card_type(link)) {
780 printk(KNOT_XIRC "this card is not supported\n"); 736 pr_notice("this card is not supported\n");
781 goto failure; 737 goto failure;
782 } 738 }
783 739
@@ -803,44 +759,38 @@ xirc2ps_config(struct pcmcia_device * link)
803 err = pcmcia_loop_tuple(link, CISTPL_FUNCE, pcmcia_get_mac_ce, dev); 759 err = pcmcia_loop_tuple(link, CISTPL_FUNCE, pcmcia_get_mac_ce, dev);
804 760
805 if (err) { 761 if (err) {
806 printk(KNOT_XIRC "node-id not found in CIS\n"); 762 pr_notice("node-id not found in CIS\n");
807 goto failure; 763 goto failure;
808 } 764 }
809 765
810 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16;
811 link->io_lines = 10;
812 if (local->modem) { 766 if (local->modem) {
813 int pass; 767 int pass;
768 link->config_flags |= CONF_AUTO_SET_IO;
814 769
815 if (do_sound) {
816 link->conf.Attributes |= CONF_ENABLE_SPKR;
817 link->conf.Status |= CCSR_AUDIO_ENA;
818 }
819 link->resource[1]->end = 8;
820 link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8;
821 if (local->dingo) { 770 if (local->dingo) {
822 /* Take the Modem IO port from the CIS and scan for a free 771 /* Take the Modem IO port from the CIS and scan for a free
823 * Ethernet port */ 772 * Ethernet port */
824 link->resource[0]->end = 16; /* no Mako stuff anymore */
825 if (!pcmcia_loop_config(link, xirc2ps_config_modem, NULL)) 773 if (!pcmcia_loop_config(link, xirc2ps_config_modem, NULL))
826 goto port_found; 774 goto port_found;
827 } else { 775 } else {
828 link->resource[0]->end = 18;
829 /* We do 2 passes here: The first one uses the regular mapping and 776 /* We do 2 passes here: The first one uses the regular mapping and
830 * the second tries again, thereby considering that the 32 ports are 777 * the second tries again, thereby considering that the 32 ports are
831 * mirrored every 32 bytes. Actually we use a mirrored port for 778 * mirrored every 32 bytes. Actually we use a mirrored port for
832 * the Mako if (on the first pass) the COR bit 5 is set. 779 * the Mako if (on the first pass) the COR bit 5 is set.
833 */ 780 */
834 for (pass=0; pass < 2; pass++) 781 for (pass=0; pass < 2; pass++)
835 if (!pcmcia_loop_config(link, xirc2ps_config_check, &pass)) 782 if (!pcmcia_loop_config(link, xirc2ps_config_check,
783 &pass))
836 goto port_found; 784 goto port_found;
837 /* if special option: 785 /* if special option:
838 * try to configure as Ethernet only. 786 * try to configure as Ethernet only.
839 * .... */ 787 * .... */
840 } 788 }
841 printk(KNOT_XIRC "no ports available\n"); 789 pr_notice("no ports available\n");
842 } else { 790 } else {
791 link->io_lines = 10;
843 link->resource[0]->end = 16; 792 link->resource[0]->end = 16;
793 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16;
844 for (ioaddr = 0x300; ioaddr < 0x400; ioaddr += 0x10) { 794 for (ioaddr = 0x300; ioaddr < 0x400; ioaddr += 0x10) {
845 link->resource[0]->start = ioaddr; 795 link->resource[0]->start = ioaddr;
846 if (!(err = pcmcia_request_io(link))) 796 if (!(err = pcmcia_request_io(link)))
@@ -861,16 +811,14 @@ xirc2ps_config(struct pcmcia_device * link)
861 if ((err=pcmcia_request_irq(link, xirc2ps_interrupt))) 811 if ((err=pcmcia_request_irq(link, xirc2ps_interrupt)))
862 goto config_error; 812 goto config_error;
863 813
864 /**************** 814 link->config_flags |= CONF_ENABLE_IRQ;
865 * This actually configures the PCMCIA socket -- setting up 815 if (do_sound)
866 * the I/O windows and the interrupt mapping. 816 link->config_flags |= CONF_ENABLE_SPKR;
867 */ 817
868 if ((err=pcmcia_request_configuration(link, &link->conf))) 818 if ((err = pcmcia_enable_device(link)))
869 goto config_error; 819 goto config_error;
870 820
871 if (local->dingo) { 821 if (local->dingo) {
872 win_req_t req;
873
874 /* Reset the modem's BAR to the correct value 822 /* Reset the modem's BAR to the correct value
875 * This is necessary because in the RequestConfiguration call, 823 * This is necessary because in the RequestConfiguration call,
876 * the base address of the ethernet port (BasePort1) is written 824 * the base address of the ethernet port (BasePort1) is written
@@ -890,14 +838,14 @@ xirc2ps_config(struct pcmcia_device * link)
890 * is at 0x0800. So we allocate a window into the attribute 838 * is at 0x0800. So we allocate a window into the attribute
891 * memory and write direct to the CIS registers 839 * memory and write direct to the CIS registers
892 */ 840 */
893 req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; 841 link->resource[2]->flags = WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_AM |
894 req.Base = req.Size = 0; 842 WIN_ENABLE;
895 req.AccessSpeed = 0; 843 link->resource[2]->start = link->resource[2]->end = 0;
896 if ((err = pcmcia_request_window(link, &req, &link->win))) 844 if ((err = pcmcia_request_window(link, link->resource[2], 0)))
897 goto config_error; 845 goto config_error;
898 846
899 local->dingo_ccr = ioremap(req.Base,0x1000) + 0x0800; 847 local->dingo_ccr = ioremap(link->resource[2]->start, 0x1000) + 0x0800;
900 if ((err = pcmcia_map_mem_page(link, link->win, 0))) 848 if ((err = pcmcia_map_mem_page(link, link->resource[2], 0)))
901 goto config_error; 849 goto config_error;
902 850
903 /* Setup the CCRs; there are no infos in the CIS about the Ethernet 851 /* Setup the CCRs; there are no infos in the CIS about the Ethernet
@@ -911,24 +859,24 @@ xirc2ps_config(struct pcmcia_device * link)
911 #if 0 859 #if 0
912 { 860 {
913 u_char tmp; 861 u_char tmp;
914 printk(KERN_INFO "ECOR:"); 862 pr_info("ECOR:");
915 for (i=0; i < 7; i++) { 863 for (i=0; i < 7; i++) {
916 tmp = readb(local->dingo_ccr + i*2); 864 tmp = readb(local->dingo_ccr + i*2);
917 printk(" %02x", tmp); 865 pr_cont(" %02x", tmp);
918 } 866 }
919 printk("\n"); 867 pr_cont("\n");
920 printk(KERN_INFO "DCOR:"); 868 pr_info("DCOR:");
921 for (i=0; i < 4; i++) { 869 for (i=0; i < 4; i++) {
922 tmp = readb(local->dingo_ccr + 0x20 + i*2); 870 tmp = readb(local->dingo_ccr + 0x20 + i*2);
923 printk(" %02x", tmp); 871 pr_cont(" %02x", tmp);
924 } 872 }
925 printk("\n"); 873 pr_cont("\n");
926 printk(KERN_INFO "SCOR:"); 874 pr_info("SCOR:");
927 for (i=0; i < 10; i++) { 875 for (i=0; i < 10; i++) {
928 tmp = readb(local->dingo_ccr + 0x40 + i*2); 876 tmp = readb(local->dingo_ccr + 0x40 + i*2);
929 printk(" %02x", tmp); 877 pr_cont(" %02x", tmp);
930 } 878 }
931 printk("\n"); 879 pr_cont("\n");
932 } 880 }
933 #endif 881 #endif
934 882
@@ -947,7 +895,7 @@ xirc2ps_config(struct pcmcia_device * link)
947 (local->mohawk && if_port==4)) 895 (local->mohawk && if_port==4))
948 dev->if_port = if_port; 896 dev->if_port = if_port;
949 else 897 else
950 printk(KNOT_XIRC "invalid if_port requested\n"); 898 pr_notice("invalid if_port requested\n");
951 899
952 /* we can now register the device with the net subsystem */ 900 /* we can now register the device with the net subsystem */
953 dev->irq = link->irq; 901 dev->irq = link->irq;
@@ -959,14 +907,14 @@ xirc2ps_config(struct pcmcia_device * link)
959 SET_NETDEV_DEV(dev, &link->dev); 907 SET_NETDEV_DEV(dev, &link->dev);
960 908
961 if ((err=register_netdev(dev))) { 909 if ((err=register_netdev(dev))) {
962 printk(KNOT_XIRC "register_netdev() failed\n"); 910 pr_notice("register_netdev() failed\n");
963 goto config_error; 911 goto config_error;
964 } 912 }
965 913
966 /* give some infos about the hardware */ 914 /* give some infos about the hardware */
967 printk(KERN_INFO "%s: %s: port %#3lx, irq %d, hwaddr %pM\n", 915 netdev_info(dev, "%s: port %#3lx, irq %d, hwaddr %pM\n",
968 dev->name, local->manf_str,(u_long)dev->base_addr, (int)dev->irq, 916 local->manf_str, (u_long)dev->base_addr, (int)dev->irq,
969 dev->dev_addr); 917 dev->dev_addr);
970 918
971 return 0; 919 return 0;
972 920
@@ -978,17 +926,12 @@ xirc2ps_config(struct pcmcia_device * link)
978 return -ENODEV; 926 return -ENODEV;
979} /* xirc2ps_config */ 927} /* xirc2ps_config */
980 928
981/****************
982 * After a card is removed, xirc2ps_release() will unregister the net
983 * device, and release the PCMCIA configuration. If the device is
984 * still open, this will be postponed until it is closed.
985 */
986static void 929static void
987xirc2ps_release(struct pcmcia_device *link) 930xirc2ps_release(struct pcmcia_device *link)
988{ 931{
989 dev_dbg(&link->dev, "release\n"); 932 dev_dbg(&link->dev, "release\n");
990 933
991 if (link->win) { 934 if (link->resource[2]->end) {
992 struct net_device *dev = link->priv; 935 struct net_device *dev = link->priv;
993 local_info_t *local = netdev_priv(dev); 936 local_info_t *local = netdev_priv(dev);
994 if (local->dingo) 937 if (local->dingo)
@@ -1098,8 +1041,7 @@ xirc2ps_interrupt(int irq, void *dev_id)
1098 1041
1099 skb = dev_alloc_skb(pktlen+3); /* 1 extra so we can use insw */ 1042 skb = dev_alloc_skb(pktlen+3); /* 1 extra so we can use insw */
1100 if (!skb) { 1043 if (!skb) {
1101 printk(KNOT_XIRC "low memory, packet dropped (size=%u)\n", 1044 pr_notice("low memory, packet dropped (size=%u)\n", pktlen);
1102 pktlen);
1103 dev->stats.rx_dropped++; 1045 dev->stats.rx_dropped++;
1104 } else { /* okay get the packet */ 1046 } else { /* okay get the packet */
1105 skb_reserve(skb, 2); 1047 skb_reserve(skb, 2);
@@ -1268,7 +1210,7 @@ xirc_tx_timeout(struct net_device *dev)
1268{ 1210{
1269 local_info_t *lp = netdev_priv(dev); 1211 local_info_t *lp = netdev_priv(dev);
1270 dev->stats.tx_errors++; 1212 dev->stats.tx_errors++;
1271 printk(KERN_NOTICE "%s: transmit timed out\n", dev->name); 1213 netdev_notice(dev, "transmit timed out\n");
1272 schedule_work(&lp->tx_timeout_task); 1214 schedule_work(&lp->tx_timeout_task);
1273} 1215}
1274 1216
@@ -1435,8 +1377,7 @@ do_config(struct net_device *dev, struct ifmap *map)
1435 local->probe_port = 0; 1377 local->probe_port = 0;
1436 dev->if_port = map->port; 1378 dev->if_port = map->port;
1437 } 1379 }
1438 printk(KERN_INFO "%s: switching to %s port\n", 1380 netdev_info(dev, "switching to %s port\n", if_names[dev->if_port]);
1439 dev->name, if_names[dev->if_port]);
1440 do_reset(dev,1); /* not the fine way :-) */ 1381 do_reset(dev,1); /* not the fine way :-) */
1441 } 1382 }
1442 return 0; 1383 return 0;
@@ -1576,7 +1517,7 @@ do_reset(struct net_device *dev, int full)
1576 { 1517 {
1577 SelectPage(0); 1518 SelectPage(0);
1578 value = GetByte(XIRCREG_ESR); /* read the ESR */ 1519 value = GetByte(XIRCREG_ESR); /* read the ESR */
1579 printk(KERN_DEBUG "%s: ESR is: %#02x\n", dev->name, value); 1520 pr_debug("%s: ESR is: %#02x\n", dev->name, value);
1580 } 1521 }
1581 #endif 1522 #endif
1582 1523
@@ -1626,13 +1567,12 @@ do_reset(struct net_device *dev, int full)
1626 1567
1627 if (full && local->mohawk && init_mii(dev)) { 1568 if (full && local->mohawk && init_mii(dev)) {
1628 if (dev->if_port == 4 || local->dingo || local->new_mii) { 1569 if (dev->if_port == 4 || local->dingo || local->new_mii) {
1629 printk(KERN_INFO "%s: MII selected\n", dev->name); 1570 netdev_info(dev, "MII selected\n");
1630 SelectPage(2); 1571 SelectPage(2);
1631 PutByte(XIRCREG2_MSR, GetByte(XIRCREG2_MSR) | 0x08); 1572 PutByte(XIRCREG2_MSR, GetByte(XIRCREG2_MSR) | 0x08);
1632 msleep(20); 1573 msleep(20);
1633 } else { 1574 } else {
1634 printk(KERN_INFO "%s: MII detected; using 10mbs\n", 1575 netdev_info(dev, "MII detected; using 10mbs\n");
1635 dev->name);
1636 SelectPage(0x42); 1576 SelectPage(0x42);
1637 if (dev->if_port == 2) /* enable 10Base2 */ 1577 if (dev->if_port == 2) /* enable 10Base2 */
1638 PutByte(XIRCREG42_SWC1, 0xC0); 1578 PutByte(XIRCREG42_SWC1, 0xC0);
@@ -1677,8 +1617,8 @@ do_reset(struct net_device *dev, int full)
1677 } 1617 }
1678 1618
1679 if (full) 1619 if (full)
1680 printk(KERN_INFO "%s: media %s, silicon revision %d\n", 1620 netdev_info(dev, "media %s, silicon revision %d\n",
1681 dev->name, if_names[dev->if_port], local->silicon); 1621 if_names[dev->if_port], local->silicon);
1682 /* We should switch back to page 0 to avoid a bug in revision 0 1622 /* We should switch back to page 0 to avoid a bug in revision 0
1683 * where regs with offset below 8 can't be read after an access 1623 * where regs with offset below 8 can't be read after an access
1684 * to the MAC registers */ 1624 * to the MAC registers */
@@ -1720,8 +1660,7 @@ init_mii(struct net_device *dev)
1720 control = mii_rd(ioaddr, 0, 0); 1660 control = mii_rd(ioaddr, 0, 0);
1721 1661
1722 if (control & 0x0400) { 1662 if (control & 0x0400) {
1723 printk(KERN_NOTICE "%s can't take PHY out of isolation mode\n", 1663 netdev_notice(dev, "can't take PHY out of isolation mode\n");
1724 dev->name);
1725 local->probe_port = 0; 1664 local->probe_port = 0;
1726 return 0; 1665 return 0;
1727 } 1666 }
@@ -1739,8 +1678,7 @@ init_mii(struct net_device *dev)
1739 } 1678 }
1740 1679
1741 if (!(status & 0x0020)) { 1680 if (!(status & 0x0020)) {
1742 printk(KERN_INFO "%s: autonegotiation failed;" 1681 netdev_info(dev, "autonegotiation failed; using 10mbs\n");
1743 " using 10mbs\n", dev->name);
1744 if (!local->new_mii) { 1682 if (!local->new_mii) {
1745 control = 0x0000; 1683 control = 0x0000;
1746 mii_wr(ioaddr, 0, 0, control, 16); 1684 mii_wr(ioaddr, 0, 0, control, 16);
@@ -1750,8 +1688,7 @@ init_mii(struct net_device *dev)
1750 } 1688 }
1751 } else { 1689 } else {
1752 linkpartner = mii_rd(ioaddr, 0, 5); 1690 linkpartner = mii_rd(ioaddr, 0, 5);
1753 printk(KERN_INFO "%s: MII link partner: %04x\n", 1691 netdev_info(dev, "MII link partner: %04x\n", linkpartner);
1754 dev->name, linkpartner);
1755 if (linkpartner & 0x0080) { 1692 if (linkpartner & 0x0080) {
1756 dev->if_port = 4; 1693 dev->if_port = 4;
1757 } else 1694 } else
@@ -1801,7 +1738,7 @@ do_stop(struct net_device *dev)
1801 return 0; 1738 return 0;
1802} 1739}
1803 1740
1804static struct pcmcia_device_id xirc2ps_ids[] = { 1741static const struct pcmcia_device_id xirc2ps_ids[] = {
1805 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0089, 0x110a), 1742 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0089, 0x110a),
1806 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0138, 0x110a), 1743 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0138, 0x110a),
1807 PCMCIA_PFC_DEVICE_PROD_ID13(0, "Xircom", "CEM28", 0x2e3ee845, 0x0ea978ea), 1744 PCMCIA_PFC_DEVICE_PROD_ID13(0, "Xircom", "CEM28", 0x2e3ee845, 0x0ea978ea),
@@ -1830,9 +1767,7 @@ MODULE_DEVICE_TABLE(pcmcia, xirc2ps_ids);
1830 1767
1831static struct pcmcia_driver xirc2ps_cs_driver = { 1768static struct pcmcia_driver xirc2ps_cs_driver = {
1832 .owner = THIS_MODULE, 1769 .owner = THIS_MODULE,
1833 .drv = { 1770 .name = "xirc2ps_cs",
1834 .name = "xirc2ps_cs",
1835 },
1836 .probe = xirc2ps_probe, 1771 .probe = xirc2ps_probe,
1837 .remove = xirc2ps_detach, 1772 .remove = xirc2ps_detach,
1838 .id_table = xirc2ps_ids, 1773 .id_table = xirc2ps_ids,