aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/3c509.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/3c509.c')
-rw-r--r--drivers/net/3c509.c76
1 files changed, 37 insertions, 39 deletions
diff --git a/drivers/net/3c509.c b/drivers/net/3c509.c
index 682aad897081..d2137efbd455 100644
--- a/drivers/net/3c509.c
+++ b/drivers/net/3c509.c
@@ -257,7 +257,7 @@ static int el3_isa_id_sequence(__be16 *phys_addr)
257 && !memcmp(phys_addr, el3_devs[i]->dev_addr, 257 && !memcmp(phys_addr, el3_devs[i]->dev_addr,
258 ETH_ALEN)) { 258 ETH_ALEN)) {
259 if (el3_debug > 3) 259 if (el3_debug > 3)
260 printk(KERN_DEBUG "3c509 with address %02x %02x %02x %02x %02x %02x was found by ISAPnP\n", 260 pr_debug("3c509 with address %02x %02x %02x %02x %02x %02x was found by ISAPnP\n",
261 phys_addr[0] & 0xff, phys_addr[0] >> 8, 261 phys_addr[0] & 0xff, phys_addr[0] >> 8,
262 phys_addr[1] & 0xff, phys_addr[1] >> 8, 262 phys_addr[1] & 0xff, phys_addr[1] >> 8,
263 phys_addr[2] & 0xff, phys_addr[2] >> 8); 263 phys_addr[2] & 0xff, phys_addr[2] >> 8);
@@ -578,19 +578,18 @@ static int __devinit el3_common_init(struct net_device *dev)
578 578
579 err = register_netdev(dev); 579 err = register_netdev(dev);
580 if (err) { 580 if (err) {
581 printk(KERN_ERR "Failed to register 3c5x9 at %#3.3lx, IRQ %d.\n", 581 pr_err("Failed to register 3c5x9 at %#3.3lx, IRQ %d.\n",
582 dev->base_addr, dev->irq); 582 dev->base_addr, dev->irq);
583 release_region(dev->base_addr, EL3_IO_EXTENT); 583 release_region(dev->base_addr, EL3_IO_EXTENT);
584 return err; 584 return err;
585 } 585 }
586 586
587 printk(KERN_INFO "%s: 3c5x9 found at %#3.3lx, %s port, " 587 pr_info("%s: 3c5x9 found at %#3.3lx, %s port, address %pM, IRQ %d.\n",
588 "address %pM, IRQ %d.\n",
589 dev->name, dev->base_addr, if_names[(dev->if_port & 0x03)], 588 dev->name, dev->base_addr, if_names[(dev->if_port & 0x03)],
590 dev->dev_addr, dev->irq); 589 dev->dev_addr, dev->irq);
591 590
592 if (el3_debug > 0) 591 if (el3_debug > 0)
593 printk(KERN_INFO "%s", version); 592 pr_info("%s", version);
594 return 0; 593 return 0;
595 594
596} 595}
@@ -629,8 +628,8 @@ static int __init el3_mca_probe(struct device *device)
629 irq = pos5 & 0x0f; 628 irq = pos5 & 0x0f;
630 629
631 630
632 printk(KERN_INFO "3c529: found %s at slot %d\n", 631 pr_info("3c529: found %s at slot %d\n",
633 el3_mca_adapter_names[mdev->index], slot + 1); 632 el3_mca_adapter_names[mdev->index], slot + 1);
634 633
635 /* claim the slot */ 634 /* claim the slot */
636 strncpy(mdev->name, el3_mca_adapter_names[mdev->index], 635 strncpy(mdev->name, el3_mca_adapter_names[mdev->index],
@@ -642,7 +641,7 @@ static int __init el3_mca_probe(struct device *device)
642 irq = mca_device_transform_irq(mdev, irq); 641 irq = mca_device_transform_irq(mdev, irq);
643 ioaddr = mca_device_transform_ioport(mdev, ioaddr); 642 ioaddr = mca_device_transform_ioport(mdev, ioaddr);
644 if (el3_debug > 2) { 643 if (el3_debug > 2) {
645 printk(KERN_DEBUG "3c529: irq %d ioaddr 0x%x ifport %d\n", irq, ioaddr, if_port); 644 pr_debug("3c529: irq %d ioaddr 0x%x ifport %d\n", irq, ioaddr, if_port);
646 } 645 }
647 EL3WINDOW(0); 646 EL3WINDOW(0);
648 for (i = 0; i < 3; i++) 647 for (i = 0; i < 3; i++)
@@ -657,11 +656,11 @@ static int __init el3_mca_probe(struct device *device)
657 netdev_boot_setup_check(dev); 656 netdev_boot_setup_check(dev);
658 657
659 el3_dev_fill(dev, phys_addr, ioaddr, irq, if_port, EL3_MCA); 658 el3_dev_fill(dev, phys_addr, ioaddr, irq, if_port, EL3_MCA);
660 device->driver_data = dev; 659 dev_set_drvdata(device, dev);
661 err = el3_common_init(dev); 660 err = el3_common_init(dev);
662 661
663 if (err) { 662 if (err) {
664 device->driver_data = NULL; 663 dev_set_drvdata(device, NULL);
665 free_netdev(dev); 664 free_netdev(dev);
666 return -ENOMEM; 665 return -ENOMEM;
667 } 666 }
@@ -725,12 +724,12 @@ static int __init el3_eisa_probe (struct device *device)
725 724
726/* This remove works for all device types. 725/* This remove works for all device types.
727 * 726 *
728 * The net dev must be stored in the driver_data field */ 727 * The net dev must be stored in the driver data field */
729static int __devexit el3_device_remove (struct device *device) 728static int __devexit el3_device_remove (struct device *device)
730{ 729{
731 struct net_device *dev; 730 struct net_device *dev;
732 731
733 dev = device->driver_data; 732 dev = dev_get_drvdata(device);
734 733
735 el3_common_remove (dev); 734 el3_common_remove (dev);
736 return 0; 735 return 0;
@@ -765,7 +764,7 @@ static ushort id_read_eeprom(int index)
765 word = (word << 1) + (inb(id_port) & 0x01); 764 word = (word << 1) + (inb(id_port) & 0x01);
766 765
767 if (el3_debug > 3) 766 if (el3_debug > 3)
768 printk(KERN_DEBUG " 3c509 EEPROM word %d %#4.4x.\n", index, word); 767 pr_debug(" 3c509 EEPROM word %d %#4.4x.\n", index, word);
769 768
770 return word; 769 return word;
771} 770}
@@ -787,13 +786,13 @@ el3_open(struct net_device *dev)
787 786
788 EL3WINDOW(0); 787 EL3WINDOW(0);
789 if (el3_debug > 3) 788 if (el3_debug > 3)
790 printk(KERN_DEBUG "%s: Opening, IRQ %d status@%x %4.4x.\n", dev->name, 789 pr_debug("%s: Opening, IRQ %d status@%x %4.4x.\n", dev->name,
791 dev->irq, ioaddr + EL3_STATUS, inw(ioaddr + EL3_STATUS)); 790 dev->irq, ioaddr + EL3_STATUS, inw(ioaddr + EL3_STATUS));
792 791
793 el3_up(dev); 792 el3_up(dev);
794 793
795 if (el3_debug > 3) 794 if (el3_debug > 3)
796 printk(KERN_DEBUG "%s: Opened 3c509 IRQ %d status %4.4x.\n", 795 pr_debug("%s: Opened 3c509 IRQ %d status %4.4x.\n",
797 dev->name, dev->irq, inw(ioaddr + EL3_STATUS)); 796 dev->name, dev->irq, inw(ioaddr + EL3_STATUS));
798 797
799 return 0; 798 return 0;
@@ -805,8 +804,7 @@ el3_tx_timeout (struct net_device *dev)
805 int ioaddr = dev->base_addr; 804 int ioaddr = dev->base_addr;
806 805
807 /* Transmitter timeout, serious problems. */ 806 /* Transmitter timeout, serious problems. */
808 printk(KERN_WARNING "%s: transmit timed out, Tx_status %2.2x status %4.4x " 807 pr_warning("%s: transmit timed out, Tx_status %2.2x status %4.4x Tx FIFO room %d.\n",
809 "Tx FIFO room %d.\n",
810 dev->name, inb(ioaddr + TX_STATUS), inw(ioaddr + EL3_STATUS), 808 dev->name, inb(ioaddr + TX_STATUS), inw(ioaddr + EL3_STATUS),
811 inw(ioaddr + TX_FREE)); 809 inw(ioaddr + TX_FREE));
812 dev->stats.tx_errors++; 810 dev->stats.tx_errors++;
@@ -830,7 +828,7 @@ el3_start_xmit(struct sk_buff *skb, struct net_device *dev)
830 dev->stats.tx_bytes += skb->len; 828 dev->stats.tx_bytes += skb->len;
831 829
832 if (el3_debug > 4) { 830 if (el3_debug > 4) {
833 printk(KERN_DEBUG "%s: el3_start_xmit(length = %u) called, status %4.4x.\n", 831 pr_debug("%s: el3_start_xmit(length = %u) called, status %4.4x.\n",
834 dev->name, skb->len, inw(ioaddr + EL3_STATUS)); 832 dev->name, skb->len, inw(ioaddr + EL3_STATUS));
835 } 833 }
836#if 0 834#if 0
@@ -839,7 +837,7 @@ el3_start_xmit(struct sk_buff *skb, struct net_device *dev)
839 ushort status = inw(ioaddr + EL3_STATUS); 837 ushort status = inw(ioaddr + EL3_STATUS);
840 if (status & 0x0001 /* IRQ line active, missed one. */ 838 if (status & 0x0001 /* IRQ line active, missed one. */
841 && inw(ioaddr + EL3_STATUS) & 1) { /* Make sure. */ 839 && inw(ioaddr + EL3_STATUS) & 1) { /* Make sure. */
842 printk(KERN_DEBUG "%s: Missed interrupt, status then %04x now %04x" 840 pr_debug("%s: Missed interrupt, status then %04x now %04x"
843 " Tx %2.2x Rx %4.4x.\n", dev->name, status, 841 " Tx %2.2x Rx %4.4x.\n", dev->name, status,
844 inw(ioaddr + EL3_STATUS), inb(ioaddr + TX_STATUS), 842 inw(ioaddr + EL3_STATUS), inb(ioaddr + TX_STATUS),
845 inw(ioaddr + RX_STATUS)); 843 inw(ioaddr + RX_STATUS));
@@ -913,7 +911,7 @@ el3_interrupt(int irq, void *dev_id)
913 911
914 if (el3_debug > 4) { 912 if (el3_debug > 4) {
915 status = inw(ioaddr + EL3_STATUS); 913 status = inw(ioaddr + EL3_STATUS);
916 printk(KERN_DEBUG "%s: interrupt, status %4.4x.\n", dev->name, status); 914 pr_debug("%s: interrupt, status %4.4x.\n", dev->name, status);
917 } 915 }
918 916
919 while ((status = inw(ioaddr + EL3_STATUS)) & 917 while ((status = inw(ioaddr + EL3_STATUS)) &
@@ -924,7 +922,7 @@ el3_interrupt(int irq, void *dev_id)
924 922
925 if (status & TxAvailable) { 923 if (status & TxAvailable) {
926 if (el3_debug > 5) 924 if (el3_debug > 5)
927 printk(KERN_DEBUG " TX room bit was handled.\n"); 925 pr_debug(" TX room bit was handled.\n");
928 /* There's room in the FIFO for a full-sized packet. */ 926 /* There's room in the FIFO for a full-sized packet. */
929 outw(AckIntr | TxAvailable, ioaddr + EL3_CMD); 927 outw(AckIntr | TxAvailable, ioaddr + EL3_CMD);
930 netif_wake_queue (dev); 928 netif_wake_queue (dev);
@@ -962,7 +960,7 @@ el3_interrupt(int irq, void *dev_id)
962 } 960 }
963 961
964 if (--i < 0) { 962 if (--i < 0) {
965 printk(KERN_ERR "%s: Infinite loop in interrupt, status %4.4x.\n", 963 pr_err("%s: Infinite loop in interrupt, status %4.4x.\n",
966 dev->name, status); 964 dev->name, status);
967 /* Clear all interrupts. */ 965 /* Clear all interrupts. */
968 outw(AckIntr | 0xFF, ioaddr + EL3_CMD); 966 outw(AckIntr | 0xFF, ioaddr + EL3_CMD);
@@ -973,7 +971,7 @@ el3_interrupt(int irq, void *dev_id)
973 } 971 }
974 972
975 if (el3_debug > 4) { 973 if (el3_debug > 4) {
976 printk(KERN_DEBUG "%s: exiting interrupt, status %4.4x.\n", dev->name, 974 pr_debug("%s: exiting interrupt, status %4.4x.\n", dev->name,
977 inw(ioaddr + EL3_STATUS)); 975 inw(ioaddr + EL3_STATUS));
978 } 976 }
979 spin_unlock(&lp->lock); 977 spin_unlock(&lp->lock);
@@ -1021,7 +1019,7 @@ static void update_stats(struct net_device *dev)
1021 int ioaddr = dev->base_addr; 1019 int ioaddr = dev->base_addr;
1022 1020
1023 if (el3_debug > 5) 1021 if (el3_debug > 5)
1024 printk(" Updating the statistics.\n"); 1022 pr_debug(" Updating the statistics.\n");
1025 /* Turn off statistics updates while reading. */ 1023 /* Turn off statistics updates while reading. */
1026 outw(StatsDisable, ioaddr + EL3_CMD); 1024 outw(StatsDisable, ioaddr + EL3_CMD);
1027 /* Switch to the stats window, and read everything. */ 1025 /* Switch to the stats window, and read everything. */
@@ -1051,7 +1049,7 @@ el3_rx(struct net_device *dev)
1051 short rx_status; 1049 short rx_status;
1052 1050
1053 if (el3_debug > 5) 1051 if (el3_debug > 5)
1054 printk(" In rx_packet(), status %4.4x, rx_status %4.4x.\n", 1052 pr_debug(" In rx_packet(), status %4.4x, rx_status %4.4x.\n",
1055 inw(ioaddr+EL3_STATUS), inw(ioaddr+RX_STATUS)); 1053 inw(ioaddr+EL3_STATUS), inw(ioaddr+RX_STATUS));
1056 while ((rx_status = inw(ioaddr + RX_STATUS)) > 0) { 1054 while ((rx_status = inw(ioaddr + RX_STATUS)) > 0) {
1057 if (rx_status & 0x4000) { /* Error, update stats. */ 1055 if (rx_status & 0x4000) { /* Error, update stats. */
@@ -1073,7 +1071,7 @@ el3_rx(struct net_device *dev)
1073 1071
1074 skb = dev_alloc_skb(pkt_len+5); 1072 skb = dev_alloc_skb(pkt_len+5);
1075 if (el3_debug > 4) 1073 if (el3_debug > 4)
1076 printk("Receiving packet size %d status %4.4x.\n", 1074 pr_debug("Receiving packet size %d status %4.4x.\n",
1077 pkt_len, rx_status); 1075 pkt_len, rx_status);
1078 if (skb != NULL) { 1076 if (skb != NULL) {
1079 skb_reserve(skb, 2); /* Align IP on 16 byte */ 1077 skb_reserve(skb, 2); /* Align IP on 16 byte */
@@ -1092,12 +1090,12 @@ el3_rx(struct net_device *dev)
1092 outw(RxDiscard, ioaddr + EL3_CMD); 1090 outw(RxDiscard, ioaddr + EL3_CMD);
1093 dev->stats.rx_dropped++; 1091 dev->stats.rx_dropped++;
1094 if (el3_debug) 1092 if (el3_debug)
1095 printk("%s: Couldn't allocate a sk_buff of size %d.\n", 1093 pr_debug("%s: Couldn't allocate a sk_buff of size %d.\n",
1096 dev->name, pkt_len); 1094 dev->name, pkt_len);
1097 } 1095 }
1098 inw(ioaddr + EL3_STATUS); /* Delay. */ 1096 inw(ioaddr + EL3_STATUS); /* Delay. */
1099 while (inw(ioaddr + EL3_STATUS) & 0x1000) 1097 while (inw(ioaddr + EL3_STATUS) & 0x1000)
1100 printk(KERN_DEBUG " Waiting for 3c509 to discard packet, status %x.\n", 1098 pr_debug(" Waiting for 3c509 to discard packet, status %x.\n",
1101 inw(ioaddr + EL3_STATUS) ); 1099 inw(ioaddr + EL3_STATUS) );
1102 } 1100 }
1103 1101
@@ -1118,7 +1116,7 @@ set_multicast_list(struct net_device *dev)
1118 static int old; 1116 static int old;
1119 if (old != dev->mc_count) { 1117 if (old != dev->mc_count) {
1120 old = dev->mc_count; 1118 old = dev->mc_count;
1121 printk("%s: Setting Rx mode to %d addresses.\n", dev->name, dev->mc_count); 1119 pr_debug("%s: Setting Rx mode to %d addresses.\n", dev->name, dev->mc_count);
1122 } 1120 }
1123 } 1121 }
1124 spin_lock_irqsave(&lp->lock, flags); 1122 spin_lock_irqsave(&lp->lock, flags);
@@ -1141,7 +1139,7 @@ el3_close(struct net_device *dev)
1141 struct el3_private *lp = netdev_priv(dev); 1139 struct el3_private *lp = netdev_priv(dev);
1142 1140
1143 if (el3_debug > 2) 1141 if (el3_debug > 2)
1144 printk("%s: Shutting down ethercard.\n", dev->name); 1142 pr_debug("%s: Shutting down ethercard.\n", dev->name);
1145 1143
1146 el3_down(dev); 1144 el3_down(dev);
1147 1145
@@ -1388,30 +1386,30 @@ el3_up(struct net_device *dev)
1388 EL3WINDOW(4); 1386 EL3WINDOW(4);
1389 net_diag = inw(ioaddr + WN4_NETDIAG); 1387 net_diag = inw(ioaddr + WN4_NETDIAG);
1390 net_diag = (net_diag | FD_ENABLE); /* temporarily assume full-duplex will be set */ 1388 net_diag = (net_diag | FD_ENABLE); /* temporarily assume full-duplex will be set */
1391 printk("%s: ", dev->name); 1389 pr_info("%s: ", dev->name);
1392 switch (dev->if_port & 0x0c) { 1390 switch (dev->if_port & 0x0c) {
1393 case 12: 1391 case 12:
1394 /* force full-duplex mode if 3c5x9b */ 1392 /* force full-duplex mode if 3c5x9b */
1395 if (sw_info & 0x000f) { 1393 if (sw_info & 0x000f) {
1396 printk("Forcing 3c5x9b full-duplex mode"); 1394 pr_cont("Forcing 3c5x9b full-duplex mode");
1397 break; 1395 break;
1398 } 1396 }
1399 case 8: 1397 case 8:
1400 /* set full-duplex mode based on eeprom config setting */ 1398 /* set full-duplex mode based on eeprom config setting */
1401 if ((sw_info & 0x000f) && (sw_info & 0x8000)) { 1399 if ((sw_info & 0x000f) && (sw_info & 0x8000)) {
1402 printk("Setting 3c5x9b full-duplex mode (from EEPROM configuration bit)"); 1400 pr_cont("Setting 3c5x9b full-duplex mode (from EEPROM configuration bit)");
1403 break; 1401 break;
1404 } 1402 }
1405 default: 1403 default:
1406 /* xcvr=(0 || 4) OR user has an old 3c5x9 non "B" model */ 1404 /* xcvr=(0 || 4) OR user has an old 3c5x9 non "B" model */
1407 printk("Setting 3c5x9/3c5x9B half-duplex mode"); 1405 pr_cont("Setting 3c5x9/3c5x9B half-duplex mode");
1408 net_diag = (net_diag & ~FD_ENABLE); /* disable full duplex */ 1406 net_diag = (net_diag & ~FD_ENABLE); /* disable full duplex */
1409 } 1407 }
1410 1408
1411 outw(net_diag, ioaddr + WN4_NETDIAG); 1409 outw(net_diag, ioaddr + WN4_NETDIAG);
1412 printk(" if_port: %d, sw_info: %4.4x\n", dev->if_port, sw_info); 1410 pr_cont(" if_port: %d, sw_info: %4.4x\n", dev->if_port, sw_info);
1413 if (el3_debug > 3) 1411 if (el3_debug > 3)
1414 printk("%s: 3c5x9 net diag word is now: %4.4x.\n", dev->name, net_diag); 1412 pr_debug("%s: 3c5x9 net diag word is now: %4.4x.\n", dev->name, net_diag);
1415 /* Enable link beat and jabber check. */ 1413 /* Enable link beat and jabber check. */
1416 outw(inw(ioaddr + WN4_MEDIA) | MEDIA_TP, ioaddr + WN4_MEDIA); 1414 outw(inw(ioaddr + WN4_MEDIA) | MEDIA_TP, ioaddr + WN4_MEDIA);
1417 } 1415 }
@@ -1455,7 +1453,7 @@ el3_suspend(struct device *pdev, pm_message_t state)
1455 struct el3_private *lp; 1453 struct el3_private *lp;
1456 int ioaddr; 1454 int ioaddr;
1457 1455
1458 dev = pdev->driver_data; 1456 dev = dev_get_drvdata(pdev);
1459 lp = netdev_priv(dev); 1457 lp = netdev_priv(dev);
1460 ioaddr = dev->base_addr; 1458 ioaddr = dev->base_addr;
1461 1459
@@ -1479,7 +1477,7 @@ el3_resume(struct device *pdev)
1479 struct el3_private *lp; 1477 struct el3_private *lp;
1480 int ioaddr; 1478 int ioaddr;
1481 1479
1482 dev = pdev->driver_data; 1480 dev = dev_get_drvdata(pdev);
1483 lp = netdev_priv(dev); 1481 lp = netdev_priv(dev);
1484 ioaddr = dev->base_addr; 1482 ioaddr = dev->base_addr;
1485 1483
@@ -1539,7 +1537,7 @@ static int __init el3_init_module(void)
1539 } 1537 }
1540 if (id_port >= 0x200) { 1538 if (id_port >= 0x200) {
1541 id_port = 0; 1539 id_port = 0;
1542 printk(KERN_ERR "No I/O port available for 3c509 activation.\n"); 1540 pr_err("No I/O port available for 3c509 activation.\n");
1543 } else { 1541 } else {
1544 ret = isa_register_driver(&el3_isa_driver, EL3_MAX_CARDS); 1542 ret = isa_register_driver(&el3_isa_driver, EL3_MAX_CARDS);
1545 if (!ret) 1543 if (!ret)