aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tulip
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/tulip')
-rw-r--r--drivers/net/tulip/21142.c14
-rw-r--r--drivers/net/tulip/Makefile2
-rw-r--r--drivers/net/tulip/de2104x.c183
-rw-r--r--drivers/net/tulip/de4x5.c4
-rw-r--r--drivers/net/tulip/dmfe.c9
-rw-r--r--drivers/net/tulip/eeprom.c4
-rw-r--r--drivers/net/tulip/interrupt.c48
-rw-r--r--drivers/net/tulip/media.c49
-rw-r--r--drivers/net/tulip/pnic.c22
-rw-r--r--drivers/net/tulip/pnic2.c16
-rw-r--r--drivers/net/tulip/timer.c47
-rw-r--r--drivers/net/tulip/tulip.h8
-rw-r--r--drivers/net/tulip/tulip_core.c50
-rw-r--r--drivers/net/tulip/uli526x.c71
-rw-r--r--drivers/net/tulip/winbond-840.c81
-rw-r--r--drivers/net/tulip/xircom_cb.c268
16 files changed, 362 insertions, 514 deletions
diff --git a/drivers/net/tulip/21142.c b/drivers/net/tulip/21142.c
index 007d8e75666d..092c3faa882a 100644
--- a/drivers/net/tulip/21142.c
+++ b/drivers/net/tulip/21142.c
@@ -122,8 +122,8 @@ void t21142_start_nway(struct net_device *dev)
122 tp->nway = tp->mediasense = 1; 122 tp->nway = tp->mediasense = 1;
123 tp->nwayset = tp->lpar = 0; 123 tp->nwayset = tp->lpar = 0;
124 if (tulip_debug > 1) 124 if (tulip_debug > 1)
125 printk(KERN_DEBUG "%s: Restarting 21143 autonegotiation, csr14=%08x\n", 125 netdev_dbg(dev, "Restarting 21143 autonegotiation, csr14=%08x\n",
126 dev->name, csr14); 126 csr14);
127 iowrite32(0x0001, ioaddr + CSR13); 127 iowrite32(0x0001, ioaddr + CSR13);
128 udelay(100); 128 udelay(100);
129 iowrite32(csr14, ioaddr + CSR14); 129 iowrite32(csr14, ioaddr + CSR14);
@@ -206,14 +206,14 @@ void t21142_lnk_change(struct net_device *dev, int csr5)
206#if 0 /* Restart shouldn't be needed. */ 206#if 0 /* Restart shouldn't be needed. */
207 iowrite32(tp->csr6 | RxOn, ioaddr + CSR6); 207 iowrite32(tp->csr6 | RxOn, ioaddr + CSR6);
208 if (tulip_debug > 2) 208 if (tulip_debug > 2)
209 printk(KERN_DEBUG "%s: Restarting Tx and Rx, CSR5 is %08x\n", 209 netdev_dbg(dev, " Restarting Tx and Rx, CSR5 is %08x\n",
210 dev->name, ioread32(ioaddr + CSR5)); 210 ioread32(ioaddr + CSR5));
211#endif 211#endif
212 tulip_start_rxtx(tp); 212 tulip_start_rxtx(tp);
213 if (tulip_debug > 2) 213 if (tulip_debug > 2)
214 printk(KERN_DEBUG "%s: Setting CSR6 %08x/%x CSR12 %08x\n", 214 netdev_dbg(dev, " Setting CSR6 %08x/%x CSR12 %08x\n",
215 dev->name, tp->csr6, ioread32(ioaddr + CSR6), 215 tp->csr6, ioread32(ioaddr + CSR6),
216 ioread32(ioaddr + CSR12)); 216 ioread32(ioaddr + CSR12));
217 } else if ((tp->nwayset && (csr5 & 0x08000000) && 217 } else if ((tp->nwayset && (csr5 & 0x08000000) &&
218 (dev->if_port == 3 || dev->if_port == 5) && 218 (dev->if_port == 3 || dev->if_port == 5) &&
219 (csr12 & 2) == 2) || 219 (csr12 & 2) == 2) ||
diff --git a/drivers/net/tulip/Makefile b/drivers/net/tulip/Makefile
index 200cbf7c815c..5e8be38b45bb 100644
--- a/drivers/net/tulip/Makefile
+++ b/drivers/net/tulip/Makefile
@@ -2,6 +2,8 @@
2# Makefile for the Linux "Tulip" family network device drivers. 2# Makefile for the Linux "Tulip" family network device drivers.
3# 3#
4 4
5ccflags-$(CONFIG_NET_TULIP) := -DDEBUG
6
5obj-$(CONFIG_PCMCIA_XIRCOM) += xircom_cb.o 7obj-$(CONFIG_PCMCIA_XIRCOM) += xircom_cb.o
6obj-$(CONFIG_DM9102) += dmfe.o 8obj-$(CONFIG_DM9102) += dmfe.o
7obj-$(CONFIG_WINBOND_840) += winbond-840.o 9obj-$(CONFIG_WINBOND_840) += winbond-840.o
diff --git a/drivers/net/tulip/de2104x.c b/drivers/net/tulip/de2104x.c
index b13c6b040be3..e2f692351180 100644
--- a/drivers/net/tulip/de2104x.c
+++ b/drivers/net/tulip/de2104x.c
@@ -27,6 +27,8 @@
27 27
28 */ 28 */
29 29
30#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
31
30#define DRV_NAME "de2104x" 32#define DRV_NAME "de2104x"
31#define DRV_VERSION "0.7" 33#define DRV_VERSION "0.7"
32#define DRV_RELDATE "Mar 17, 2004" 34#define DRV_RELDATE "Mar 17, 2004"
@@ -51,7 +53,7 @@
51 53
52/* These identify the driver base version and may not be removed. */ 54/* These identify the driver base version and may not be removed. */
53static char version[] = 55static char version[] =
54KERN_INFO DRV_NAME " PCI Ethernet driver v" DRV_VERSION " (" DRV_RELDATE ")\n"; 56"PCI Ethernet driver v" DRV_VERSION " (" DRV_RELDATE ")";
55 57
56MODULE_AUTHOR("Jeff Garzik <jgarzik@pobox.com>"); 58MODULE_AUTHOR("Jeff Garzik <jgarzik@pobox.com>");
57MODULE_DESCRIPTION("Intel/Digital 21040/1 series PCI Ethernet driver"); 59MODULE_DESCRIPTION("Intel/Digital 21040/1 series PCI Ethernet driver");
@@ -73,8 +75,6 @@ static int rx_copybreak = 100;
73module_param (rx_copybreak, int, 0); 75module_param (rx_copybreak, int, 0);
74MODULE_PARM_DESC (rx_copybreak, "de2104x Breakpoint at which Rx packets are copied"); 76MODULE_PARM_DESC (rx_copybreak, "de2104x Breakpoint at which Rx packets are copied");
75 77
76#define PFX DRV_NAME ": "
77
78#define DE_DEF_MSG_ENABLE (NETIF_MSG_DRV | \ 78#define DE_DEF_MSG_ENABLE (NETIF_MSG_DRV | \
79 NETIF_MSG_PROBE | \ 79 NETIF_MSG_PROBE | \
80 NETIF_MSG_LINK | \ 80 NETIF_MSG_LINK | \
@@ -377,18 +377,16 @@ static u16 t21041_csr15[] = { 0x0008, 0x0006, 0x000E, 0x0008, 0x0008, };
377static void de_rx_err_acct (struct de_private *de, unsigned rx_tail, 377static void de_rx_err_acct (struct de_private *de, unsigned rx_tail,
378 u32 status, u32 len) 378 u32 status, u32 len)
379{ 379{
380 if (netif_msg_rx_err (de)) 380 netif_dbg(de, rx_err, de->dev,
381 printk (KERN_DEBUG 381 "rx err, slot %d status 0x%x len %d\n",
382 "%s: rx err, slot %d status 0x%x len %d\n", 382 rx_tail, status, len);
383 de->dev->name, rx_tail, status, len);
384 383
385 if ((status & 0x38000300) != 0x0300) { 384 if ((status & 0x38000300) != 0x0300) {
386 /* Ingore earlier buffers. */ 385 /* Ingore earlier buffers. */
387 if ((status & 0xffff) != 0x7fff) { 386 if ((status & 0xffff) != 0x7fff) {
388 if (netif_msg_rx_err(de)) 387 netif_warn(de, rx_err, de->dev,
389 dev_warn(&de->dev->dev, 388 "Oversized Ethernet frame spanned multiple buffers, status %08x!\n",
390 "Oversized Ethernet frame spanned multiple buffers, status %08x!\n", 389 status);
391 status);
392 de->net_stats.rx_length_errors++; 390 de->net_stats.rx_length_errors++;
393 } 391 }
394 } else if (status & RxError) { 392 } else if (status & RxError) {
@@ -435,10 +433,9 @@ static void de_rx (struct de_private *de)
435 433
436 copying_skb = (len <= rx_copybreak); 434 copying_skb = (len <= rx_copybreak);
437 435
438 if (unlikely(netif_msg_rx_status(de))) 436 netif_dbg(de, rx_status, de->dev,
439 printk(KERN_DEBUG "%s: rx slot %d status 0x%x len %d copying? %d\n", 437 "rx slot %d status 0x%x len %d copying? %d\n",
440 de->dev->name, rx_tail, status, len, 438 rx_tail, status, len, copying_skb);
441 copying_skb);
442 439
443 buflen = copying_skb ? (len + RX_OFFSET) : de->rx_buf_sz; 440 buflen = copying_skb ? (len + RX_OFFSET) : de->rx_buf_sz;
444 copy_skb = dev_alloc_skb (buflen); 441 copy_skb = dev_alloc_skb (buflen);
@@ -491,7 +488,7 @@ rx_next:
491 } 488 }
492 489
493 if (!rx_work) 490 if (!rx_work)
494 dev_warn(&de->dev->dev, "rx work limit reached\n"); 491 netdev_warn(de->dev, "rx work limit reached\n");
495 492
496 de->rx_tail = rx_tail; 493 de->rx_tail = rx_tail;
497} 494}
@@ -506,10 +503,9 @@ static irqreturn_t de_interrupt (int irq, void *dev_instance)
506 if ((!(status & (IntrOK|IntrErr))) || (status == 0xFFFF)) 503 if ((!(status & (IntrOK|IntrErr))) || (status == 0xFFFF))
507 return IRQ_NONE; 504 return IRQ_NONE;
508 505
509 if (netif_msg_intr(de)) 506 netif_dbg(de, intr, dev, "intr, status %08x mode %08x desc %u/%u/%u\n",
510 printk(KERN_DEBUG "%s: intr, status %08x mode %08x desc %u/%u/%u\n", 507 status, dr32(MacMode),
511 dev->name, status, dr32(MacMode), 508 de->rx_tail, de->tx_head, de->tx_tail);
512 de->rx_tail, de->tx_head, de->tx_tail);
513 509
514 dw32(MacStatus, status); 510 dw32(MacStatus, status);
515 511
@@ -534,9 +530,9 @@ static irqreturn_t de_interrupt (int irq, void *dev_instance)
534 530
535 pci_read_config_word(de->pdev, PCI_STATUS, &pci_status); 531 pci_read_config_word(de->pdev, PCI_STATUS, &pci_status);
536 pci_write_config_word(de->pdev, PCI_STATUS, pci_status); 532 pci_write_config_word(de->pdev, PCI_STATUS, pci_status);
537 dev_err(&de->dev->dev, 533 netdev_err(de->dev,
538 "PCI bus error, status=%08x, PCI status=%04x\n", 534 "PCI bus error, status=%08x, PCI status=%04x\n",
539 status, pci_status); 535 status, pci_status);
540 } 536 }
541 537
542 return IRQ_HANDLED; 538 return IRQ_HANDLED;
@@ -572,9 +568,9 @@ static void de_tx (struct de_private *de)
572 568
573 if (status & LastFrag) { 569 if (status & LastFrag) {
574 if (status & TxError) { 570 if (status & TxError) {
575 if (netif_msg_tx_err(de)) 571 netif_dbg(de, tx_err, de->dev,
576 printk(KERN_DEBUG "%s: tx err, status 0x%x\n", 572 "tx err, status 0x%x\n",
577 de->dev->name, status); 573 status);
578 de->net_stats.tx_errors++; 574 de->net_stats.tx_errors++;
579 if (status & TxOWC) 575 if (status & TxOWC)
580 de->net_stats.tx_window_errors++; 576 de->net_stats.tx_window_errors++;
@@ -587,9 +583,8 @@ static void de_tx (struct de_private *de)
587 } else { 583 } else {
588 de->net_stats.tx_packets++; 584 de->net_stats.tx_packets++;
589 de->net_stats.tx_bytes += skb->len; 585 de->net_stats.tx_bytes += skb->len;
590 if (netif_msg_tx_done(de)) 586 netif_dbg(de, tx_done, de->dev,
591 printk(KERN_DEBUG "%s: tx done, slot %d\n", 587 "tx done, slot %d\n", tx_tail);
592 de->dev->name, tx_tail);
593 } 588 }
594 dev_kfree_skb_irq(skb); 589 dev_kfree_skb_irq(skb);
595 } 590 }
@@ -646,9 +641,8 @@ static netdev_tx_t de_start_xmit (struct sk_buff *skb,
646 wmb(); 641 wmb();
647 642
648 de->tx_head = NEXT_TX(entry); 643 de->tx_head = NEXT_TX(entry);
649 if (netif_msg_tx_queued(de)) 644 netif_dbg(de, tx_queued, dev, "tx queued, slot %d, skblen %d\n",
650 printk(KERN_DEBUG "%s: tx queued, slot %d, skblen %d\n", 645 entry, skb->len);
651 dev->name, entry, skb->len);
652 646
653 if (tx_free == 0) 647 if (tx_free == 0)
654 netif_stop_queue(dev); 648 netif_stop_queue(dev);
@@ -873,7 +867,7 @@ static void de_stop_rxtx (struct de_private *de)
873 udelay(100); 867 udelay(100);
874 } 868 }
875 869
876 dev_warn(&de->dev->dev, "timeout expired stopping DMA\n"); 870 netdev_warn(de->dev, "timeout expired, stopping DMA\n");
877} 871}
878 872
879static inline void de_start_rxtx (struct de_private *de) 873static inline void de_start_rxtx (struct de_private *de)
@@ -907,9 +901,8 @@ static void de_link_up(struct de_private *de)
907{ 901{
908 if (!netif_carrier_ok(de->dev)) { 902 if (!netif_carrier_ok(de->dev)) {
909 netif_carrier_on(de->dev); 903 netif_carrier_on(de->dev);
910 if (netif_msg_link(de)) 904 netif_info(de, link, de->dev, "link up, media %s\n",
911 dev_info(&de->dev->dev, "link up, media %s\n", 905 media_name[de->media_type]);
912 media_name[de->media_type]);
913 } 906 }
914} 907}
915 908
@@ -917,8 +910,7 @@ static void de_link_down(struct de_private *de)
917{ 910{
918 if (netif_carrier_ok(de->dev)) { 911 if (netif_carrier_ok(de->dev)) {
919 netif_carrier_off(de->dev); 912 netif_carrier_off(de->dev);
920 if (netif_msg_link(de)) 913 netif_info(de, link, de->dev, "link down\n");
921 dev_info(&de->dev->dev, "link down\n");
922 } 914 }
923} 915}
924 916
@@ -928,8 +920,7 @@ static void de_set_media (struct de_private *de)
928 u32 macmode = dr32(MacMode); 920 u32 macmode = dr32(MacMode);
929 921
930 if (de_is_running(de)) 922 if (de_is_running(de))
931 dev_warn(&de->dev->dev, 923 netdev_warn(de->dev, "chip is running while changing media!\n");
932 "chip is running while changing media!\n");
933 924
934 if (de->de21040) 925 if (de->de21040)
935 dw32(CSR11, FULL_DUPLEX_MAGIC); 926 dw32(CSR11, FULL_DUPLEX_MAGIC);
@@ -948,18 +939,13 @@ static void de_set_media (struct de_private *de)
948 else 939 else
949 macmode &= ~FullDuplex; 940 macmode &= ~FullDuplex;
950 941
951 if (netif_msg_link(de)) 942 netif_info(de, link, de->dev, "set link %s\n", media_name[media]);
952 dev_info(&de->dev->dev, "set link %s\n", media_name[media]); 943 netif_info(de, hw, de->dev, "mode 0x%x, sia 0x%x,0x%x,0x%x,0x%x\n",
953 if (netif_msg_hw(de)) { 944 dr32(MacMode), dr32(SIAStatus),
954 dev_info(&de->dev->dev, "mode 0x%x, sia 0x%x,0x%x,0x%x,0x%x\n", 945 dr32(CSR13), dr32(CSR14), dr32(CSR15));
955 dr32(MacMode), dr32(SIAStatus), 946 netif_info(de, hw, de->dev, "set mode 0x%x, set sia 0x%x,0x%x,0x%x\n",
956 dr32(CSR13), dr32(CSR14), dr32(CSR15)); 947 macmode, de->media[media].csr13,
957 948 de->media[media].csr14, de->media[media].csr15);
958 dev_info(&de->dev->dev,
959 "set mode 0x%x, set sia 0x%x,0x%x,0x%x\n",
960 macmode, de->media[media].csr13,
961 de->media[media].csr14, de->media[media].csr15);
962 }
963 if (macmode != dr32(MacMode)) 949 if (macmode != dr32(MacMode))
964 dw32(MacMode, macmode); 950 dw32(MacMode, macmode);
965} 951}
@@ -996,9 +982,8 @@ static void de21040_media_timer (unsigned long data)
996 if (!netif_carrier_ok(dev)) 982 if (!netif_carrier_ok(dev))
997 de_link_up(de); 983 de_link_up(de);
998 else 984 else
999 if (netif_msg_timer(de)) 985 netif_info(de, timer, dev, "%s link ok, status %x\n",
1000 dev_info(&dev->dev, "%s link ok, status %x\n", 986 media_name[de->media_type], status);
1001 media_name[de->media_type], status);
1002 return; 987 return;
1003 } 988 }
1004 989
@@ -1025,9 +1010,8 @@ no_link_yet:
1025 de->media_timer.expires = jiffies + DE_TIMER_NO_LINK; 1010 de->media_timer.expires = jiffies + DE_TIMER_NO_LINK;
1026 add_timer(&de->media_timer); 1011 add_timer(&de->media_timer);
1027 1012
1028 if (netif_msg_timer(de)) 1013 netif_info(de, timer, dev, "no link, trying media %s, status %x\n",
1029 dev_info(&dev->dev, "no link, trying media %s, status %x\n", 1014 media_name[de->media_type], status);
1030 media_name[de->media_type], status);
1031} 1015}
1032 1016
1033static unsigned int de_ok_to_advertise (struct de_private *de, u32 new_media) 1017static unsigned int de_ok_to_advertise (struct de_private *de, u32 new_media)
@@ -1085,11 +1069,10 @@ static void de21041_media_timer (unsigned long data)
1085 if (!netif_carrier_ok(dev)) 1069 if (!netif_carrier_ok(dev))
1086 de_link_up(de); 1070 de_link_up(de);
1087 else 1071 else
1088 if (netif_msg_timer(de)) 1072 netif_info(de, timer, dev,
1089 dev_info(&dev->dev, 1073 "%s link ok, mode %x status %x\n",
1090 "%s link ok, mode %x status %x\n", 1074 media_name[de->media_type],
1091 media_name[de->media_type], 1075 dr32(MacMode), status);
1092 dr32(MacMode), status);
1093 return; 1076 return;
1094 } 1077 }
1095 1078
@@ -1163,9 +1146,8 @@ no_link_yet:
1163 de->media_timer.expires = jiffies + DE_TIMER_NO_LINK; 1146 de->media_timer.expires = jiffies + DE_TIMER_NO_LINK;
1164 add_timer(&de->media_timer); 1147 add_timer(&de->media_timer);
1165 1148
1166 if (netif_msg_timer(de)) 1149 netif_info(de, timer, dev, "no link, trying media %s, status %x\n",
1167 dev_info(&dev->dev, "no link, trying media %s, status %x\n", 1150 media_name[de->media_type], status);
1168 media_name[de->media_type], status);
1169} 1151}
1170 1152
1171static void de_media_interrupt (struct de_private *de, u32 status) 1153static void de_media_interrupt (struct de_private *de, u32 status)
@@ -1401,14 +1383,13 @@ static int de_open (struct net_device *dev)
1401 struct de_private *de = netdev_priv(dev); 1383 struct de_private *de = netdev_priv(dev);
1402 int rc; 1384 int rc;
1403 1385
1404 if (netif_msg_ifup(de)) 1386 netif_dbg(de, ifup, dev, "enabling interface\n");
1405 printk(KERN_DEBUG "%s: enabling interface\n", dev->name);
1406 1387
1407 de->rx_buf_sz = (dev->mtu <= 1500 ? PKT_BUF_SZ : dev->mtu + 32); 1388 de->rx_buf_sz = (dev->mtu <= 1500 ? PKT_BUF_SZ : dev->mtu + 32);
1408 1389
1409 rc = de_alloc_rings(de); 1390 rc = de_alloc_rings(de);
1410 if (rc) { 1391 if (rc) {
1411 dev_err(&dev->dev, "ring allocation failure, err=%d\n", rc); 1392 netdev_err(dev, "ring allocation failure, err=%d\n", rc);
1412 return rc; 1393 return rc;
1413 } 1394 }
1414 1395
@@ -1416,14 +1397,14 @@ static int de_open (struct net_device *dev)
1416 1397
1417 rc = request_irq(dev->irq, de_interrupt, IRQF_SHARED, dev->name, dev); 1398 rc = request_irq(dev->irq, de_interrupt, IRQF_SHARED, dev->name, dev);
1418 if (rc) { 1399 if (rc) {
1419 dev_err(&dev->dev, "IRQ %d request failure, err=%d\n", 1400 netdev_err(dev, "IRQ %d request failure, err=%d\n",
1420 dev->irq, rc); 1401 dev->irq, rc);
1421 goto err_out_free; 1402 goto err_out_free;
1422 } 1403 }
1423 1404
1424 rc = de_init_hw(de); 1405 rc = de_init_hw(de);
1425 if (rc) { 1406 if (rc) {
1426 dev_err(&dev->dev, "h/w init failure, err=%d\n", rc); 1407 netdev_err(dev, "h/w init failure, err=%d\n", rc);
1427 goto err_out_free_irq; 1408 goto err_out_free_irq;
1428 } 1409 }
1429 1410
@@ -1444,8 +1425,7 @@ static int de_close (struct net_device *dev)
1444 struct de_private *de = netdev_priv(dev); 1425 struct de_private *de = netdev_priv(dev);
1445 unsigned long flags; 1426 unsigned long flags;
1446 1427
1447 if (netif_msg_ifdown(de)) 1428 netif_dbg(de, ifdown, dev, "disabling interface\n");
1448 printk(KERN_DEBUG "%s: disabling interface\n", dev->name);
1449 1429
1450 del_timer_sync(&de->media_timer); 1430 del_timer_sync(&de->media_timer);
1451 1431
@@ -1466,9 +1446,9 @@ static void de_tx_timeout (struct net_device *dev)
1466{ 1446{
1467 struct de_private *de = netdev_priv(dev); 1447 struct de_private *de = netdev_priv(dev);
1468 1448
1469 printk(KERN_DEBUG "%s: NIC status %08x mode %08x sia %08x desc %u/%u/%u\n", 1449 netdev_dbg(dev, "NIC status %08x mode %08x sia %08x desc %u/%u/%u\n",
1470 dev->name, dr32(MacStatus), dr32(MacMode), dr32(SIAStatus), 1450 dr32(MacStatus), dr32(MacMode), dr32(SIAStatus),
1471 de->rx_tail, de->tx_head, de->tx_tail); 1451 de->rx_tail, de->tx_head, de->tx_tail);
1472 1452
1473 del_timer_sync(&de->media_timer); 1453 del_timer_sync(&de->media_timer);
1474 1454
@@ -1518,18 +1498,17 @@ static int __de_get_settings(struct de_private *de, struct ethtool_cmd *ecmd)
1518 switch (de->media_type) { 1498 switch (de->media_type) {
1519 case DE_MEDIA_AUI: 1499 case DE_MEDIA_AUI:
1520 ecmd->port = PORT_AUI; 1500 ecmd->port = PORT_AUI;
1521 ecmd->speed = 5;
1522 break; 1501 break;
1523 case DE_MEDIA_BNC: 1502 case DE_MEDIA_BNC:
1524 ecmd->port = PORT_BNC; 1503 ecmd->port = PORT_BNC;
1525 ecmd->speed = 2;
1526 break; 1504 break;
1527 default: 1505 default:
1528 ecmd->port = PORT_TP; 1506 ecmd->port = PORT_TP;
1529 ecmd->speed = SPEED_10;
1530 break; 1507 break;
1531 } 1508 }
1532 1509
1510 ethtool_cmd_speed_set(ecmd, 10);
1511
1533 if (dr32(MacMode) & FullDuplex) 1512 if (dr32(MacMode) & FullDuplex)
1534 ecmd->duplex = DUPLEX_FULL; 1513 ecmd->duplex = DUPLEX_FULL;
1535 else 1514 else
@@ -1550,9 +1529,7 @@ static int __de_set_settings(struct de_private *de, struct ethtool_cmd *ecmd)
1550 u32 new_media; 1529 u32 new_media;
1551 unsigned int media_lock; 1530 unsigned int media_lock;
1552 1531
1553 if (ecmd->speed != SPEED_10 && ecmd->speed != 5 && ecmd->speed != 2) 1532 if (ethtool_cmd_speed(ecmd) != 10)
1554 return -EINVAL;
1555 if (de->de21040 && ecmd->speed == 2)
1556 return -EINVAL; 1533 return -EINVAL;
1557 if (ecmd->duplex != DUPLEX_HALF && ecmd->duplex != DUPLEX_FULL) 1534 if (ecmd->duplex != DUPLEX_HALF && ecmd->duplex != DUPLEX_FULL)
1558 return -EINVAL; 1535 return -EINVAL;
@@ -1696,9 +1673,8 @@ static int de_nway_reset(struct net_device *dev)
1696 1673
1697 status = dr32(SIAStatus); 1674 status = dr32(SIAStatus);
1698 dw32(SIAStatus, (status & ~NWayState) | NWayRestart); 1675 dw32(SIAStatus, (status & ~NWayState) | NWayRestart);
1699 if (netif_msg_link(de)) 1676 netif_info(de, link, dev, "link nway restart, status %x,%x\n",
1700 dev_info(&de->dev->dev, "link nway restart, status %x,%x\n", 1677 status, dr32(SIAStatus));
1701 status, dr32(SIAStatus));
1702 return 0; 1678 return 0;
1703} 1679}
1704 1680
@@ -1743,7 +1719,8 @@ static void __devinit de21040_get_mac_address (struct de_private *de)
1743 de->dev->dev_addr[i] = value; 1719 de->dev->dev_addr[i] = value;
1744 udelay(1); 1720 udelay(1);
1745 if (boguscnt <= 0) 1721 if (boguscnt <= 0)
1746 pr_warning(PFX "timeout reading 21040 MAC address byte %u\n", i); 1722 pr_warn("timeout reading 21040 MAC address byte %u\n",
1723 i);
1747 } 1724 }
1748} 1725}
1749 1726
@@ -1929,8 +1906,10 @@ static void __devinit de21041_get_srom_info (struct de_private *de)
1929 de->media[idx].csr14, 1906 de->media[idx].csr14,
1930 de->media[idx].csr15); 1907 de->media[idx].csr15);
1931 1908
1932 } else if (netif_msg_probe(de)) 1909 } else {
1933 pr_cont("\n"); 1910 if (netif_msg_probe(de))
1911 pr_cont("\n");
1912 }
1934 1913
1935 if (bufp > ((void *)&ee_data[DE_EEPROM_SIZE - 3])) 1914 if (bufp > ((void *)&ee_data[DE_EEPROM_SIZE - 3]))
1936 break; 1915 break;
@@ -1999,7 +1978,7 @@ static int __devinit de_init_one (struct pci_dev *pdev,
1999 1978
2000#ifndef MODULE 1979#ifndef MODULE
2001 if (board_idx == 0) 1980 if (board_idx == 0)
2002 printk("%s", version); 1981 pr_info("%s\n", version);
2003#endif 1982#endif
2004 1983
2005 /* allocate a new ethernet device structure, and fill in defaults */ 1984 /* allocate a new ethernet device structure, and fill in defaults */
@@ -2041,7 +2020,7 @@ static int __devinit de_init_one (struct pci_dev *pdev,
2041 /* check for invalid IRQ value */ 2020 /* check for invalid IRQ value */
2042 if (pdev->irq < 2) { 2021 if (pdev->irq < 2) {
2043 rc = -EIO; 2022 rc = -EIO;
2044 pr_err(PFX "invalid irq (%d) for pci dev %s\n", 2023 pr_err("invalid irq (%d) for pci dev %s\n",
2045 pdev->irq, pci_name(pdev)); 2024 pdev->irq, pci_name(pdev));
2046 goto err_out_res; 2025 goto err_out_res;
2047 } 2026 }
@@ -2052,12 +2031,12 @@ static int __devinit de_init_one (struct pci_dev *pdev,
2052 pciaddr = pci_resource_start(pdev, 1); 2031 pciaddr = pci_resource_start(pdev, 1);
2053 if (!pciaddr) { 2032 if (!pciaddr) {
2054 rc = -EIO; 2033 rc = -EIO;
2055 pr_err(PFX "no MMIO resource for pci dev %s\n", pci_name(pdev)); 2034 pr_err("no MMIO resource for pci dev %s\n", pci_name(pdev));
2056 goto err_out_res; 2035 goto err_out_res;
2057 } 2036 }
2058 if (pci_resource_len(pdev, 1) < DE_REGS_SIZE) { 2037 if (pci_resource_len(pdev, 1) < DE_REGS_SIZE) {
2059 rc = -EIO; 2038 rc = -EIO;
2060 pr_err(PFX "MMIO resource (%llx) too small on pci dev %s\n", 2039 pr_err("MMIO resource (%llx) too small on pci dev %s\n",
2061 (unsigned long long)pci_resource_len(pdev, 1), 2040 (unsigned long long)pci_resource_len(pdev, 1),
2062 pci_name(pdev)); 2041 pci_name(pdev));
2063 goto err_out_res; 2042 goto err_out_res;
@@ -2067,7 +2046,7 @@ static int __devinit de_init_one (struct pci_dev *pdev,
2067 regs = ioremap_nocache(pciaddr, DE_REGS_SIZE); 2046 regs = ioremap_nocache(pciaddr, DE_REGS_SIZE);
2068 if (!regs) { 2047 if (!regs) {
2069 rc = -EIO; 2048 rc = -EIO;
2070 pr_err(PFX "Cannot map PCI MMIO (%llx@%lx) on pci dev %s\n", 2049 pr_err("Cannot map PCI MMIO (%llx@%lx) on pci dev %s\n",
2071 (unsigned long long)pci_resource_len(pdev, 1), 2050 (unsigned long long)pci_resource_len(pdev, 1),
2072 pciaddr, pci_name(pdev)); 2051 pciaddr, pci_name(pdev));
2073 goto err_out_res; 2052 goto err_out_res;
@@ -2080,7 +2059,7 @@ static int __devinit de_init_one (struct pci_dev *pdev,
2080 /* make sure hardware is not running */ 2059 /* make sure hardware is not running */
2081 rc = de_reset_mac(de); 2060 rc = de_reset_mac(de);
2082 if (rc) { 2061 if (rc) {
2083 pr_err(PFX "Cannot reset MAC, pci dev %s\n", pci_name(pdev)); 2062 pr_err("Cannot reset MAC, pci dev %s\n", pci_name(pdev));
2084 goto err_out_iomap; 2063 goto err_out_iomap;
2085 } 2064 }
2086 2065
@@ -2100,11 +2079,11 @@ static int __devinit de_init_one (struct pci_dev *pdev,
2100 goto err_out_iomap; 2079 goto err_out_iomap;
2101 2080
2102 /* print info about board and interface just registered */ 2081 /* print info about board and interface just registered */
2103 dev_info(&dev->dev, "%s at 0x%lx, %pM, IRQ %d\n", 2082 netdev_info(dev, "%s at 0x%lx, %pM, IRQ %d\n",
2104 de->de21040 ? "21040" : "21041", 2083 de->de21040 ? "21040" : "21041",
2105 dev->base_addr, 2084 dev->base_addr,
2106 dev->dev_addr, 2085 dev->dev_addr,
2107 dev->irq); 2086 dev->irq);
2108 2087
2109 pci_set_drvdata(pdev, dev); 2088 pci_set_drvdata(pdev, dev);
2110 2089
@@ -2192,7 +2171,7 @@ static int de_resume (struct pci_dev *pdev)
2192 if (!netif_running(dev)) 2171 if (!netif_running(dev))
2193 goto out_attach; 2172 goto out_attach;
2194 if ((retval = pci_enable_device(pdev))) { 2173 if ((retval = pci_enable_device(pdev))) {
2195 dev_err(&dev->dev, "pci_enable_device failed in resume\n"); 2174 netdev_err(dev, "pci_enable_device failed in resume\n");
2196 goto out; 2175 goto out;
2197 } 2176 }
2198 pci_set_master(pdev); 2177 pci_set_master(pdev);
@@ -2221,7 +2200,7 @@ static struct pci_driver de_driver = {
2221static int __init de_init (void) 2200static int __init de_init (void)
2222{ 2201{
2223#ifdef MODULE 2202#ifdef MODULE
2224 printk("%s", version); 2203 pr_info("%s\n", version);
2225#endif 2204#endif
2226 return pci_register_driver(&de_driver); 2205 return pci_register_driver(&de_driver);
2227} 2206}
diff --git a/drivers/net/tulip/de4x5.c b/drivers/net/tulip/de4x5.c
index efaa1d69b720..45144d5bd11b 100644
--- a/drivers/net/tulip/de4x5.c
+++ b/drivers/net/tulip/de4x5.c
@@ -1995,7 +1995,7 @@ SetMulticastFilter(struct net_device *dev)
1995 1995
1996static u_char de4x5_irq[] = EISA_ALLOWED_IRQ_LIST; 1996static u_char de4x5_irq[] = EISA_ALLOWED_IRQ_LIST;
1997 1997
1998static int __init de4x5_eisa_probe (struct device *gendev) 1998static int __devinit de4x5_eisa_probe (struct device *gendev)
1999{ 1999{
2000 struct eisa_device *edev; 2000 struct eisa_device *edev;
2001 u_long iobase; 2001 u_long iobase;
@@ -2097,7 +2097,7 @@ static int __devexit de4x5_eisa_remove (struct device *device)
2097 return 0; 2097 return 0;
2098} 2098}
2099 2099
2100static struct eisa_device_id de4x5_eisa_ids[] = { 2100static const struct eisa_device_id de4x5_eisa_ids[] __devinitconst = {
2101 { "DEC4250", 0 }, /* 0 is the board name index... */ 2101 { "DEC4250", 0 }, /* 0 is the board name index... */
2102 { "" } 2102 { "" }
2103}; 2103};
diff --git a/drivers/net/tulip/dmfe.c b/drivers/net/tulip/dmfe.c
index fb07f48910ae..468512731966 100644
--- a/drivers/net/tulip/dmfe.c
+++ b/drivers/net/tulip/dmfe.c
@@ -295,8 +295,7 @@ enum dmfe_CR6_bits {
295/* Global variable declaration ----------------------------- */ 295/* Global variable declaration ----------------------------- */
296static int __devinitdata printed_version; 296static int __devinitdata printed_version;
297static const char version[] __devinitconst = 297static const char version[] __devinitconst =
298 KERN_INFO DRV_NAME ": Davicom DM9xxx net driver, version " 298 "Davicom DM9xxx net driver, version " DRV_VERSION " (" DRV_RELDATE ")";
299 DRV_VERSION " (" DRV_RELDATE ")\n";
300 299
301static int dmfe_debug; 300static int dmfe_debug;
302static unsigned char dmfe_media_mode = DMFE_AUTO; 301static unsigned char dmfe_media_mode = DMFE_AUTO;
@@ -381,7 +380,7 @@ static int __devinit dmfe_init_one (struct pci_dev *pdev,
381 DMFE_DBUG(0, "dmfe_init_one()", 0); 380 DMFE_DBUG(0, "dmfe_init_one()", 0);
382 381
383 if (!printed_version++) 382 if (!printed_version++)
384 printk(version); 383 pr_info("%s\n", version);
385 384
386 /* 385 /*
387 * SPARC on-board DM910x chips should be handled by the main 386 * SPARC on-board DM910x chips should be handled by the main
@@ -406,7 +405,7 @@ static int __devinit dmfe_init_one (struct pci_dev *pdev,
406 SET_NETDEV_DEV(dev, &pdev->dev); 405 SET_NETDEV_DEV(dev, &pdev->dev);
407 406
408 if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { 407 if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) {
409 pr_warning("32-bit PCI DMA not available\n"); 408 pr_warn("32-bit PCI DMA not available\n");
410 err = -ENODEV; 409 err = -ENODEV;
411 goto err_out_free; 410 goto err_out_free;
412 } 411 }
@@ -2203,7 +2202,7 @@ static int __init dmfe_init_module(void)
2203{ 2202{
2204 int rc; 2203 int rc;
2205 2204
2206 printk(version); 2205 pr_info("%s\n", version);
2207 printed_version = 1; 2206 printed_version = 1;
2208 2207
2209 DMFE_DBUG(0, "init_module() ", debug); 2208 DMFE_DBUG(0, "init_module() ", debug);
diff --git a/drivers/net/tulip/eeprom.c b/drivers/net/tulip/eeprom.c
index 296486bf0956..fa5eee925f25 100644
--- a/drivers/net/tulip/eeprom.c
+++ b/drivers/net/tulip/eeprom.c
@@ -222,8 +222,8 @@ subsequent_board:
222 /* there is no phy information, don't even try to build mtable */ 222 /* there is no phy information, don't even try to build mtable */
223 if (count == 0) { 223 if (count == 0) {
224 if (tulip_debug > 0) 224 if (tulip_debug > 0)
225 pr_warning("%s: no phy info, aborting mtable build\n", 225 pr_warn("%s: no phy info, aborting mtable build\n",
226 dev->name); 226 dev->name);
227 return; 227 return;
228 } 228 }
229 229
diff --git a/drivers/net/tulip/interrupt.c b/drivers/net/tulip/interrupt.c
index 0013642903ee..5350d753e0ff 100644
--- a/drivers/net/tulip/interrupt.c
+++ b/drivers/net/tulip/interrupt.c
@@ -125,12 +125,12 @@ int tulip_poll(struct napi_struct *napi, int budget)
125#endif 125#endif
126 126
127 if (tulip_debug > 4) 127 if (tulip_debug > 4)
128 printk(KERN_DEBUG " In tulip_rx(), entry %d %08x\n", 128 netdev_dbg(dev, " In tulip_rx(), entry %d %08x\n",
129 entry, tp->rx_ring[entry].status); 129 entry, tp->rx_ring[entry].status);
130 130
131 do { 131 do {
132 if (ioread32(tp->base_addr + CSR5) == 0xffffffff) { 132 if (ioread32(tp->base_addr + CSR5) == 0xffffffff) {
133 printk(KERN_DEBUG " In tulip_poll(), hardware disappeared\n"); 133 netdev_dbg(dev, " In tulip_poll(), hardware disappeared\n");
134 break; 134 break;
135 } 135 }
136 /* Acknowledge current RX interrupt sources. */ 136 /* Acknowledge current RX interrupt sources. */
@@ -145,9 +145,9 @@ int tulip_poll(struct napi_struct *napi, int budget)
145 if (tp->dirty_rx + RX_RING_SIZE == tp->cur_rx) 145 if (tp->dirty_rx + RX_RING_SIZE == tp->cur_rx)
146 break; 146 break;
147 147
148 if (tulip_debug > 5) 148 if (tulip_debug > 5)
149 printk(KERN_DEBUG "%s: In tulip_rx(), entry %d %08x\n", 149 netdev_dbg(dev, "In tulip_rx(), entry %d %08x\n",
150 dev->name, entry, status); 150 entry, status);
151 151
152 if (++work_done >= budget) 152 if (++work_done >= budget)
153 goto not_done; 153 goto not_done;
@@ -184,9 +184,9 @@ int tulip_poll(struct napi_struct *napi, int budget)
184 } 184 }
185 } else { 185 } else {
186 /* There was a fatal error. */ 186 /* There was a fatal error. */
187 if (tulip_debug > 2) 187 if (tulip_debug > 2)
188 printk(KERN_DEBUG "%s: Receive error, Rx status %08x\n", 188 netdev_dbg(dev, "Receive error, Rx status %08x\n",
189 dev->name, status); 189 status);
190 dev->stats.rx_errors++; /* end of a packet.*/ 190 dev->stats.rx_errors++; /* end of a packet.*/
191 if (pkt_len > 1518 || 191 if (pkt_len > 1518 ||
192 (status & RxDescRunt)) 192 (status & RxDescRunt))
@@ -367,16 +367,16 @@ static int tulip_rx(struct net_device *dev)
367 int received = 0; 367 int received = 0;
368 368
369 if (tulip_debug > 4) 369 if (tulip_debug > 4)
370 printk(KERN_DEBUG " In tulip_rx(), entry %d %08x\n", 370 netdev_dbg(dev, "In tulip_rx(), entry %d %08x\n",
371 entry, tp->rx_ring[entry].status); 371 entry, tp->rx_ring[entry].status);
372 /* If we own the next entry, it is a new packet. Send it up. */ 372 /* If we own the next entry, it is a new packet. Send it up. */
373 while ( ! (tp->rx_ring[entry].status & cpu_to_le32(DescOwned))) { 373 while ( ! (tp->rx_ring[entry].status & cpu_to_le32(DescOwned))) {
374 s32 status = le32_to_cpu(tp->rx_ring[entry].status); 374 s32 status = le32_to_cpu(tp->rx_ring[entry].status);
375 short pkt_len; 375 short pkt_len;
376 376
377 if (tulip_debug > 5) 377 if (tulip_debug > 5)
378 printk(KERN_DEBUG "%s: In tulip_rx(), entry %d %08x\n", 378 netdev_dbg(dev, "In tulip_rx(), entry %d %08x\n",
379 dev->name, entry, status); 379 entry, status);
380 if (--rx_work_limit < 0) 380 if (--rx_work_limit < 0)
381 break; 381 break;
382 382
@@ -404,16 +404,16 @@ static int tulip_rx(struct net_device *dev)
404 /* Ingore earlier buffers. */ 404 /* Ingore earlier buffers. */
405 if ((status & 0xffff) != 0x7fff) { 405 if ((status & 0xffff) != 0x7fff) {
406 if (tulip_debug > 1) 406 if (tulip_debug > 1)
407 dev_warn(&dev->dev, 407 netdev_warn(dev,
408 "Oversized Ethernet frame spanned multiple buffers, status %08x!\n", 408 "Oversized Ethernet frame spanned multiple buffers, status %08x!\n",
409 status); 409 status);
410 dev->stats.rx_length_errors++; 410 dev->stats.rx_length_errors++;
411 } 411 }
412 } else { 412 } else {
413 /* There was a fatal error. */ 413 /* There was a fatal error. */
414 if (tulip_debug > 2) 414 if (tulip_debug > 2)
415 printk(KERN_DEBUG "%s: Receive error, Rx status %08x\n", 415 netdev_dbg(dev, "Receive error, Rx status %08x\n",
416 dev->name, status); 416 status);
417 dev->stats.rx_errors++; /* end of a packet.*/ 417 dev->stats.rx_errors++; /* end of a packet.*/
418 if (pkt_len > 1518 || 418 if (pkt_len > 1518 ||
419 (status & RxDescRunt)) 419 (status & RxDescRunt))
@@ -573,8 +573,8 @@ irqreturn_t tulip_interrupt(int irq, void *dev_instance)
573#endif /* CONFIG_TULIP_NAPI */ 573#endif /* CONFIG_TULIP_NAPI */
574 574
575 if (tulip_debug > 4) 575 if (tulip_debug > 4)
576 printk(KERN_DEBUG "%s: interrupt csr5=%#8.8x new csr5=%#8.8x\n", 576 netdev_dbg(dev, "interrupt csr5=%#8.8x new csr5=%#8.8x\n",
577 dev->name, csr5, ioread32(ioaddr + CSR5)); 577 csr5, ioread32(ioaddr + CSR5));
578 578
579 579
580 if (csr5 & (TxNoBuf | TxDied | TxIntr | TimerInt)) { 580 if (csr5 & (TxNoBuf | TxDied | TxIntr | TimerInt)) {
@@ -605,8 +605,8 @@ irqreturn_t tulip_interrupt(int irq, void *dev_instance)
605 /* There was an major error, log it. */ 605 /* There was an major error, log it. */
606#ifndef final_version 606#ifndef final_version
607 if (tulip_debug > 1) 607 if (tulip_debug > 1)
608 printk(KERN_DEBUG "%s: Transmit error, Tx status %08x\n", 608 netdev_dbg(dev, "Transmit error, Tx status %08x\n",
609 dev->name, status); 609 status);
610#endif 610#endif
611 dev->stats.tx_errors++; 611 dev->stats.tx_errors++;
612 if (status & 0x4104) 612 if (status & 0x4104)
@@ -804,8 +804,8 @@ irqreturn_t tulip_interrupt(int irq, void *dev_instance)
804 } 804 }
805 805
806 if (tulip_debug > 4) 806 if (tulip_debug > 4)
807 printk(KERN_DEBUG "%s: exiting interrupt, csr5=%#04x\n", 807 netdev_dbg(dev, "exiting interrupt, csr5=%#04x\n",
808 dev->name, ioread32(ioaddr + CSR5)); 808 ioread32(ioaddr + CSR5));
809 809
810 return IRQ_HANDLED; 810 return IRQ_HANDLED;
811} 811}
diff --git a/drivers/net/tulip/media.c b/drivers/net/tulip/media.c
index a0c770ee4b64..4bd13922875d 100644
--- a/drivers/net/tulip/media.c
+++ b/drivers/net/tulip/media.c
@@ -182,8 +182,8 @@ void tulip_select_media(struct net_device *dev, int startup)
182 switch (mleaf->type) { 182 switch (mleaf->type) {
183 case 0: /* 21140 non-MII xcvr. */ 183 case 0: /* 21140 non-MII xcvr. */
184 if (tulip_debug > 1) 184 if (tulip_debug > 1)
185 printk(KERN_DEBUG "%s: Using a 21140 non-MII transceiver with control setting %02x\n", 185 netdev_dbg(dev, "Using a 21140 non-MII transceiver with control setting %02x\n",
186 dev->name, p[1]); 186 p[1]);
187 dev->if_port = p[0]; 187 dev->if_port = p[0];
188 if (startup) 188 if (startup)
189 iowrite32(mtable->csr12dir | 0x100, ioaddr + CSR12); 189 iowrite32(mtable->csr12dir | 0x100, ioaddr + CSR12);
@@ -204,15 +204,14 @@ void tulip_select_media(struct net_device *dev, int startup)
204 struct medialeaf *rleaf = &mtable->mleaf[mtable->has_reset]; 204 struct medialeaf *rleaf = &mtable->mleaf[mtable->has_reset];
205 unsigned char *rst = rleaf->leafdata; 205 unsigned char *rst = rleaf->leafdata;
206 if (tulip_debug > 1) 206 if (tulip_debug > 1)
207 printk(KERN_DEBUG "%s: Resetting the transceiver\n", 207 netdev_dbg(dev, "Resetting the transceiver\n");
208 dev->name);
209 for (i = 0; i < rst[0]; i++) 208 for (i = 0; i < rst[0]; i++)
210 iowrite32(get_u16(rst + 1 + (i<<1)) << 16, ioaddr + CSR15); 209 iowrite32(get_u16(rst + 1 + (i<<1)) << 16, ioaddr + CSR15);
211 } 210 }
212 if (tulip_debug > 1) 211 if (tulip_debug > 1)
213 printk(KERN_DEBUG "%s: 21143 non-MII %s transceiver control %04x/%04x\n", 212 netdev_dbg(dev, "21143 non-MII %s transceiver control %04x/%04x\n",
214 dev->name, medianame[dev->if_port], 213 medianame[dev->if_port],
215 setup[0], setup[1]); 214 setup[0], setup[1]);
216 if (p[0] & 0x40) { /* SIA (CSR13-15) setup values are provided. */ 215 if (p[0] & 0x40) { /* SIA (CSR13-15) setup values are provided. */
217 csr13val = setup[0]; 216 csr13val = setup[0];
218 csr14val = setup[1]; 217 csr14val = setup[1];
@@ -239,8 +238,8 @@ void tulip_select_media(struct net_device *dev, int startup)
239 if (startup) iowrite32(csr13val, ioaddr + CSR13); 238 if (startup) iowrite32(csr13val, ioaddr + CSR13);
240 } 239 }
241 if (tulip_debug > 1) 240 if (tulip_debug > 1)
242 printk(KERN_DEBUG "%s: Setting CSR15 to %08x/%08x\n", 241 netdev_dbg(dev, "Setting CSR15 to %08x/%08x\n",
243 dev->name, csr15dir, csr15val); 242 csr15dir, csr15val);
244 if (mleaf->type == 4) 243 if (mleaf->type == 4)
245 new_csr6 = 0x82020000 | ((setup[2] & 0x71) << 18); 244 new_csr6 = 0x82020000 | ((setup[2] & 0x71) << 18);
246 else 245 else
@@ -316,9 +315,9 @@ void tulip_select_media(struct net_device *dev, int startup)
316 if (tp->mii_advertise == 0) 315 if (tp->mii_advertise == 0)
317 tp->mii_advertise = tp->advertising[phy_num]; 316 tp->mii_advertise = tp->advertising[phy_num];
318 if (tulip_debug > 1) 317 if (tulip_debug > 1)
319 printk(KERN_DEBUG "%s: Advertising %04x on MII %d\n", 318 netdev_dbg(dev, " Advertising %04x on MII %d\n",
320 dev->name, tp->mii_advertise, 319 tp->mii_advertise,
321 tp->phys[phy_num]); 320 tp->phys[phy_num]);
322 tulip_mdio_write(dev, tp->phys[phy_num], 4, tp->mii_advertise); 321 tulip_mdio_write(dev, tp->phys[phy_num], 4, tp->mii_advertise);
323 } 322 }
324 break; 323 break;
@@ -335,8 +334,7 @@ void tulip_select_media(struct net_device *dev, int startup)
335 struct medialeaf *rleaf = &mtable->mleaf[mtable->has_reset]; 334 struct medialeaf *rleaf = &mtable->mleaf[mtable->has_reset];
336 unsigned char *rst = rleaf->leafdata; 335 unsigned char *rst = rleaf->leafdata;
337 if (tulip_debug > 1) 336 if (tulip_debug > 1)
338 printk(KERN_DEBUG "%s: Resetting the transceiver\n", 337 netdev_dbg(dev, "Resetting the transceiver\n");
339 dev->name);
340 for (i = 0; i < rst[0]; i++) 338 for (i = 0; i < rst[0]; i++)
341 iowrite32(get_u16(rst + 1 + (i<<1)) << 16, ioaddr + CSR15); 339 iowrite32(get_u16(rst + 1 + (i<<1)) << 16, ioaddr + CSR15);
342 } 340 }
@@ -344,20 +342,21 @@ void tulip_select_media(struct net_device *dev, int startup)
344 break; 342 break;
345 } 343 }
346 default: 344 default:
347 printk(KERN_DEBUG "%s: Invalid media table selection %d\n", 345 netdev_dbg(dev, " Invalid media table selection %d\n",
348 dev->name, mleaf->type); 346 mleaf->type);
349 new_csr6 = 0x020E0000; 347 new_csr6 = 0x020E0000;
350 } 348 }
351 if (tulip_debug > 1) 349 if (tulip_debug > 1)
352 printk(KERN_DEBUG "%s: Using media type %s, CSR12 is %02x\n", 350 netdev_dbg(dev, "Using media type %s, CSR12 is %02x\n",
353 dev->name, medianame[dev->if_port], 351 medianame[dev->if_port],
354 ioread32(ioaddr + CSR12) & 0xff); 352 ioread32(ioaddr + CSR12) & 0xff);
355 } else if (tp->chip_id == LC82C168) { 353 } else if (tp->chip_id == LC82C168) {
356 if (startup && ! tp->medialock) 354 if (startup && ! tp->medialock)
357 dev->if_port = tp->mii_cnt ? 11 : 0; 355 dev->if_port = tp->mii_cnt ? 11 : 0;
358 if (tulip_debug > 1) 356 if (tulip_debug > 1)
359 printk(KERN_DEBUG "%s: PNIC PHY status is %3.3x, media %s\n", 357 netdev_dbg(dev, "PNIC PHY status is %3.3x, media %s\n",
360 dev->name, ioread32(ioaddr + 0xB8), medianame[dev->if_port]); 358 ioread32(ioaddr + 0xB8),
359 medianame[dev->if_port]);
361 if (tp->mii_cnt) { 360 if (tp->mii_cnt) {
362 new_csr6 = 0x810C0000; 361 new_csr6 = 0x810C0000;
363 iowrite32(0x0001, ioaddr + CSR15); 362 iowrite32(0x0001, ioaddr + CSR15);
@@ -388,9 +387,9 @@ void tulip_select_media(struct net_device *dev, int startup)
388 } else 387 } else
389 new_csr6 = 0x03860000; 388 new_csr6 = 0x03860000;
390 if (tulip_debug > 1) 389 if (tulip_debug > 1)
391 printk(KERN_DEBUG "%s: No media description table, assuming %s transceiver, CSR12 %02x\n", 390 netdev_dbg(dev, "No media description table, assuming %s transceiver, CSR12 %02x\n",
392 dev->name, medianame[dev->if_port], 391 medianame[dev->if_port],
393 ioread32(ioaddr + CSR12)); 392 ioread32(ioaddr + CSR12));
394 } 393 }
395 394
396 tp->csr6 = new_csr6 | (tp->csr6 & 0xfdff) | (tp->full_duplex ? 0x0200 : 0); 395 tp->csr6 = new_csr6 | (tp->csr6 & 0xfdff) | (tp->full_duplex ? 0x0200 : 0);
@@ -504,8 +503,8 @@ void __devinit tulip_find_mii (struct net_device *dev, int board_idx)
504 503
505 /* Fixup for DLink with miswired PHY. */ 504 /* Fixup for DLink with miswired PHY. */
506 if (mii_advert != to_advert) { 505 if (mii_advert != to_advert) {
507 printk(KERN_DEBUG "tulip%d: Advertising %04x on PHY %d, previously advertising %04x\n", 506 pr_debug("tulip%d: Advertising %04x on PHY %d, previously advertising %04x\n",
508 board_idx, to_advert, phy, mii_advert); 507 board_idx, to_advert, phy, mii_advert);
509 tulip_mdio_write (dev, phy, 4, to_advert); 508 tulip_mdio_write (dev, phy, 4, to_advert);
510 } 509 }
511 510
diff --git a/drivers/net/tulip/pnic.c b/drivers/net/tulip/pnic.c
index a63e64b6863d..aa4d9dad0395 100644
--- a/drivers/net/tulip/pnic.c
+++ b/drivers/net/tulip/pnic.c
@@ -40,8 +40,8 @@ void pnic_do_nway(struct net_device *dev)
40 new_csr6 |= 0x00000200; 40 new_csr6 |= 0x00000200;
41 } 41 }
42 if (tulip_debug > 1) 42 if (tulip_debug > 1)
43 printk(KERN_DEBUG "%s: PNIC autonegotiated status %08x, %s\n", 43 netdev_dbg(dev, "PNIC autonegotiated status %08x, %s\n",
44 dev->name, phy_reg, medianame[dev->if_port]); 44 phy_reg, medianame[dev->if_port]);
45 if (tp->csr6 != new_csr6) { 45 if (tp->csr6 != new_csr6) {
46 tp->csr6 = new_csr6; 46 tp->csr6 = new_csr6;
47 /* Restart Tx */ 47 /* Restart Tx */
@@ -58,8 +58,8 @@ void pnic_lnk_change(struct net_device *dev, int csr5)
58 int phy_reg = ioread32(ioaddr + 0xB8); 58 int phy_reg = ioread32(ioaddr + 0xB8);
59 59
60 if (tulip_debug > 1) 60 if (tulip_debug > 1)
61 printk(KERN_DEBUG "%s: PNIC link changed state %08x, CSR5 %08x\n", 61 netdev_dbg(dev, "PNIC link changed state %08x, CSR5 %08x\n",
62 dev->name, phy_reg, csr5); 62 phy_reg, csr5);
63 if (ioread32(ioaddr + CSR5) & TPLnkFail) { 63 if (ioread32(ioaddr + CSR5) & TPLnkFail) {
64 iowrite32((ioread32(ioaddr + CSR7) & ~TPLnkFail) | TPLnkPass, ioaddr + CSR7); 64 iowrite32((ioread32(ioaddr + CSR7) & ~TPLnkFail) | TPLnkPass, ioaddr + CSR7);
65 /* If we use an external MII, then we mustn't use the 65 /* If we use an external MII, then we mustn't use the
@@ -114,8 +114,8 @@ void pnic_timer(unsigned long data)
114 int csr5 = ioread32(ioaddr + CSR5); 114 int csr5 = ioread32(ioaddr + CSR5);
115 115
116 if (tulip_debug > 1) 116 if (tulip_debug > 1)
117 printk(KERN_DEBUG "%s: PNIC timer PHY status %08x, %s CSR5 %08x\n", 117 netdev_dbg(dev, "PNIC timer PHY status %08x, %s CSR5 %08x\n",
118 dev->name, phy_reg, medianame[dev->if_port], csr5); 118 phy_reg, medianame[dev->if_port], csr5);
119 if (phy_reg & 0x04000000) { /* Remote link fault */ 119 if (phy_reg & 0x04000000) { /* Remote link fault */
120 iowrite32(0x0201F078, ioaddr + 0xB8); 120 iowrite32(0x0201F078, ioaddr + 0xB8);
121 next_tick = 1*HZ; 121 next_tick = 1*HZ;
@@ -125,11 +125,11 @@ void pnic_timer(unsigned long data)
125 next_tick = 60*HZ; 125 next_tick = 60*HZ;
126 } else if (csr5 & TPLnkFail) { /* 100baseTx link beat */ 126 } else if (csr5 & TPLnkFail) { /* 100baseTx link beat */
127 if (tulip_debug > 1) 127 if (tulip_debug > 1)
128 printk(KERN_DEBUG "%s: %s link beat failed, CSR12 %04x, CSR5 %08x, PHY %03x\n", 128 netdev_dbg(dev, "%s link beat failed, CSR12 %04x, CSR5 %08x, PHY %03x\n",
129 dev->name, medianame[dev->if_port], 129 medianame[dev->if_port],
130 csr12, 130 csr12,
131 ioread32(ioaddr + CSR5), 131 ioread32(ioaddr + CSR5),
132 ioread32(ioaddr + 0xB8)); 132 ioread32(ioaddr + 0xB8));
133 next_tick = 3*HZ; 133 next_tick = 3*HZ;
134 if (tp->medialock) { 134 if (tp->medialock) {
135 } else if (tp->nwayset && (dev->if_port & 1)) { 135 } else if (tp->nwayset && (dev->if_port & 1)) {
diff --git a/drivers/net/tulip/pnic2.c b/drivers/net/tulip/pnic2.c
index 4690c8e69207..93358ee4d830 100644
--- a/drivers/net/tulip/pnic2.c
+++ b/drivers/net/tulip/pnic2.c
@@ -125,8 +125,8 @@ void pnic2_start_nway(struct net_device *dev)
125 csr14 |= 0x00001184; 125 csr14 |= 0x00001184;
126 126
127 if (tulip_debug > 1) 127 if (tulip_debug > 1)
128 printk(KERN_DEBUG "%s: Restarting PNIC2 autonegotiation, csr14=%08x\n", 128 netdev_dbg(dev, "Restarting PNIC2 autonegotiation, csr14=%08x\n",
129 dev->name, csr14); 129 csr14);
130 130
131 /* tell pnic2_lnk_change we are doing an nway negotiation */ 131 /* tell pnic2_lnk_change we are doing an nway negotiation */
132 dev->if_port = 0; 132 dev->if_port = 0;
@@ -137,8 +137,7 @@ void pnic2_start_nway(struct net_device *dev)
137 137
138 tp->csr6 = ioread32(ioaddr + CSR6); 138 tp->csr6 = ioread32(ioaddr + CSR6);
139 if (tulip_debug > 1) 139 if (tulip_debug > 1)
140 printk(KERN_DEBUG "%s: On Entry to Nway, csr6=%08x\n", 140 netdev_dbg(dev, "On Entry to Nway, csr6=%08x\n", tp->csr6);
141 dev->name, tp->csr6);
142 141
143 /* mask off any bits not to touch 142 /* mask off any bits not to touch
144 * comment at top of file explains mask value 143 * comment at top of file explains mask value
@@ -271,9 +270,10 @@ void pnic2_lnk_change(struct net_device *dev, int csr5)
271 iowrite32(1, ioaddr + CSR13); 270 iowrite32(1, ioaddr + CSR13);
272 271
273 if (tulip_debug > 2) 272 if (tulip_debug > 2)
274 printk(KERN_DEBUG "%s: Setting CSR6 %08x/%x CSR12 %08x\n", 273 netdev_dbg(dev, "Setting CSR6 %08x/%x CSR12 %08x\n",
275 dev->name, tp->csr6, 274 tp->csr6,
276 ioread32(ioaddr + CSR6), ioread32(ioaddr + CSR12)); 275 ioread32(ioaddr + CSR6),
276 ioread32(ioaddr + CSR12));
277 277
278 /* now the following actually writes out the 278 /* now the following actually writes out the
279 * new csr6 values 279 * new csr6 values
@@ -324,7 +324,7 @@ void pnic2_lnk_change(struct net_device *dev, int csr5)
324 /* Link blew? Maybe restart NWay. */ 324 /* Link blew? Maybe restart NWay. */
325 325
326 if (tulip_debug > 2) 326 if (tulip_debug > 2)
327 printk(KERN_DEBUG "%s: Ugh! Link blew?\n", dev->name); 327 netdev_dbg(dev, "Ugh! Link blew?\n");
328 328
329 del_timer_sync(&tp->timer); 329 del_timer_sync(&tp->timer);
330 pnic2_start_nway(dev); 330 pnic2_start_nway(dev);
diff --git a/drivers/net/tulip/timer.c b/drivers/net/tulip/timer.c
index 36c2725ec886..2017faf2d0e6 100644
--- a/drivers/net/tulip/timer.c
+++ b/drivers/net/tulip/timer.c
@@ -28,11 +28,11 @@ void tulip_media_task(struct work_struct *work)
28 unsigned long flags; 28 unsigned long flags;
29 29
30 if (tulip_debug > 2) { 30 if (tulip_debug > 2) {
31 printk(KERN_DEBUG "%s: Media selection tick, %s, status %08x mode %08x SIA %08x %08x %08x %08x\n", 31 netdev_dbg(dev, "Media selection tick, %s, status %08x mode %08x SIA %08x %08x %08x %08x\n",
32 dev->name, medianame[dev->if_port], 32 medianame[dev->if_port],
33 ioread32(ioaddr + CSR5), ioread32(ioaddr + CSR6), 33 ioread32(ioaddr + CSR5), ioread32(ioaddr + CSR6),
34 csr12, ioread32(ioaddr + CSR13), 34 csr12, ioread32(ioaddr + CSR13),
35 ioread32(ioaddr + CSR14), ioread32(ioaddr + CSR15)); 35 ioread32(ioaddr + CSR14), ioread32(ioaddr + CSR15));
36 } 36 }
37 switch (tp->chip_id) { 37 switch (tp->chip_id) {
38 case DC21140: 38 case DC21140:
@@ -48,9 +48,9 @@ void tulip_media_task(struct work_struct *work)
48 Assume this a generic MII or SYM transceiver. */ 48 Assume this a generic MII or SYM transceiver. */
49 next_tick = 60*HZ; 49 next_tick = 60*HZ;
50 if (tulip_debug > 2) 50 if (tulip_debug > 2)
51 printk(KERN_DEBUG "%s: network media monitor CSR6 %08x CSR12 0x%02x\n", 51 netdev_dbg(dev, "network media monitor CSR6 %08x CSR12 0x%02x\n",
52 dev->name, 52 ioread32(ioaddr + CSR6),
53 ioread32(ioaddr + CSR6), csr12 & 0xff); 53 csr12 & 0xff);
54 break; 54 break;
55 } 55 }
56 mleaf = &tp->mtable->mleaf[tp->cur_index]; 56 mleaf = &tp->mtable->mleaf[tp->cur_index];
@@ -62,8 +62,8 @@ void tulip_media_task(struct work_struct *work)
62 s8 bitnum = p[offset]; 62 s8 bitnum = p[offset];
63 if (p[offset+1] & 0x80) { 63 if (p[offset+1] & 0x80) {
64 if (tulip_debug > 1) 64 if (tulip_debug > 1)
65 printk(KERN_DEBUG "%s: Transceiver monitor tick CSR12=%#02x, no media sense\n", 65 netdev_dbg(dev, "Transceiver monitor tick CSR12=%#02x, no media sense\n",
66 dev->name, csr12); 66 csr12);
67 if (mleaf->type == 4) { 67 if (mleaf->type == 4) {
68 if (mleaf->media == 3 && (csr12 & 0x02)) 68 if (mleaf->media == 3 && (csr12 & 0x02))
69 goto select_next_media; 69 goto select_next_media;
@@ -71,17 +71,16 @@ void tulip_media_task(struct work_struct *work)
71 break; 71 break;
72 } 72 }
73 if (tulip_debug > 2) 73 if (tulip_debug > 2)
74 printk(KERN_DEBUG "%s: Transceiver monitor tick: CSR12=%#02x bit %d is %d, expecting %d\n", 74 netdev_dbg(dev, "Transceiver monitor tick: CSR12=%#02x bit %d is %d, expecting %d\n",
75 dev->name, csr12, (bitnum >> 1) & 7, 75 csr12, (bitnum >> 1) & 7,
76 (csr12 & (1 << ((bitnum >> 1) & 7))) != 0, 76 (csr12 & (1 << ((bitnum >> 1) & 7))) != 0,
77 (bitnum >= 0)); 77 (bitnum >= 0));
78 /* Check that the specified bit has the proper value. */ 78 /* Check that the specified bit has the proper value. */
79 if ((bitnum < 0) != 79 if ((bitnum < 0) !=
80 ((csr12 & (1 << ((bitnum >> 1) & 7))) != 0)) { 80 ((csr12 & (1 << ((bitnum >> 1) & 7))) != 0)) {
81 if (tulip_debug > 2) 81 if (tulip_debug > 2)
82 printk(KERN_DEBUG "%s: Link beat detected for %s\n", 82 netdev_dbg(dev, "Link beat detected for %s\n",
83 dev->name, 83 medianame[mleaf->media & MEDIA_MASK]);
84 medianame[mleaf->media & MEDIA_MASK]);
85 if ((p[2] & 0x61) == 0x01) /* Bogus Znyx board. */ 84 if ((p[2] & 0x61) == 0x01) /* Bogus Znyx board. */
86 goto actually_mii; 85 goto actually_mii;
87 netif_carrier_on(dev); 86 netif_carrier_on(dev);
@@ -99,10 +98,9 @@ void tulip_media_task(struct work_struct *work)
99 if (tulip_media_cap[dev->if_port] & MediaIsFD) 98 if (tulip_media_cap[dev->if_port] & MediaIsFD)
100 goto select_next_media; /* Skip FD entries. */ 99 goto select_next_media; /* Skip FD entries. */
101 if (tulip_debug > 1) 100 if (tulip_debug > 1)
102 printk(KERN_DEBUG "%s: No link beat on media %s, trying transceiver type %s\n", 101 netdev_dbg(dev, "No link beat on media %s, trying transceiver type %s\n",
103 dev->name, 102 medianame[mleaf->media & MEDIA_MASK],
104 medianame[mleaf->media & MEDIA_MASK], 103 medianame[tp->mtable->mleaf[tp->cur_index].media]);
105 medianame[tp->mtable->mleaf[tp->cur_index].media]);
106 tulip_select_media(dev, 0); 104 tulip_select_media(dev, 0);
107 /* Restart the transmit process. */ 105 /* Restart the transmit process. */
108 tulip_restart_rxtx(tp); 106 tulip_restart_rxtx(tp);
@@ -166,10 +164,9 @@ void comet_timer(unsigned long data)
166 int next_tick = 60*HZ; 164 int next_tick = 60*HZ;
167 165
168 if (tulip_debug > 1) 166 if (tulip_debug > 1)
169 printk(KERN_DEBUG "%s: Comet link status %04x partner capability %04x\n", 167 netdev_dbg(dev, "Comet link status %04x partner capability %04x\n",
170 dev->name, 168 tulip_mdio_read(dev, tp->phys[0], 1),
171 tulip_mdio_read(dev, tp->phys[0], 1), 169 tulip_mdio_read(dev, tp->phys[0], 5));
172 tulip_mdio_read(dev, tp->phys[0], 5));
173 /* mod_timer synchronizes us with potential add_timer calls 170 /* mod_timer synchronizes us with potential add_timer calls
174 * from interrupts. 171 * from interrupts.
175 */ 172 */
diff --git a/drivers/net/tulip/tulip.h b/drivers/net/tulip/tulip.h
index ed66a16711dc..9db528967da9 100644
--- a/drivers/net/tulip/tulip.h
+++ b/drivers/net/tulip/tulip.h
@@ -547,11 +547,9 @@ static inline void tulip_stop_rxtx(struct tulip_private *tp)
547 udelay(10); 547 udelay(10);
548 548
549 if (!i) 549 if (!i)
550 printk(KERN_DEBUG "%s: tulip_stop_rxtx() failed" 550 netdev_dbg(tp->dev, "tulip_stop_rxtx() failed (CSR5 0x%x CSR6 0x%x)\n",
551 " (CSR5 0x%x CSR6 0x%x)\n", 551 ioread32(ioaddr + CSR5),
552 pci_name(tp->pdev), 552 ioread32(ioaddr + CSR6));
553 ioread32(ioaddr + CSR5),
554 ioread32(ioaddr + CSR6));
555 } 553 }
556} 554}
557 555
diff --git a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c
index 5c01e260f1ba..82f87647207e 100644
--- a/drivers/net/tulip/tulip_core.c
+++ b/drivers/net/tulip/tulip_core.c
@@ -12,6 +12,7 @@
12 Please submit bugs to http://bugzilla.kernel.org/ . 12 Please submit bugs to http://bugzilla.kernel.org/ .
13*/ 13*/
14 14
15#define pr_fmt(fmt) "tulip: " fmt
15 16
16#define DRV_NAME "tulip" 17#define DRV_NAME "tulip"
17#ifdef CONFIG_TULIP_NAPI 18#ifdef CONFIG_TULIP_NAPI
@@ -119,8 +120,6 @@ module_param(csr0, int, 0);
119module_param_array(options, int, NULL, 0); 120module_param_array(options, int, NULL, 0);
120module_param_array(full_duplex, int, NULL, 0); 121module_param_array(full_duplex, int, NULL, 0);
121 122
122#define PFX DRV_NAME ": "
123
124#ifdef TULIP_DEBUG 123#ifdef TULIP_DEBUG
125int tulip_debug = TULIP_DEBUG; 124int tulip_debug = TULIP_DEBUG;
126#else 125#else
@@ -331,8 +330,7 @@ static void tulip_up(struct net_device *dev)
331 udelay(100); 330 udelay(100);
332 331
333 if (tulip_debug > 1) 332 if (tulip_debug > 1)
334 printk(KERN_DEBUG "%s: tulip_up(), irq==%d\n", 333 netdev_dbg(dev, "tulip_up(), irq==%d\n", dev->irq);
335 dev->name, dev->irq);
336 334
337 iowrite32(tp->rx_ring_dma, ioaddr + CSR3); 335 iowrite32(tp->rx_ring_dma, ioaddr + CSR3);
338 iowrite32(tp->tx_ring_dma, ioaddr + CSR4); 336 iowrite32(tp->tx_ring_dma, ioaddr + CSR4);
@@ -499,10 +497,10 @@ media_picked:
499 iowrite32(0, ioaddr + CSR2); /* Rx poll demand */ 497 iowrite32(0, ioaddr + CSR2); /* Rx poll demand */
500 498
501 if (tulip_debug > 2) { 499 if (tulip_debug > 2) {
502 printk(KERN_DEBUG "%s: Done tulip_up(), CSR0 %08x, CSR5 %08x CSR6 %08x\n", 500 netdev_dbg(dev, "Done tulip_up(), CSR0 %08x, CSR5 %08x CSR6 %08x\n",
503 dev->name, ioread32(ioaddr + CSR0), 501 ioread32(ioaddr + CSR0),
504 ioread32(ioaddr + CSR5), 502 ioread32(ioaddr + CSR5),
505 ioread32(ioaddr + CSR6)); 503 ioread32(ioaddr + CSR6));
506 } 504 }
507 505
508 /* Set the timer to switch to check for link beat and perhaps switch 506 /* Set the timer to switch to check for link beat and perhaps switch
@@ -843,8 +841,7 @@ static int tulip_close (struct net_device *dev)
843 tulip_down (dev); 841 tulip_down (dev);
844 842
845 if (tulip_debug > 1) 843 if (tulip_debug > 1)
846 dev_printk(KERN_DEBUG, &dev->dev, 844 netdev_dbg(dev, "Shutting down ethercard, status was %02x\n",
847 "Shutting down ethercard, status was %02x\n",
848 ioread32 (ioaddr + CSR5)); 845 ioread32 (ioaddr + CSR5));
849 846
850 free_irq (dev->irq, dev); 847 free_irq (dev->irq, dev);
@@ -1207,7 +1204,7 @@ static void __devinit tulip_mwi_config (struct pci_dev *pdev,
1207 u32 csr0; 1204 u32 csr0;
1208 1205
1209 if (tulip_debug > 3) 1206 if (tulip_debug > 3)
1210 printk(KERN_DEBUG "%s: tulip_mwi_config()\n", pci_name(pdev)); 1207 netdev_dbg(dev, "tulip_mwi_config()\n");
1211 1208
1212 tp->csr0 = csr0 = 0; 1209 tp->csr0 = csr0 = 0;
1213 1210
@@ -1269,8 +1266,8 @@ static void __devinit tulip_mwi_config (struct pci_dev *pdev,
1269out: 1266out:
1270 tp->csr0 = csr0; 1267 tp->csr0 = csr0;
1271 if (tulip_debug > 2) 1268 if (tulip_debug > 2)
1272 printk(KERN_DEBUG "%s: MWI config cacheline=%d, csr0=%08x\n", 1269 netdev_dbg(dev, "MWI config cacheline=%d, csr0=%08x\n",
1273 pci_name(pdev), cache, csr0); 1270 cache, csr0);
1274} 1271}
1275#endif 1272#endif
1276 1273
@@ -1340,13 +1337,13 @@ static int __devinit tulip_init_one (struct pci_dev *pdev,
1340 */ 1337 */
1341 1338
1342 if (pdev->subsystem_vendor == PCI_VENDOR_ID_LMC) { 1339 if (pdev->subsystem_vendor == PCI_VENDOR_ID_LMC) {
1343 pr_err(PFX "skipping LMC card\n"); 1340 pr_err("skipping LMC card\n");
1344 return -ENODEV; 1341 return -ENODEV;
1345 } else if (pdev->subsystem_vendor == PCI_VENDOR_ID_SBE && 1342 } else if (pdev->subsystem_vendor == PCI_VENDOR_ID_SBE &&
1346 (pdev->subsystem_device == PCI_SUBDEVICE_ID_SBE_T3E3 || 1343 (pdev->subsystem_device == PCI_SUBDEVICE_ID_SBE_T3E3 ||
1347 pdev->subsystem_device == PCI_SUBDEVICE_ID_SBE_2T3E3_P0 || 1344 pdev->subsystem_device == PCI_SUBDEVICE_ID_SBE_2T3E3_P0 ||
1348 pdev->subsystem_device == PCI_SUBDEVICE_ID_SBE_2T3E3_P1)) { 1345 pdev->subsystem_device == PCI_SUBDEVICE_ID_SBE_2T3E3_P1)) {
1349 pr_err(PFX "skipping SBE T3E3 port\n"); 1346 pr_err("skipping SBE T3E3 port\n");
1350 return -ENODEV; 1347 return -ENODEV;
1351 } 1348 }
1352 1349
@@ -1362,13 +1359,13 @@ static int __devinit tulip_init_one (struct pci_dev *pdev,
1362 1359
1363 if (pdev->vendor == 0x1282 && pdev->device == 0x9100 && 1360 if (pdev->vendor == 0x1282 && pdev->device == 0x9100 &&
1364 pdev->revision < 0x30) { 1361 pdev->revision < 0x30) {
1365 pr_info(PFX "skipping early DM9100 with Crc bug (use dmfe)\n"); 1362 pr_info("skipping early DM9100 with Crc bug (use dmfe)\n");
1366 return -ENODEV; 1363 return -ENODEV;
1367 } 1364 }
1368 1365
1369 dp = pci_device_to_OF_node(pdev); 1366 dp = pci_device_to_OF_node(pdev);
1370 if (!(dp && of_get_property(dp, "local-mac-address", NULL))) { 1367 if (!(dp && of_get_property(dp, "local-mac-address", NULL))) {
1371 pr_info(PFX "skipping DM910x expansion card (use dmfe)\n"); 1368 pr_info("skipping DM910x expansion card (use dmfe)\n");
1372 return -ENODEV; 1369 return -ENODEV;
1373 } 1370 }
1374 } 1371 }
@@ -1415,16 +1412,14 @@ static int __devinit tulip_init_one (struct pci_dev *pdev,
1415 1412
1416 i = pci_enable_device(pdev); 1413 i = pci_enable_device(pdev);
1417 if (i) { 1414 if (i) {
1418 pr_err(PFX "Cannot enable tulip board #%d, aborting\n", 1415 pr_err("Cannot enable tulip board #%d, aborting\n", board_idx);
1419 board_idx);
1420 return i; 1416 return i;
1421 } 1417 }
1422 1418
1423 /* The chip will fail to enter a low-power state later unless 1419 /* The chip will fail to enter a low-power state later unless
1424 * first explicitly commanded into D0 */ 1420 * first explicitly commanded into D0 */
1425 if (pci_set_power_state(pdev, PCI_D0)) { 1421 if (pci_set_power_state(pdev, PCI_D0)) {
1426 printk (KERN_NOTICE PFX 1422 pr_notice("Failed to set power state to D0\n");
1427 "Failed to set power state to D0\n");
1428 } 1423 }
1429 1424
1430 irq = pdev->irq; 1425 irq = pdev->irq;
@@ -1432,13 +1427,13 @@ static int __devinit tulip_init_one (struct pci_dev *pdev,
1432 /* alloc_etherdev ensures aligned and zeroed private structures */ 1427 /* alloc_etherdev ensures aligned and zeroed private structures */
1433 dev = alloc_etherdev (sizeof (*tp)); 1428 dev = alloc_etherdev (sizeof (*tp));
1434 if (!dev) { 1429 if (!dev) {
1435 pr_err(PFX "ether device alloc failed, aborting\n"); 1430 pr_err("ether device alloc failed, aborting\n");
1436 return -ENOMEM; 1431 return -ENOMEM;
1437 } 1432 }
1438 1433
1439 SET_NETDEV_DEV(dev, &pdev->dev); 1434 SET_NETDEV_DEV(dev, &pdev->dev);
1440 if (pci_resource_len (pdev, 0) < tulip_tbl[chip_idx].io_size) { 1435 if (pci_resource_len (pdev, 0) < tulip_tbl[chip_idx].io_size) {
1441 pr_err(PFX "%s: I/O region (0x%llx@0x%llx) too small, aborting\n", 1436 pr_err("%s: I/O region (0x%llx@0x%llx) too small, aborting\n",
1442 pci_name(pdev), 1437 pci_name(pdev),
1443 (unsigned long long)pci_resource_len (pdev, 0), 1438 (unsigned long long)pci_resource_len (pdev, 0),
1444 (unsigned long long)pci_resource_start (pdev, 0)); 1439 (unsigned long long)pci_resource_start (pdev, 0));
@@ -1483,7 +1478,8 @@ static int __devinit tulip_init_one (struct pci_dev *pdev,
1483 if (sig == 0x09811317) { 1478 if (sig == 0x09811317) {
1484 tp->flags |= COMET_PM; 1479 tp->flags |= COMET_PM;
1485 tp->wolinfo.supported = WAKE_PHY | WAKE_MAGIC; 1480 tp->wolinfo.supported = WAKE_PHY | WAKE_MAGIC;
1486 printk(KERN_INFO "tulip_init_one: Enabled WOL support for AN983B\n"); 1481 pr_info("%s: Enabled WOL support for AN983B\n",
1482 __func__);
1487 } 1483 }
1488 } 1484 }
1489 tp->pdev = pdev; 1485 tp->pdev = pdev;
@@ -1879,7 +1875,7 @@ save_state:
1879 tulip_set_wolopts(pdev, tp->wolinfo.wolopts); 1875 tulip_set_wolopts(pdev, tp->wolinfo.wolopts);
1880 rc = pci_enable_wake(pdev, pstate, tp->wolinfo.wolopts); 1876 rc = pci_enable_wake(pdev, pstate, tp->wolinfo.wolopts);
1881 if (rc) 1877 if (rc)
1882 printk("tulip: pci_enable_wake failed (%d)\n", rc); 1878 pr_err("pci_enable_wake failed (%d)\n", rc);
1883 } 1879 }
1884 pci_set_power_state(pdev, pstate); 1880 pci_set_power_state(pdev, pstate);
1885 1881
@@ -1905,12 +1901,12 @@ static int tulip_resume(struct pci_dev *pdev)
1905 return 0; 1901 return 0;
1906 1902
1907 if ((retval = pci_enable_device(pdev))) { 1903 if ((retval = pci_enable_device(pdev))) {
1908 pr_err(PFX "pci_enable_device failed in resume\n"); 1904 pr_err("pci_enable_device failed in resume\n");
1909 return retval; 1905 return retval;
1910 } 1906 }
1911 1907
1912 if ((retval = request_irq(dev->irq, tulip_interrupt, IRQF_SHARED, dev->name, dev))) { 1908 if ((retval = request_irq(dev->irq, tulip_interrupt, IRQF_SHARED, dev->name, dev))) {
1913 pr_err(PFX "request_irq failed in resume\n"); 1909 pr_err("request_irq failed in resume\n");
1914 return retval; 1910 return retval;
1915 } 1911 }
1916 1912
diff --git a/drivers/net/tulip/uli526x.c b/drivers/net/tulip/uli526x.c
index 74217dbf0143..9e63f406f72d 100644
--- a/drivers/net/tulip/uli526x.c
+++ b/drivers/net/tulip/uli526x.c
@@ -209,8 +209,7 @@ enum uli526x_CR6_bits {
209/* Global variable declaration ----------------------------- */ 209/* Global variable declaration ----------------------------- */
210static int __devinitdata printed_version; 210static int __devinitdata printed_version;
211static const char version[] __devinitconst = 211static const char version[] __devinitconst =
212 KERN_INFO DRV_NAME ": ULi M5261/M5263 net driver, version " 212 "ULi M5261/M5263 net driver, version " DRV_VERSION " (" DRV_RELDATE ")";
213 DRV_VERSION " (" DRV_RELDATE ")\n";
214 213
215static int uli526x_debug; 214static int uli526x_debug;
216static unsigned char uli526x_media_mode = ULI526X_AUTO; 215static unsigned char uli526x_media_mode = ULI526X_AUTO;
@@ -283,7 +282,7 @@ static int __devinit uli526x_init_one (struct pci_dev *pdev,
283 ULI526X_DBUG(0, "uli526x_init_one()", 0); 282 ULI526X_DBUG(0, "uli526x_init_one()", 0);
284 283
285 if (!printed_version++) 284 if (!printed_version++)
286 printk(version); 285 pr_info("%s\n", version);
287 286
288 /* Init network device */ 287 /* Init network device */
289 dev = alloc_etherdev(sizeof(*db)); 288 dev = alloc_etherdev(sizeof(*db));
@@ -292,7 +291,7 @@ static int __devinit uli526x_init_one (struct pci_dev *pdev,
292 SET_NETDEV_DEV(dev, &pdev->dev); 291 SET_NETDEV_DEV(dev, &pdev->dev);
293 292
294 if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { 293 if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) {
295 pr_warning("32-bit PCI DMA not available\n"); 294 pr_warn("32-bit PCI DMA not available\n");
296 err = -ENODEV; 295 err = -ENODEV;
297 goto err_out_free; 296 goto err_out_free;
298 } 297 }
@@ -390,9 +389,9 @@ static int __devinit uli526x_init_one (struct pci_dev *pdev,
390 if (err) 389 if (err)
391 goto err_out_res; 390 goto err_out_res;
392 391
393 dev_info(&dev->dev, "ULi M%04lx at pci%s, %pM, irq %d\n", 392 netdev_info(dev, "ULi M%04lx at pci%s, %pM, irq %d\n",
394 ent->driver_data >> 16, pci_name(pdev), 393 ent->driver_data >> 16, pci_name(pdev),
395 dev->dev_addr, dev->irq); 394 dev->dev_addr, dev->irq);
396 395
397 pci_set_master(pdev); 396 pci_set_master(pdev);
398 397
@@ -524,7 +523,7 @@ static void uli526x_init(struct net_device *dev)
524 } 523 }
525 } 524 }
526 if(phy_tmp == 32) 525 if(phy_tmp == 32)
527 pr_warning("Can not find the phy address!!!"); 526 pr_warn("Can not find the phy address!!!\n");
528 /* Parser SROM and media mode */ 527 /* Parser SROM and media mode */
529 db->media_mode = uli526x_media_mode; 528 db->media_mode = uli526x_media_mode;
530 529
@@ -590,7 +589,7 @@ static netdev_tx_t uli526x_start_xmit(struct sk_buff *skb,
590 589
591 /* Too large packet check */ 590 /* Too large packet check */
592 if (skb->len > MAX_PACKET_SIZE) { 591 if (skb->len > MAX_PACKET_SIZE) {
593 pr_err("big packet = %d\n", (u16)skb->len); 592 netdev_err(dev, "big packet = %d\n", (u16)skb->len);
594 dev_kfree_skb(skb); 593 dev_kfree_skb(skb);
595 return NETDEV_TX_OK; 594 return NETDEV_TX_OK;
596 } 595 }
@@ -600,7 +599,7 @@ static netdev_tx_t uli526x_start_xmit(struct sk_buff *skb,
600 /* No Tx resource check, it never happen nromally */ 599 /* No Tx resource check, it never happen nromally */
601 if (db->tx_packet_cnt >= TX_FREE_DESC_CNT) { 600 if (db->tx_packet_cnt >= TX_FREE_DESC_CNT) {
602 spin_unlock_irqrestore(&db->lock, flags); 601 spin_unlock_irqrestore(&db->lock, flags);
603 pr_err("No Tx resource %ld\n", db->tx_packet_cnt); 602 netdev_err(dev, "No Tx resource %ld\n", db->tx_packet_cnt);
604 return NETDEV_TX_BUSY; 603 return NETDEV_TX_BUSY;
605 } 604 }
606 605
@@ -667,15 +666,6 @@ static int uli526x_stop(struct net_device *dev)
667 /* free allocated rx buffer */ 666 /* free allocated rx buffer */
668 uli526x_free_rxbuffer(db); 667 uli526x_free_rxbuffer(db);
669 668
670#if 0
671 /* show statistic counter */
672 printk(DRV_NAME ": FU:%lx EC:%lx LC:%lx NC:%lx LOC:%lx TXJT:%lx RESET:%lx RCR8:%lx FAL:%lx TT:%lx\n",
673 db->tx_fifo_underrun, db->tx_excessive_collision,
674 db->tx_late_collision, db->tx_no_carrier, db->tx_loss_carrier,
675 db->tx_jabber_timeout, db->reset_count, db->reset_cr8,
676 db->reset_fatal, db->reset_TXtimeout);
677#endif
678
679 return 0; 669 return 0;
680} 670}
681 671
@@ -755,7 +745,6 @@ static void uli526x_free_tx_pkt(struct net_device *dev,
755 txptr = db->tx_remove_ptr; 745 txptr = db->tx_remove_ptr;
756 while(db->tx_packet_cnt) { 746 while(db->tx_packet_cnt) {
757 tdes0 = le32_to_cpu(txptr->tdes0); 747 tdes0 = le32_to_cpu(txptr->tdes0);
758 /* printk(DRV_NAME ": tdes0=%x\n", tdes0); */
759 if (tdes0 & 0x80000000) 748 if (tdes0 & 0x80000000)
760 break; 749 break;
761 750
@@ -765,7 +754,6 @@ static void uli526x_free_tx_pkt(struct net_device *dev,
765 754
766 /* Transmit statistic counter */ 755 /* Transmit statistic counter */
767 if ( tdes0 != 0x7fffffff ) { 756 if ( tdes0 != 0x7fffffff ) {
768 /* printk(DRV_NAME ": tdes0=%x\n", tdes0); */
769 dev->stats.collisions += (tdes0 >> 3) & 0xf; 757 dev->stats.collisions += (tdes0 >> 3) & 0xf;
770 dev->stats.tx_bytes += le32_to_cpu(txptr->tdes1) & 0x7ff; 758 dev->stats.tx_bytes += le32_to_cpu(txptr->tdes1) & 0x7ff;
771 if (tdes0 & TDES0_ERR_MASK) { 759 if (tdes0 & TDES0_ERR_MASK) {
@@ -838,7 +826,6 @@ static void uli526x_rx_packet(struct net_device *dev, struct uli526x_board_info
838 /* error summary bit check */ 826 /* error summary bit check */
839 if (rdes0 & 0x8000) { 827 if (rdes0 & 0x8000) {
840 /* This is a error packet */ 828 /* This is a error packet */
841 //printk(DRV_NAME ": rdes0: %lx\n", rdes0);
842 dev->stats.rx_errors++; 829 dev->stats.rx_errors++;
843 if (rdes0 & 1) 830 if (rdes0 & 1)
844 dev->stats.rx_fifo_errors++; 831 dev->stats.rx_fifo_errors++;
@@ -945,12 +932,12 @@ ULi_ethtool_gset(struct uli526x_board_info *db, struct ethtool_cmd *ecmd)
945 932
946 ecmd->transceiver = XCVR_EXTERNAL; 933 ecmd->transceiver = XCVR_EXTERNAL;
947 934
948 ecmd->speed = 10; 935 ethtool_cmd_speed_set(ecmd, SPEED_10);
949 ecmd->duplex = DUPLEX_HALF; 936 ecmd->duplex = DUPLEX_HALF;
950 937
951 if(db->op_mode==ULI526X_100MHF || db->op_mode==ULI526X_100MFD) 938 if(db->op_mode==ULI526X_100MHF || db->op_mode==ULI526X_100MFD)
952 { 939 {
953 ecmd->speed = 100; 940 ethtool_cmd_speed_set(ecmd, SPEED_100);
954 } 941 }
955 if(db->op_mode==ULI526X_10MFD || db->op_mode==ULI526X_100MFD) 942 if(db->op_mode==ULI526X_10MFD || db->op_mode==ULI526X_100MFD)
956 { 943 {
@@ -958,7 +945,7 @@ ULi_ethtool_gset(struct uli526x_board_info *db, struct ethtool_cmd *ecmd)
958 } 945 }
959 if(db->link_failed) 946 if(db->link_failed)
960 { 947 {
961 ecmd->speed = -1; 948 ethtool_cmd_speed_set(ecmd, -1);
962 ecmd->duplex = -1; 949 ecmd->duplex = -1;
963 } 950 }
964 951
@@ -1024,7 +1011,6 @@ static void uli526x_timer(unsigned long data)
1024 struct net_device *dev = (struct net_device *) data; 1011 struct net_device *dev = (struct net_device *) data;
1025 struct uli526x_board_info *db = netdev_priv(dev); 1012 struct uli526x_board_info *db = netdev_priv(dev);
1026 unsigned long flags; 1013 unsigned long flags;
1027 u8 TmpSpeed=10;
1028 1014
1029 //ULI526X_DBUG(0, "uli526x_timer()", 0); 1015 //ULI526X_DBUG(0, "uli526x_timer()", 0);
1030 spin_lock_irqsave(&db->lock, flags); 1016 spin_lock_irqsave(&db->lock, flags);
@@ -1047,8 +1033,7 @@ static void uli526x_timer(unsigned long data)
1047 if ( time_after(jiffies, dev_trans_start(dev) + ULI526X_TX_TIMEOUT) ) { 1033 if ( time_after(jiffies, dev_trans_start(dev) + ULI526X_TX_TIMEOUT) ) {
1048 db->reset_TXtimeout++; 1034 db->reset_TXtimeout++;
1049 db->wait_reset = 1; 1035 db->wait_reset = 1;
1050 printk( "%s: Tx timeout - resetting\n", 1036 netdev_err(dev, " Tx timeout - resetting\n");
1051 dev->name);
1052 } 1037 }
1053 } 1038 }
1054 1039
@@ -1070,7 +1055,7 @@ static void uli526x_timer(unsigned long data)
1070 /* Link Failed */ 1055 /* Link Failed */
1071 ULI526X_DBUG(0, "Link Failed", tmp_cr12); 1056 ULI526X_DBUG(0, "Link Failed", tmp_cr12);
1072 netif_carrier_off(dev); 1057 netif_carrier_off(dev);
1073 pr_info("%s NIC Link is Down\n",dev->name); 1058 netdev_info(dev, "NIC Link is Down\n");
1074 db->link_failed = 1; 1059 db->link_failed = 1;
1075 1060
1076 /* For Force 10/100M Half/Full mode: Enable Auto-Nego mode */ 1061 /* For Force 10/100M Half/Full mode: Enable Auto-Nego mode */
@@ -1096,18 +1081,13 @@ static void uli526x_timer(unsigned long data)
1096 1081
1097 if(db->link_failed==0) 1082 if(db->link_failed==0)
1098 { 1083 {
1099 if(db->op_mode==ULI526X_100MHF || db->op_mode==ULI526X_100MFD) 1084 netdev_info(dev, "NIC Link is Up %d Mbps %s duplex\n",
1100 { 1085 (db->op_mode == ULI526X_100MHF ||
1101 TmpSpeed = 100; 1086 db->op_mode == ULI526X_100MFD)
1102 } 1087 ? 100 : 10,
1103 if(db->op_mode==ULI526X_10MFD || db->op_mode==ULI526X_100MFD) 1088 (db->op_mode == ULI526X_10MFD ||
1104 { 1089 db->op_mode == ULI526X_100MFD)
1105 pr_info("%s NIC Link is Up %d Mbps Full duplex\n",dev->name,TmpSpeed); 1090 ? "Full" : "Half");
1106 }
1107 else
1108 {
1109 pr_info("%s NIC Link is Up %d Mbps Half duplex\n",dev->name,TmpSpeed);
1110 }
1111 netif_carrier_on(dev); 1091 netif_carrier_on(dev);
1112 } 1092 }
1113 /* SHOW_MEDIA_TYPE(db->op_mode); */ 1093 /* SHOW_MEDIA_TYPE(db->op_mode); */
@@ -1116,7 +1096,7 @@ static void uli526x_timer(unsigned long data)
1116 { 1096 {
1117 if(db->init==1) 1097 if(db->init==1)
1118 { 1098 {
1119 pr_info("%s NIC Link is Down\n",dev->name); 1099 netdev_info(dev, "NIC Link is Down\n");
1120 netif_carrier_off(dev); 1100 netif_carrier_off(dev);
1121 } 1101 }
1122 } 1102 }
@@ -1242,7 +1222,7 @@ static int uli526x_resume(struct pci_dev *pdev)
1242 1222
1243 err = pci_set_power_state(pdev, PCI_D0); 1223 err = pci_set_power_state(pdev, PCI_D0);
1244 if (err) { 1224 if (err) {
1245 dev_warn(&dev->dev, "Could not put device into D0\n"); 1225 netdev_warn(dev, "Could not put device into D0\n");
1246 return err; 1226 return err;
1247 } 1227 }
1248 1228
@@ -1443,7 +1423,7 @@ static void send_filter_frame(struct net_device *dev, int mc_cnt)
1443 update_cr6(db->cr6_data, dev->base_addr); 1423 update_cr6(db->cr6_data, dev->base_addr);
1444 dev->trans_start = jiffies; 1424 dev->trans_start = jiffies;
1445 } else 1425 } else
1446 pr_err("No Tx resource - Send_filter_frame!\n"); 1426 netdev_err(dev, "No Tx resource - Send_filter_frame!\n");
1447} 1427}
1448 1428
1449 1429
@@ -1540,7 +1520,6 @@ static u8 uli526x_sense_speed(struct uli526x_board_info * db)
1540 else 1520 else
1541 phy_mode = 0x1000; 1521 phy_mode = 0x1000;
1542 1522
1543 /* printk(DRV_NAME ": Phy_mode %x ",phy_mode); */
1544 switch (phy_mode) { 1523 switch (phy_mode) {
1545 case 0x1000: db->op_mode = ULI526X_10MHF; break; 1524 case 0x1000: db->op_mode = ULI526X_10MHF; break;
1546 case 0x2000: db->op_mode = ULI526X_10MFD; break; 1525 case 0x2000: db->op_mode = ULI526X_10MFD; break;
@@ -1829,7 +1808,7 @@ MODULE_PARM_DESC(mode, "ULi M5261/M5263: Bit 0: 10/100Mbps, bit 2: duplex, bit 8
1829static int __init uli526x_init_module(void) 1808static int __init uli526x_init_module(void)
1830{ 1809{
1831 1810
1832 printk(version); 1811 pr_info("%s\n", version);
1833 printed_version = 1; 1812 printed_version = 1;
1834 1813
1835 ULI526X_DBUG(0, "init_module() ", debug); 1814 ULI526X_DBUG(0, "init_module() ", debug);
diff --git a/drivers/net/tulip/winbond-840.c b/drivers/net/tulip/winbond-840.c
index f0b231035dee..862eadf07191 100644
--- a/drivers/net/tulip/winbond-840.c
+++ b/drivers/net/tulip/winbond-840.c
@@ -44,6 +44,8 @@
44 * Wake-On-LAN 44 * Wake-On-LAN
45*/ 45*/
46 46
47#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
48
47#define DRV_NAME "winbond-840" 49#define DRV_NAME "winbond-840"
48#define DRV_VERSION "1.01-e" 50#define DRV_VERSION "1.01-e"
49#define DRV_RELDATE "Sep-11-2006" 51#define DRV_RELDATE "Sep-11-2006"
@@ -139,7 +141,7 @@ static int full_duplex[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
139 141
140/* These identify the driver base version and may not be removed. */ 142/* These identify the driver base version and may not be removed. */
141static const char version[] __initconst = 143static const char version[] __initconst =
142 KERN_INFO DRV_NAME ".c:v" DRV_VERSION " (2.4 port) " 144 "v" DRV_VERSION " (2.4 port) "
143 DRV_RELDATE " Donald Becker <becker@scyld.com>\n" 145 DRV_RELDATE " Donald Becker <becker@scyld.com>\n"
144 " http://www.scyld.com/network/drivers.html\n"; 146 " http://www.scyld.com/network/drivers.html\n";
145 147
@@ -375,8 +377,8 @@ static int __devinit w840_probe1 (struct pci_dev *pdev,
375 irq = pdev->irq; 377 irq = pdev->irq;
376 378
377 if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { 379 if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) {
378 pr_warning("Winbond-840: Device %s disabled due to DMA limitations\n", 380 pr_warn("Device %s disabled due to DMA limitations\n",
379 pci_name(pdev)); 381 pci_name(pdev));
380 return -EIO; 382 return -EIO;
381 } 383 }
382 dev = alloc_etherdev(sizeof(*np)); 384 dev = alloc_etherdev(sizeof(*np));
@@ -643,8 +645,7 @@ static int netdev_open(struct net_device *dev)
643 goto out_err; 645 goto out_err;
644 646
645 if (debug > 1) 647 if (debug > 1)
646 printk(KERN_DEBUG "%s: w89c840_open() irq %d\n", 648 netdev_dbg(dev, "w89c840_open() irq %d\n", dev->irq);
647 dev->name, dev->irq);
648 649
649 if((i=alloc_ringdesc(dev))) 650 if((i=alloc_ringdesc(dev)))
650 goto out_err; 651 goto out_err;
@@ -656,7 +657,7 @@ static int netdev_open(struct net_device *dev)
656 657
657 netif_start_queue(dev); 658 netif_start_queue(dev);
658 if (debug > 2) 659 if (debug > 2)
659 printk(KERN_DEBUG "%s: Done netdev_open()\n", dev->name); 660 netdev_dbg(dev, "Done netdev_open()\n");
660 661
661 /* Set the timer to check for link beat. */ 662 /* Set the timer to check for link beat. */
662 init_timer(&np->timer); 663 init_timer(&np->timer);
@@ -785,9 +786,9 @@ static void netdev_timer(unsigned long data)
785 void __iomem *ioaddr = np->base_addr; 786 void __iomem *ioaddr = np->base_addr;
786 787
787 if (debug > 2) 788 if (debug > 2)
788 printk(KERN_DEBUG "%s: Media selection timer tick, status %08x config %08x\n", 789 netdev_dbg(dev, "Media selection timer tick, status %08x config %08x\n",
789 dev->name, ioread32(ioaddr + IntrStatus), 790 ioread32(ioaddr + IntrStatus),
790 ioread32(ioaddr + NetworkConfig)); 791 ioread32(ioaddr + NetworkConfig));
791 spin_lock_irq(&np->lock); 792 spin_lock_irq(&np->lock);
792 update_csr6(dev, update_link(dev)); 793 update_csr6(dev, update_link(dev));
793 spin_unlock_irq(&np->lock); 794 spin_unlock_irq(&np->lock);
@@ -1054,8 +1055,8 @@ static netdev_tx_t start_tx(struct sk_buff *skb, struct net_device *dev)
1054 spin_unlock_irq(&np->lock); 1055 spin_unlock_irq(&np->lock);
1055 1056
1056 if (debug > 4) { 1057 if (debug > 4) {
1057 printk(KERN_DEBUG "%s: Transmit frame #%d queued in slot %d\n", 1058 netdev_dbg(dev, "Transmit frame #%d queued in slot %d\n",
1058 dev->name, np->cur_tx, entry); 1059 np->cur_tx, entry);
1059 } 1060 }
1060 return NETDEV_TX_OK; 1061 return NETDEV_TX_OK;
1061} 1062}
@@ -1072,8 +1073,8 @@ static void netdev_tx_done(struct net_device *dev)
1072 if (tx_status & 0x8000) { /* There was an error, log it. */ 1073 if (tx_status & 0x8000) { /* There was an error, log it. */
1073#ifndef final_version 1074#ifndef final_version
1074 if (debug > 1) 1075 if (debug > 1)
1075 printk(KERN_DEBUG "%s: Transmit error, Tx status %08x\n", 1076 netdev_dbg(dev, "Transmit error, Tx status %08x\n",
1076 dev->name, tx_status); 1077 tx_status);
1077#endif 1078#endif
1078 np->stats.tx_errors++; 1079 np->stats.tx_errors++;
1079 if (tx_status & 0x0104) np->stats.tx_aborted_errors++; 1080 if (tx_status & 0x0104) np->stats.tx_aborted_errors++;
@@ -1085,8 +1086,8 @@ static void netdev_tx_done(struct net_device *dev)
1085 } else { 1086 } else {
1086#ifndef final_version 1087#ifndef final_version
1087 if (debug > 3) 1088 if (debug > 3)
1088 printk(KERN_DEBUG "%s: Transmit slot %d ok, Tx status %08x\n", 1089 netdev_dbg(dev, "Transmit slot %d ok, Tx status %08x\n",
1089 dev->name, entry, tx_status); 1090 entry, tx_status);
1090#endif 1091#endif
1091 np->stats.tx_bytes += np->tx_skbuff[entry]->len; 1092 np->stats.tx_bytes += np->tx_skbuff[entry]->len;
1092 np->stats.collisions += (tx_status >> 3) & 15; 1093 np->stats.collisions += (tx_status >> 3) & 15;
@@ -1129,8 +1130,7 @@ static irqreturn_t intr_handler(int irq, void *dev_instance)
1129 iowrite32(intr_status & 0x001ffff, ioaddr + IntrStatus); 1130 iowrite32(intr_status & 0x001ffff, ioaddr + IntrStatus);
1130 1131
1131 if (debug > 4) 1132 if (debug > 4)
1132 printk(KERN_DEBUG "%s: Interrupt, status %04x\n", 1133 netdev_dbg(dev, "Interrupt, status %04x\n", intr_status);
1133 dev->name, intr_status);
1134 1134
1135 if ((intr_status & (NormalIntr|AbnormalIntr)) == 0) 1135 if ((intr_status & (NormalIntr|AbnormalIntr)) == 0)
1136 break; 1136 break;
@@ -1171,8 +1171,8 @@ static irqreturn_t intr_handler(int irq, void *dev_instance)
1171 } while (1); 1171 } while (1);
1172 1172
1173 if (debug > 3) 1173 if (debug > 3)
1174 printk(KERN_DEBUG "%s: exiting interrupt, status=%#4.4x\n", 1174 netdev_dbg(dev, "exiting interrupt, status=%#4.4x\n",
1175 dev->name, ioread32(ioaddr + IntrStatus)); 1175 ioread32(ioaddr + IntrStatus));
1176 return IRQ_RETVAL(handled); 1176 return IRQ_RETVAL(handled);
1177} 1177}
1178 1178
@@ -1185,8 +1185,8 @@ static int netdev_rx(struct net_device *dev)
1185 int work_limit = np->dirty_rx + RX_RING_SIZE - np->cur_rx; 1185 int work_limit = np->dirty_rx + RX_RING_SIZE - np->cur_rx;
1186 1186
1187 if (debug > 4) { 1187 if (debug > 4) {
1188 printk(KERN_DEBUG " In netdev_rx(), entry %d status %04x\n", 1188 netdev_dbg(dev, " In netdev_rx(), entry %d status %04x\n",
1189 entry, np->rx_ring[entry].status); 1189 entry, np->rx_ring[entry].status);
1190 } 1190 }
1191 1191
1192 /* If EOP is set on the next entry, it's a new packet. Send it up. */ 1192 /* If EOP is set on the next entry, it's a new packet. Send it up. */
@@ -1195,8 +1195,8 @@ static int netdev_rx(struct net_device *dev)
1195 s32 status = desc->status; 1195 s32 status = desc->status;
1196 1196
1197 if (debug > 4) 1197 if (debug > 4)
1198 printk(KERN_DEBUG " netdev_rx() status was %08x\n", 1198 netdev_dbg(dev, " netdev_rx() status was %08x\n",
1199 status); 1199 status);
1200 if (status < 0) 1200 if (status < 0)
1201 break; 1201 break;
1202 if ((status & 0x38008300) != 0x0300) { 1202 if ((status & 0x38008300) != 0x0300) {
@@ -1211,8 +1211,8 @@ static int netdev_rx(struct net_device *dev)
1211 } else if (status & 0x8000) { 1211 } else if (status & 0x8000) {
1212 /* There was a fatal error. */ 1212 /* There was a fatal error. */
1213 if (debug > 2) 1213 if (debug > 2)
1214 printk(KERN_DEBUG "%s: Receive error, Rx status %08x\n", 1214 netdev_dbg(dev, "Receive error, Rx status %08x\n",
1215 dev->name, status); 1215 status);
1216 np->stats.rx_errors++; /* end of a packet.*/ 1216 np->stats.rx_errors++; /* end of a packet.*/
1217 if (status & 0x0890) np->stats.rx_length_errors++; 1217 if (status & 0x0890) np->stats.rx_length_errors++;
1218 if (status & 0x004C) np->stats.rx_frame_errors++; 1218 if (status & 0x004C) np->stats.rx_frame_errors++;
@@ -1225,8 +1225,8 @@ static int netdev_rx(struct net_device *dev)
1225 1225
1226#ifndef final_version 1226#ifndef final_version
1227 if (debug > 4) 1227 if (debug > 4)
1228 printk(KERN_DEBUG " netdev_rx() normal Rx pkt length %d status %x\n", 1228 netdev_dbg(dev, " netdev_rx() normal Rx pkt length %d status %x\n",
1229 pkt_len, status); 1229 pkt_len, status);
1230#endif 1230#endif
1231 /* Check if the packet is long enough to accept without copying 1231 /* Check if the packet is long enough to accept without copying
1232 to a minimally-sized skbuff. */ 1232 to a minimally-sized skbuff. */
@@ -1251,10 +1251,10 @@ static int netdev_rx(struct net_device *dev)
1251#ifndef final_version /* Remove after testing. */ 1251#ifndef final_version /* Remove after testing. */
1252 /* You will want this info for the initial debug. */ 1252 /* You will want this info for the initial debug. */
1253 if (debug > 5) 1253 if (debug > 5)
1254 printk(KERN_DEBUG " Rx data %pM %pM %02x%02x %pI4\n", 1254 netdev_dbg(dev, " Rx data %pM %pM %02x%02x %pI4\n",
1255 &skb->data[0], &skb->data[6], 1255 &skb->data[0], &skb->data[6],
1256 skb->data[12], skb->data[13], 1256 skb->data[12], skb->data[13],
1257 &skb->data[14]); 1257 &skb->data[14]);
1258#endif 1258#endif
1259 skb->protocol = eth_type_trans(skb, dev); 1259 skb->protocol = eth_type_trans(skb, dev);
1260 netif_rx(skb); 1260 netif_rx(skb);
@@ -1292,8 +1292,7 @@ static void netdev_error(struct net_device *dev, int intr_status)
1292 void __iomem *ioaddr = np->base_addr; 1292 void __iomem *ioaddr = np->base_addr;
1293 1293
1294 if (debug > 2) 1294 if (debug > 2)
1295 printk(KERN_DEBUG "%s: Abnormal event, %08x\n", 1295 netdev_dbg(dev, "Abnormal event, %08x\n", intr_status);
1296 dev->name, intr_status);
1297 if (intr_status == 0xffffffff) 1296 if (intr_status == 0xffffffff)
1298 return; 1297 return;
1299 spin_lock(&np->lock); 1298 spin_lock(&np->lock);
@@ -1313,8 +1312,7 @@ static void netdev_error(struct net_device *dev, int intr_status)
1313 new = 127; /* load full packet before starting */ 1312 new = 127; /* load full packet before starting */
1314 new = (np->csr6 & ~(0x7F << 14)) | (new<<14); 1313 new = (np->csr6 & ~(0x7F << 14)) | (new<<14);
1315#endif 1314#endif
1316 printk(KERN_DEBUG "%s: Tx underflow, new csr6 %08x\n", 1315 netdev_dbg(dev, "Tx underflow, new csr6 %08x\n", new);
1317 dev->name, new);
1318 update_csr6(dev, new); 1316 update_csr6(dev, new);
1319 } 1317 }
1320 if (intr_status & RxDied) { /* Missed a Rx frame. */ 1318 if (intr_status & RxDied) { /* Missed a Rx frame. */
@@ -1487,13 +1485,12 @@ static int netdev_close(struct net_device *dev)
1487 netif_stop_queue(dev); 1485 netif_stop_queue(dev);
1488 1486
1489 if (debug > 1) { 1487 if (debug > 1) {
1490 printk(KERN_DEBUG "%s: Shutting down ethercard, status was %08x Config %08x\n", 1488 netdev_dbg(dev, "Shutting down ethercard, status was %08x Config %08x\n",
1491 dev->name, ioread32(ioaddr + IntrStatus), 1489 ioread32(ioaddr + IntrStatus),
1492 ioread32(ioaddr + NetworkConfig)); 1490 ioread32(ioaddr + NetworkConfig));
1493 printk(KERN_DEBUG "%s: Queue pointers were Tx %d / %d, Rx %d / %d\n", 1491 netdev_dbg(dev, "Queue pointers were Tx %d / %d, Rx %d / %d\n",
1494 dev->name, 1492 np->cur_tx, np->dirty_tx,
1495 np->cur_tx, np->dirty_tx, 1493 np->cur_rx, np->dirty_rx);
1496 np->cur_rx, np->dirty_rx);
1497 } 1494 }
1498 1495
1499 /* Stop the chip's Tx and Rx processes. */ 1496 /* Stop the chip's Tx and Rx processes. */
diff --git a/drivers/net/tulip/xircom_cb.c b/drivers/net/tulip/xircom_cb.c
index 5a73752be2ca..988b8eb24d37 100644
--- a/drivers/net/tulip/xircom_cb.c
+++ b/drivers/net/tulip/xircom_cb.c
@@ -37,15 +37,6 @@
37#include <asm/irq.h> 37#include <asm/irq.h>
38#endif 38#endif
39 39
40#ifdef DEBUG
41#define enter(x) printk("Enter: %s, %s line %i\n",x,__FILE__,__LINE__)
42#define leave(x) printk("Leave: %s, %s line %i\n",x,__FILE__,__LINE__)
43#else
44#define enter(x) do {} while (0)
45#define leave(x) do {} while (0)
46#endif
47
48
49MODULE_DESCRIPTION("Xircom Cardbus ethernet driver"); 40MODULE_DESCRIPTION("Xircom Cardbus ethernet driver");
50MODULE_AUTHOR("Arjan van de Ven <arjanv@redhat.com>"); 41MODULE_AUTHOR("Arjan van de Ven <arjanv@redhat.com>");
51MODULE_LICENSE("GPL"); 42MODULE_LICENSE("GPL");
@@ -161,7 +152,7 @@ static struct pci_driver xircom_ops = {
161}; 152};
162 153
163 154
164#ifdef DEBUG 155#if defined DEBUG && DEBUG > 1
165static void print_binary(unsigned int number) 156static void print_binary(unsigned int number)
166{ 157{
167 int i,i2; 158 int i,i2;
@@ -176,7 +167,7 @@ static void print_binary(unsigned int number)
176 if ((i&3)==0) 167 if ((i&3)==0)
177 buffer[i2++]=' '; 168 buffer[i2++]=' ';
178 } 169 }
179 printk("%s\n",buffer); 170 pr_debug("%s\n",buffer);
180} 171}
181#endif 172#endif
182 173
@@ -205,7 +196,6 @@ static int __devinit xircom_probe(struct pci_dev *pdev, const struct pci_device_
205 struct xircom_private *private; 196 struct xircom_private *private;
206 unsigned long flags; 197 unsigned long flags;
207 unsigned short tmp16; 198 unsigned short tmp16;
208 enter("xircom_probe");
209 199
210 /* First do the PCI initialisation */ 200 /* First do the PCI initialisation */
211 201
@@ -272,8 +262,8 @@ static int __devinit xircom_probe(struct pci_dev *pdev, const struct pci_device_
272 goto reg_fail; 262 goto reg_fail;
273 } 263 }
274 264
275 dev_info(&dev->dev, "Xircom cardbus revision %i at irq %i\n", 265 netdev_info(dev, "Xircom cardbus revision %i at irq %i\n",
276 pdev->revision, pdev->irq); 266 pdev->revision, pdev->irq);
277 /* start the transmitter to get a heartbeat */ 267 /* start the transmitter to get a heartbeat */
278 /* TODO: send 2 dummy packets here */ 268 /* TODO: send 2 dummy packets here */
279 transceiver_voodoo(private); 269 transceiver_voodoo(private);
@@ -285,7 +275,6 @@ static int __devinit xircom_probe(struct pci_dev *pdev, const struct pci_device_
285 275
286 trigger_receive(private); 276 trigger_receive(private);
287 277
288 leave("xircom_probe");
289 return 0; 278 return 0;
290 279
291reg_fail: 280reg_fail:
@@ -310,7 +299,6 @@ static void __devexit xircom_remove(struct pci_dev *pdev)
310 struct net_device *dev = pci_get_drvdata(pdev); 299 struct net_device *dev = pci_get_drvdata(pdev);
311 struct xircom_private *card = netdev_priv(dev); 300 struct xircom_private *card = netdev_priv(dev);
312 301
313 enter("xircom_remove");
314 pci_free_consistent(pdev,8192,card->rx_buffer,card->rx_dma_handle); 302 pci_free_consistent(pdev,8192,card->rx_buffer,card->rx_dma_handle);
315 pci_free_consistent(pdev,8192,card->tx_buffer,card->tx_dma_handle); 303 pci_free_consistent(pdev,8192,card->tx_buffer,card->tx_dma_handle);
316 304
@@ -318,7 +306,6 @@ static void __devexit xircom_remove(struct pci_dev *pdev)
318 unregister_netdev(dev); 306 unregister_netdev(dev);
319 free_netdev(dev); 307 free_netdev(dev);
320 pci_set_drvdata(pdev, NULL); 308 pci_set_drvdata(pdev, NULL);
321 leave("xircom_remove");
322} 309}
323 310
324static irqreturn_t xircom_interrupt(int irq, void *dev_instance) 311static irqreturn_t xircom_interrupt(int irq, void *dev_instance)
@@ -328,17 +315,15 @@ static irqreturn_t xircom_interrupt(int irq, void *dev_instance)
328 unsigned int status; 315 unsigned int status;
329 int i; 316 int i;
330 317
331 enter("xircom_interrupt\n");
332
333 spin_lock(&card->lock); 318 spin_lock(&card->lock);
334 status = inl(card->io_port+CSR5); 319 status = inl(card->io_port+CSR5);
335 320
336#ifdef DEBUG 321#if defined DEBUG && DEBUG > 1
337 print_binary(status); 322 print_binary(status);
338 printk("tx status 0x%08x 0x%08x\n", 323 pr_debug("tx status 0x%08x 0x%08x\n",
339 card->tx_buffer[0], card->tx_buffer[4]); 324 card->tx_buffer[0], card->tx_buffer[4]);
340 printk("rx status 0x%08x 0x%08x\n", 325 pr_debug("rx status 0x%08x 0x%08x\n",
341 card->rx_buffer[0], card->rx_buffer[4]); 326 card->rx_buffer[0], card->rx_buffer[4]);
342#endif 327#endif
343 /* Handle shared irq and hotplug */ 328 /* Handle shared irq and hotplug */
344 if (status == 0 || status == 0xffffffff) { 329 if (status == 0 || status == 0xffffffff) {
@@ -348,9 +333,9 @@ static irqreturn_t xircom_interrupt(int irq, void *dev_instance)
348 333
349 if (link_status_changed(card)) { 334 if (link_status_changed(card)) {
350 int newlink; 335 int newlink;
351 printk(KERN_DEBUG "xircom_cb: Link status has changed\n"); 336 netdev_dbg(dev, "Link status has changed\n");
352 newlink = link_status(card); 337 newlink = link_status(card);
353 dev_info(&dev->dev, "Link is %i mbit\n", newlink); 338 netdev_info(dev, "Link is %d mbit\n", newlink);
354 if (newlink) 339 if (newlink)
355 netif_carrier_on(dev); 340 netif_carrier_on(dev);
356 else 341 else
@@ -369,9 +354,7 @@ static irqreturn_t xircom_interrupt(int irq, void *dev_instance)
369 for (i=0;i<NUMDESCRIPTORS;i++) 354 for (i=0;i<NUMDESCRIPTORS;i++)
370 investigate_read_descriptor(dev,card,i,bufferoffsets[i]); 355 investigate_read_descriptor(dev,card,i,bufferoffsets[i]);
371 356
372
373 spin_unlock(&card->lock); 357 spin_unlock(&card->lock);
374 leave("xircom_interrupt");
375 return IRQ_HANDLED; 358 return IRQ_HANDLED;
376} 359}
377 360
@@ -382,7 +365,6 @@ static netdev_tx_t xircom_start_xmit(struct sk_buff *skb,
382 unsigned long flags; 365 unsigned long flags;
383 int nextdescriptor; 366 int nextdescriptor;
384 int desc; 367 int desc;
385 enter("xircom_start_xmit");
386 368
387 card = netdev_priv(dev); 369 card = netdev_priv(dev);
388 spin_lock_irqsave(&card->lock,flags); 370 spin_lock_irqsave(&card->lock,flags);
@@ -424,13 +406,10 @@ static netdev_tx_t xircom_start_xmit(struct sk_buff *skb,
424 netif_stop_queue(dev); 406 netif_stop_queue(dev);
425 } 407 }
426 card->transmit_used = nextdescriptor; 408 card->transmit_used = nextdescriptor;
427 leave("xircom-start_xmit - sent");
428 spin_unlock_irqrestore(&card->lock,flags); 409 spin_unlock_irqrestore(&card->lock,flags);
429 return NETDEV_TX_OK; 410 return NETDEV_TX_OK;
430 } 411 }
431 412
432
433
434 /* Uh oh... no free descriptor... drop the packet */ 413 /* Uh oh... no free descriptor... drop the packet */
435 netif_stop_queue(dev); 414 netif_stop_queue(dev);
436 spin_unlock_irqrestore(&card->lock,flags); 415 spin_unlock_irqrestore(&card->lock,flags);
@@ -446,18 +425,16 @@ static int xircom_open(struct net_device *dev)
446{ 425{
447 struct xircom_private *xp = netdev_priv(dev); 426 struct xircom_private *xp = netdev_priv(dev);
448 int retval; 427 int retval;
449 enter("xircom_open"); 428
450 pr_info("xircom cardbus adaptor found, registering as %s, using irq %i\n", 429 netdev_info(dev, "xircom cardbus adaptor found, using irq %i\n",
451 dev->name, dev->irq); 430 dev->irq);
452 retval = request_irq(dev->irq, xircom_interrupt, IRQF_SHARED, dev->name, dev); 431 retval = request_irq(dev->irq, xircom_interrupt, IRQF_SHARED, dev->name, dev);
453 if (retval) { 432 if (retval)
454 leave("xircom_open - No IRQ");
455 return retval; 433 return retval;
456 }
457 434
458 xircom_up(xp); 435 xircom_up(xp);
459 xp->open = 1; 436 xp->open = 1;
460 leave("xircom_open"); 437
461 return 0; 438 return 0;
462} 439}
463 440
@@ -466,7 +443,6 @@ static int xircom_close(struct net_device *dev)
466 struct xircom_private *card; 443 struct xircom_private *card;
467 unsigned long flags; 444 unsigned long flags;
468 445
469 enter("xircom_close");
470 card = netdev_priv(dev); 446 card = netdev_priv(dev);
471 netif_stop_queue(dev); /* we don't want new packets */ 447 netif_stop_queue(dev); /* we don't want new packets */
472 448
@@ -486,8 +462,6 @@ static int xircom_close(struct net_device *dev)
486 card->open = 0; 462 card->open = 0;
487 free_irq(dev->irq,dev); 463 free_irq(dev->irq,dev);
488 464
489 leave("xircom_close");
490
491 return 0; 465 return 0;
492 466
493} 467}
@@ -507,8 +481,6 @@ static void initialize_card(struct xircom_private *card)
507{ 481{
508 unsigned int val; 482 unsigned int val;
509 unsigned long flags; 483 unsigned long flags;
510 enter("initialize_card");
511
512 484
513 spin_lock_irqsave(&card->lock, flags); 485 spin_lock_irqsave(&card->lock, flags);
514 486
@@ -534,8 +506,6 @@ static void initialize_card(struct xircom_private *card)
534 deactivate_transmitter(card); 506 deactivate_transmitter(card);
535 507
536 spin_unlock_irqrestore(&card->lock, flags); 508 spin_unlock_irqrestore(&card->lock, flags);
537
538 leave("initialize_card");
539} 509}
540 510
541/* 511/*
@@ -547,12 +517,9 @@ ignored; I chose zero.
547static void trigger_transmit(struct xircom_private *card) 517static void trigger_transmit(struct xircom_private *card)
548{ 518{
549 unsigned int val; 519 unsigned int val;
550 enter("trigger_transmit");
551 520
552 val = 0; 521 val = 0;
553 outl(val, card->io_port + CSR1); 522 outl(val, card->io_port + CSR1);
554
555 leave("trigger_transmit");
556} 523}
557 524
558/* 525/*
@@ -565,12 +532,9 @@ ignored; I chose zero.
565static void trigger_receive(struct xircom_private *card) 532static void trigger_receive(struct xircom_private *card)
566{ 533{
567 unsigned int val; 534 unsigned int val;
568 enter("trigger_receive");
569 535
570 val = 0; 536 val = 0;
571 outl(val, card->io_port + CSR2); 537 outl(val, card->io_port + CSR2);
572
573 leave("trigger_receive");
574} 538}
575 539
576/* 540/*
@@ -581,8 +545,6 @@ static void setup_descriptors(struct xircom_private *card)
581{ 545{
582 u32 address; 546 u32 address;
583 int i; 547 int i;
584 enter("setup_descriptors");
585
586 548
587 BUG_ON(card->rx_buffer == NULL); 549 BUG_ON(card->rx_buffer == NULL);
588 BUG_ON(card->tx_buffer == NULL); 550 BUG_ON(card->tx_buffer == NULL);
@@ -636,8 +598,6 @@ static void setup_descriptors(struct xircom_private *card)
636 /* wite the transmit descriptor ring to the card */ 598 /* wite the transmit descriptor ring to the card */
637 address = card->tx_dma_handle; 599 address = card->tx_dma_handle;
638 outl(address, card->io_port + CSR4); /* xmit descr list address */ 600 outl(address, card->io_port + CSR4); /* xmit descr list address */
639
640 leave("setup_descriptors");
641} 601}
642 602
643/* 603/*
@@ -647,13 +607,10 @@ valid by setting the address in the card to 0x00.
647static void remove_descriptors(struct xircom_private *card) 607static void remove_descriptors(struct xircom_private *card)
648{ 608{
649 unsigned int val; 609 unsigned int val;
650 enter("remove_descriptors");
651 610
652 val = 0; 611 val = 0;
653 outl(val, card->io_port + CSR3); /* Receive descriptor address */ 612 outl(val, card->io_port + CSR3); /* Receive descriptor address */
654 outl(val, card->io_port + CSR4); /* Send descriptor address */ 613 outl(val, card->io_port + CSR4); /* Send descriptor address */
655
656 leave("remove_descriptors");
657} 614}
658 615
659/* 616/*
@@ -665,21 +622,17 @@ This function also clears the status-bit.
665static int link_status_changed(struct xircom_private *card) 622static int link_status_changed(struct xircom_private *card)
666{ 623{
667 unsigned int val; 624 unsigned int val;
668 enter("link_status_changed");
669 625
670 val = inl(card->io_port + CSR5); /* Status register */ 626 val = inl(card->io_port + CSR5); /* Status register */
671 627
672 if ((val & (1 << 27)) == 0) { /* no change */ 628 if ((val & (1 << 27)) == 0) /* no change */
673 leave("link_status_changed - nochange");
674 return 0; 629 return 0;
675 }
676 630
677 /* clear the event by writing a 1 to the bit in the 631 /* clear the event by writing a 1 to the bit in the
678 status register. */ 632 status register. */
679 val = (1 << 27); 633 val = (1 << 27);
680 outl(val, card->io_port + CSR5); 634 outl(val, card->io_port + CSR5);
681 635
682 leave("link_status_changed - changed");
683 return 1; 636 return 1;
684} 637}
685 638
@@ -691,16 +644,12 @@ in a non-stopped state.
691static int transmit_active(struct xircom_private *card) 644static int transmit_active(struct xircom_private *card)
692{ 645{
693 unsigned int val; 646 unsigned int val;
694 enter("transmit_active");
695 647
696 val = inl(card->io_port + CSR5); /* Status register */ 648 val = inl(card->io_port + CSR5); /* Status register */
697 649
698 if ((val & (7 << 20)) == 0) { /* transmitter disabled */ 650 if ((val & (7 << 20)) == 0) /* transmitter disabled */
699 leave("transmit_active - inactive");
700 return 0; 651 return 0;
701 }
702 652
703 leave("transmit_active - active");
704 return 1; 653 return 1;
705} 654}
706 655
@@ -711,17 +660,12 @@ in a non-stopped state.
711static int receive_active(struct xircom_private *card) 660static int receive_active(struct xircom_private *card)
712{ 661{
713 unsigned int val; 662 unsigned int val;
714 enter("receive_active");
715
716 663
717 val = inl(card->io_port + CSR5); /* Status register */ 664 val = inl(card->io_port + CSR5); /* Status register */
718 665
719 if ((val & (7 << 17)) == 0) { /* receiver disabled */ 666 if ((val & (7 << 17)) == 0) /* receiver disabled */
720 leave("receive_active - inactive");
721 return 0; 667 return 0;
722 }
723 668
724 leave("receive_active - active");
725 return 1; 669 return 1;
726} 670}
727 671
@@ -739,8 +683,6 @@ static void activate_receiver(struct xircom_private *card)
739{ 683{
740 unsigned int val; 684 unsigned int val;
741 int counter; 685 int counter;
742 enter("activate_receiver");
743
744 686
745 val = inl(card->io_port + CSR6); /* Operation mode */ 687 val = inl(card->io_port + CSR6); /* Operation mode */
746 688
@@ -761,7 +703,7 @@ static void activate_receiver(struct xircom_private *card)
761 udelay(50); 703 udelay(50);
762 counter--; 704 counter--;
763 if (counter <= 0) 705 if (counter <= 0)
764 pr_err("Receiver failed to deactivate\n"); 706 netdev_err(card->dev, "Receiver failed to deactivate\n");
765 } 707 }
766 708
767 /* enable the receiver */ 709 /* enable the receiver */
@@ -778,10 +720,9 @@ static void activate_receiver(struct xircom_private *card)
778 udelay(50); 720 udelay(50);
779 counter--; 721 counter--;
780 if (counter <= 0) 722 if (counter <= 0)
781 pr_err("Receiver failed to re-activate\n"); 723 netdev_err(card->dev,
724 "Receiver failed to re-activate\n");
782 } 725 }
783
784 leave("activate_receiver");
785} 726}
786 727
787/* 728/*
@@ -795,7 +736,6 @@ static void deactivate_receiver(struct xircom_private *card)
795{ 736{
796 unsigned int val; 737 unsigned int val;
797 int counter; 738 int counter;
798 enter("deactivate_receiver");
799 739
800 val = inl(card->io_port + CSR6); /* Operation mode */ 740 val = inl(card->io_port + CSR6); /* Operation mode */
801 val = val & ~2; /* disable the receiver */ 741 val = val & ~2; /* disable the receiver */
@@ -809,11 +749,8 @@ static void deactivate_receiver(struct xircom_private *card)
809 udelay(50); 749 udelay(50);
810 counter--; 750 counter--;
811 if (counter <= 0) 751 if (counter <= 0)
812 pr_err("Receiver failed to deactivate\n"); 752 netdev_err(card->dev, "Receiver failed to deactivate\n");
813 } 753 }
814
815
816 leave("deactivate_receiver");
817} 754}
818 755
819 756
@@ -831,8 +768,6 @@ static void activate_transmitter(struct xircom_private *card)
831{ 768{
832 unsigned int val; 769 unsigned int val;
833 int counter; 770 int counter;
834 enter("activate_transmitter");
835
836 771
837 val = inl(card->io_port + CSR6); /* Operation mode */ 772 val = inl(card->io_port + CSR6); /* Operation mode */
838 773
@@ -852,7 +787,8 @@ static void activate_transmitter(struct xircom_private *card)
852 udelay(50); 787 udelay(50);
853 counter--; 788 counter--;
854 if (counter <= 0) 789 if (counter <= 0)
855 pr_err("Transmitter failed to deactivate\n"); 790 netdev_err(card->dev,
791 "Transmitter failed to deactivate\n");
856 } 792 }
857 793
858 /* enable the transmitter */ 794 /* enable the transmitter */
@@ -869,10 +805,9 @@ static void activate_transmitter(struct xircom_private *card)
869 udelay(50); 805 udelay(50);
870 counter--; 806 counter--;
871 if (counter <= 0) 807 if (counter <= 0)
872 pr_err("Transmitter failed to re-activate\n"); 808 netdev_err(card->dev,
809 "Transmitter failed to re-activate\n");
873 } 810 }
874
875 leave("activate_transmitter");
876} 811}
877 812
878/* 813/*
@@ -886,7 +821,6 @@ static void deactivate_transmitter(struct xircom_private *card)
886{ 821{
887 unsigned int val; 822 unsigned int val;
888 int counter; 823 int counter;
889 enter("deactivate_transmitter");
890 824
891 val = inl(card->io_port + CSR6); /* Operation mode */ 825 val = inl(card->io_port + CSR6); /* Operation mode */
892 val = val & ~2; /* disable the transmitter */ 826 val = val & ~2; /* disable the transmitter */
@@ -900,11 +834,9 @@ static void deactivate_transmitter(struct xircom_private *card)
900 udelay(50); 834 udelay(50);
901 counter--; 835 counter--;
902 if (counter <= 0) 836 if (counter <= 0)
903 pr_err("Transmitter failed to deactivate\n"); 837 netdev_err(card->dev,
838 "Transmitter failed to deactivate\n");
904 } 839 }
905
906
907 leave("deactivate_transmitter");
908} 840}
909 841
910 842
@@ -916,13 +848,10 @@ must be called with the lock held and interrupts disabled.
916static void enable_transmit_interrupt(struct xircom_private *card) 848static void enable_transmit_interrupt(struct xircom_private *card)
917{ 849{
918 unsigned int val; 850 unsigned int val;
919 enter("enable_transmit_interrupt");
920 851
921 val = inl(card->io_port + CSR7); /* Interrupt enable register */ 852 val = inl(card->io_port + CSR7); /* Interrupt enable register */
922 val |= 1; /* enable the transmit interrupt */ 853 val |= 1; /* enable the transmit interrupt */
923 outl(val, card->io_port + CSR7); 854 outl(val, card->io_port + CSR7);
924
925 leave("enable_transmit_interrupt");
926} 855}
927 856
928 857
@@ -934,13 +863,10 @@ must be called with the lock held and interrupts disabled.
934static void enable_receive_interrupt(struct xircom_private *card) 863static void enable_receive_interrupt(struct xircom_private *card)
935{ 864{
936 unsigned int val; 865 unsigned int val;
937 enter("enable_receive_interrupt");
938 866
939 val = inl(card->io_port + CSR7); /* Interrupt enable register */ 867 val = inl(card->io_port + CSR7); /* Interrupt enable register */
940 val = val | (1 << 6); /* enable the receive interrupt */ 868 val = val | (1 << 6); /* enable the receive interrupt */
941 outl(val, card->io_port + CSR7); 869 outl(val, card->io_port + CSR7);
942
943 leave("enable_receive_interrupt");
944} 870}
945 871
946/* 872/*
@@ -951,13 +877,10 @@ must be called with the lock held and interrupts disabled.
951static void enable_link_interrupt(struct xircom_private *card) 877static void enable_link_interrupt(struct xircom_private *card)
952{ 878{
953 unsigned int val; 879 unsigned int val;
954 enter("enable_link_interrupt");
955 880
956 val = inl(card->io_port + CSR7); /* Interrupt enable register */ 881 val = inl(card->io_port + CSR7); /* Interrupt enable register */
957 val = val | (1 << 27); /* enable the link status chage interrupt */ 882 val = val | (1 << 27); /* enable the link status chage interrupt */
958 outl(val, card->io_port + CSR7); 883 outl(val, card->io_port + CSR7);
959
960 leave("enable_link_interrupt");
961} 884}
962 885
963 886
@@ -970,12 +893,9 @@ must be called with the lock held and interrupts disabled.
970static void disable_all_interrupts(struct xircom_private *card) 893static void disable_all_interrupts(struct xircom_private *card)
971{ 894{
972 unsigned int val; 895 unsigned int val;
973 enter("enable_all_interrupts");
974 896
975 val = 0; /* disable all interrupts */ 897 val = 0; /* disable all interrupts */
976 outl(val, card->io_port + CSR7); 898 outl(val, card->io_port + CSR7);
977
978 leave("disable_all_interrupts");
979} 899}
980 900
981/* 901/*
@@ -986,7 +906,6 @@ must be called with the lock held and interrupts disabled.
986static void enable_common_interrupts(struct xircom_private *card) 906static void enable_common_interrupts(struct xircom_private *card)
987{ 907{
988 unsigned int val; 908 unsigned int val;
989 enter("enable_link_interrupt");
990 909
991 val = inl(card->io_port + CSR7); /* Interrupt enable register */ 910 val = inl(card->io_port + CSR7); /* Interrupt enable register */
992 val |= (1<<16); /* Normal Interrupt Summary */ 911 val |= (1<<16); /* Normal Interrupt Summary */
@@ -998,8 +917,6 @@ static void enable_common_interrupts(struct xircom_private *card)
998 val |= (1<<2); /* Transmit Buffer Unavailable */ 917 val |= (1<<2); /* Transmit Buffer Unavailable */
999 val |= (1<<1); /* Transmit Process Stopped */ 918 val |= (1<<1); /* Transmit Process Stopped */
1000 outl(val, card->io_port + CSR7); 919 outl(val, card->io_port + CSR7);
1001
1002 leave("enable_link_interrupt");
1003} 920}
1004 921
1005/* 922/*
@@ -1010,13 +927,11 @@ must be called with the lock held and interrupts disabled.
1010static int enable_promisc(struct xircom_private *card) 927static int enable_promisc(struct xircom_private *card)
1011{ 928{
1012 unsigned int val; 929 unsigned int val;
1013 enter("enable_promisc");
1014 930
1015 val = inl(card->io_port + CSR6); 931 val = inl(card->io_port + CSR6);
1016 val = val | (1 << 6); 932 val = val | (1 << 6);
1017 outl(val, card->io_port + CSR6); 933 outl(val, card->io_port + CSR6);
1018 934
1019 leave("enable_promisc");
1020 return 1; 935 return 1;
1021} 936}
1022 937
@@ -1031,7 +946,6 @@ Must be called in locked state with interrupts disabled
1031static int link_status(struct xircom_private *card) 946static int link_status(struct xircom_private *card)
1032{ 947{
1033 unsigned int val; 948 unsigned int val;
1034 enter("link_status");
1035 949
1036 val = inb(card->io_port + CSR12); 950 val = inb(card->io_port + CSR12);
1037 951
@@ -1042,7 +956,6 @@ static int link_status(struct xircom_private *card)
1042 956
1043 /* If we get here -> no link at all */ 957 /* If we get here -> no link at all */
1044 958
1045 leave("link_status");
1046 return 0; 959 return 0;
1047} 960}
1048 961
@@ -1061,8 +974,6 @@ static void read_mac_address(struct xircom_private *card)
1061 unsigned long flags; 974 unsigned long flags;
1062 int i; 975 int i;
1063 976
1064 enter("read_mac_address");
1065
1066 spin_lock_irqsave(&card->lock, flags); 977 spin_lock_irqsave(&card->lock, flags);
1067 978
1068 outl(1 << 12, card->io_port + CSR9); /* enable boot rom access */ 979 outl(1 << 12, card->io_port + CSR9); /* enable boot rom access */
@@ -1090,7 +1001,6 @@ static void read_mac_address(struct xircom_private *card)
1090 } 1001 }
1091 spin_unlock_irqrestore(&card->lock, flags); 1002 spin_unlock_irqrestore(&card->lock, flags);
1092 pr_debug(" %pM\n", card->dev->dev_addr); 1003 pr_debug(" %pM\n", card->dev->dev_addr);
1093 leave("read_mac_address");
1094} 1004}
1095 1005
1096 1006
@@ -1103,8 +1013,6 @@ static void transceiver_voodoo(struct xircom_private *card)
1103{ 1013{
1104 unsigned long flags; 1014 unsigned long flags;
1105 1015
1106 enter("transceiver_voodoo");
1107
1108 /* disable all powermanagement */ 1016 /* disable all powermanagement */
1109 pci_write_config_dword(card->pdev, PCI_POWERMGMT, 0x0000); 1017 pci_write_config_dword(card->pdev, PCI_POWERMGMT, 0x0000);
1110 1018
@@ -1122,7 +1030,6 @@ static void transceiver_voodoo(struct xircom_private *card)
1122 spin_unlock_irqrestore(&card->lock, flags); 1030 spin_unlock_irqrestore(&card->lock, flags);
1123 1031
1124 netif_start_queue(card->dev); 1032 netif_start_queue(card->dev);
1125 leave("transceiver_voodoo");
1126} 1033}
1127 1034
1128 1035
@@ -1131,8 +1038,6 @@ static void xircom_up(struct xircom_private *card)
1131 unsigned long flags; 1038 unsigned long flags;
1132 int i; 1039 int i;
1133 1040
1134 enter("xircom_up");
1135
1136 /* disable all powermanagement */ 1041 /* disable all powermanagement */
1137 pci_write_config_dword(card->pdev, PCI_POWERMGMT, 0x0000); 1042 pci_write_config_dword(card->pdev, PCI_POWERMGMT, 0x0000);
1138 1043
@@ -1156,87 +1061,84 @@ static void xircom_up(struct xircom_private *card)
1156 trigger_receive(card); 1061 trigger_receive(card);
1157 trigger_transmit(card); 1062 trigger_transmit(card);
1158 netif_start_queue(card->dev); 1063 netif_start_queue(card->dev);
1159 leave("xircom_up");
1160} 1064}
1161 1065
1162/* Bufferoffset is in BYTES */ 1066/* Bufferoffset is in BYTES */
1163static void investigate_read_descriptor(struct net_device *dev,struct xircom_private *card, int descnr, unsigned int bufferoffset) 1067static void
1068investigate_read_descriptor(struct net_device *dev, struct xircom_private *card,
1069 int descnr, unsigned int bufferoffset)
1164{ 1070{
1165 int status; 1071 int status;
1166
1167 enter("investigate_read_descriptor");
1168 status = le32_to_cpu(card->rx_buffer[4*descnr]);
1169 1072
1170 if ((status > 0)) { /* packet received */ 1073 status = le32_to_cpu(card->rx_buffer[4*descnr]);
1171 1074
1172 /* TODO: discard error packets */ 1075 if (status > 0) { /* packet received */
1173 1076
1174 short pkt_len = ((status >> 16) & 0x7ff) - 4; /* minus 4, we don't want the CRC */ 1077 /* TODO: discard error packets */
1175 struct sk_buff *skb;
1176 1078
1177 if (pkt_len > 1518) { 1079 short pkt_len = ((status >> 16) & 0x7ff) - 4;
1178 pr_err("Packet length %i is bogus\n", pkt_len); 1080 /* minus 4, we don't want the CRC */
1179 pkt_len = 1518; 1081 struct sk_buff *skb;
1180 }
1181 1082
1182 skb = dev_alloc_skb(pkt_len + 2); 1083 if (pkt_len > 1518) {
1183 if (skb == NULL) { 1084 netdev_err(dev, "Packet length %i is bogus\n", pkt_len);
1184 dev->stats.rx_dropped++; 1085 pkt_len = 1518;
1185 goto out;
1186 }
1187 skb_reserve(skb, 2);
1188 skb_copy_to_linear_data(skb, (unsigned char*)&card->rx_buffer[bufferoffset / 4], pkt_len);
1189 skb_put(skb, pkt_len);
1190 skb->protocol = eth_type_trans(skb, dev);
1191 netif_rx(skb);
1192 dev->stats.rx_packets++;
1193 dev->stats.rx_bytes += pkt_len;
1194
1195 out:
1196 /* give the buffer back to the card */
1197 card->rx_buffer[4*descnr] = cpu_to_le32(0x80000000);
1198 trigger_receive(card);
1199 } 1086 }
1200 1087
1201 leave("investigate_read_descriptor"); 1088 skb = dev_alloc_skb(pkt_len + 2);
1202 1089 if (skb == NULL) {
1090 dev->stats.rx_dropped++;
1091 goto out;
1092 }
1093 skb_reserve(skb, 2);
1094 skb_copy_to_linear_data(skb,
1095 &card->rx_buffer[bufferoffset / 4],
1096 pkt_len);
1097 skb_put(skb, pkt_len);
1098 skb->protocol = eth_type_trans(skb, dev);
1099 netif_rx(skb);
1100 dev->stats.rx_packets++;
1101 dev->stats.rx_bytes += pkt_len;
1102
1103out:
1104 /* give the buffer back to the card */
1105 card->rx_buffer[4*descnr] = cpu_to_le32(0x80000000);
1106 trigger_receive(card);
1107 }
1203} 1108}
1204 1109
1205 1110
1206/* Bufferoffset is in BYTES */ 1111/* Bufferoffset is in BYTES */
1207static void investigate_write_descriptor(struct net_device *dev, struct xircom_private *card, int descnr, unsigned int bufferoffset) 1112static void
1113investigate_write_descriptor(struct net_device *dev,
1114 struct xircom_private *card,
1115 int descnr, unsigned int bufferoffset)
1208{ 1116{
1209 int status; 1117 int status;
1210
1211 enter("investigate_write_descriptor");
1212 1118
1213 status = le32_to_cpu(card->tx_buffer[4*descnr]); 1119 status = le32_to_cpu(card->tx_buffer[4*descnr]);
1214#if 0 1120#if 0
1215 if (status & 0x8000) { /* Major error */ 1121 if (status & 0x8000) { /* Major error */
1216 pr_err("Major transmit error status %x\n", status); 1122 pr_err("Major transmit error status %x\n", status);
1217 card->tx_buffer[4*descnr] = 0; 1123 card->tx_buffer[4*descnr] = 0;
1218 netif_wake_queue (dev); 1124 netif_wake_queue (dev);
1219 } 1125 }
1220#endif 1126#endif
1221 if (status > 0) { /* bit 31 is 0 when done */ 1127 if (status > 0) { /* bit 31 is 0 when done */
1222 if (card->tx_skb[descnr]!=NULL) { 1128 if (card->tx_skb[descnr]!=NULL) {
1223 dev->stats.tx_bytes += card->tx_skb[descnr]->len; 1129 dev->stats.tx_bytes += card->tx_skb[descnr]->len;
1224 dev_kfree_skb_irq(card->tx_skb[descnr]); 1130 dev_kfree_skb_irq(card->tx_skb[descnr]);
1225 }
1226 card->tx_skb[descnr] = NULL;
1227 /* Bit 8 in the status field is 1 if there was a collision */
1228 if (status&(1<<8))
1229 dev->stats.collisions++;
1230 card->tx_buffer[4*descnr] = 0; /* descriptor is free again */
1231 netif_wake_queue (dev);
1232 dev->stats.tx_packets++;
1233 } 1131 }
1234 1132 card->tx_skb[descnr] = NULL;
1235 leave("investigate_write_descriptor"); 1133 /* Bit 8 in the status field is 1 if there was a collision */
1236 1134 if (status & (1 << 8))
1135 dev->stats.collisions++;
1136 card->tx_buffer[4*descnr] = 0; /* descriptor is free again */
1137 netif_wake_queue (dev);
1138 dev->stats.tx_packets++;
1139 }
1237} 1140}
1238 1141
1239
1240static int __init xircom_init(void) 1142static int __init xircom_init(void)
1241{ 1143{
1242 return pci_register_driver(&xircom_ops); 1144 return pci_register_driver(&xircom_ops);