aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pcmcia/smc91c92_cs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/pcmcia/smc91c92_cs.c')
-rw-r--r--drivers/net/pcmcia/smc91c92_cs.c229
1 files changed, 87 insertions, 142 deletions
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,