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