aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tulip
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/tulip')
-rw-r--r--drivers/net/tulip/21142.c84
-rw-r--r--drivers/net/tulip/Kconfig4
-rw-r--r--drivers/net/tulip/de2104x.c170
-rw-r--r--drivers/net/tulip/de4x5.c18
-rw-r--r--drivers/net/tulip/dmfe.c123
-rw-r--r--drivers/net/tulip/eeprom.c62
-rw-r--r--drivers/net/tulip/interrupt.c116
-rw-r--r--drivers/net/tulip/media.c78
-rw-r--r--drivers/net/tulip/pnic.c33
-rw-r--r--drivers/net/tulip/pnic2.c65
-rw-r--r--drivers/net/tulip/timer.c52
-rw-r--r--drivers/net/tulip/tulip_core.c239
-rw-r--r--drivers/net/tulip/uli526x.c75
-rw-r--r--drivers/net/tulip/winbond-840.c195
-rw-r--r--drivers/net/tulip/xircom_cb.c48
15 files changed, 714 insertions, 648 deletions
diff --git a/drivers/net/tulip/21142.c b/drivers/net/tulip/21142.c
index db7d5e11855d..007d8e75666d 100644
--- a/drivers/net/tulip/21142.c
+++ b/drivers/net/tulip/21142.c
@@ -43,8 +43,8 @@ void t21142_media_task(struct work_struct *work)
43 if ((csr14 & 0x80) && (csr12 & 0x7000) != 0x5000) 43 if ((csr14 & 0x80) && (csr12 & 0x7000) != 0x5000)
44 csr12 |= 6; 44 csr12 |= 6;
45 if (tulip_debug > 2) 45 if (tulip_debug > 2)
46 printk(KERN_INFO"%s: 21143 negotiation status %8.8x, %s.\n", 46 dev_info(&dev->dev, "21143 negotiation status %08x, %s\n",
47 dev->name, csr12, medianame[dev->if_port]); 47 csr12, medianame[dev->if_port]);
48 if (tulip_media_cap[dev->if_port] & MediaIsMII) { 48 if (tulip_media_cap[dev->if_port] & MediaIsMII) {
49 if (tulip_check_duplex(dev) < 0) { 49 if (tulip_check_duplex(dev) < 0) {
50 netif_carrier_off(dev); 50 netif_carrier_off(dev);
@@ -56,23 +56,26 @@ void t21142_media_task(struct work_struct *work)
56 } else if (tp->nwayset) { 56 } else if (tp->nwayset) {
57 /* Don't screw up a negotiated session! */ 57 /* Don't screw up a negotiated session! */
58 if (tulip_debug > 1) 58 if (tulip_debug > 1)
59 printk(KERN_INFO"%s: Using NWay-set %s media, csr12 %8.8x.\n", 59 dev_info(&dev->dev,
60 dev->name, medianame[dev->if_port], csr12); 60 "Using NWay-set %s media, csr12 %08x\n",
61 medianame[dev->if_port], csr12);
61 } else if (tp->medialock) { 62 } else if (tp->medialock) {
62 ; 63 ;
63 } else if (dev->if_port == 3) { 64 } else if (dev->if_port == 3) {
64 if (csr12 & 2) { /* No 100mbps link beat, revert to 10mbps. */ 65 if (csr12 & 2) { /* No 100mbps link beat, revert to 10mbps. */
65 if (tulip_debug > 1) 66 if (tulip_debug > 1)
66 printk(KERN_INFO"%s: No 21143 100baseTx link beat, %8.8x, " 67 dev_info(&dev->dev,
67 "trying NWay.\n", dev->name, csr12); 68 "No 21143 100baseTx link beat, %08x, trying NWay\n",
69 csr12);
68 t21142_start_nway(dev); 70 t21142_start_nway(dev);
69 next_tick = 3*HZ; 71 next_tick = 3*HZ;
70 } 72 }
71 } else if ((csr12 & 0x7000) != 0x5000) { 73 } else if ((csr12 & 0x7000) != 0x5000) {
72 /* Negotiation failed. Search media types. */ 74 /* Negotiation failed. Search media types. */
73 if (tulip_debug > 1) 75 if (tulip_debug > 1)
74 printk(KERN_INFO"%s: 21143 negotiation failed, status %8.8x.\n", 76 dev_info(&dev->dev,
75 dev->name, csr12); 77 "21143 negotiation failed, status %08x\n",
78 csr12);
76 if (!(csr12 & 4)) { /* 10mbps link beat good. */ 79 if (!(csr12 & 4)) { /* 10mbps link beat good. */
77 new_csr6 = 0x82420000; 80 new_csr6 = 0x82420000;
78 dev->if_port = 0; 81 dev->if_port = 0;
@@ -90,8 +93,8 @@ void t21142_media_task(struct work_struct *work)
90 iowrite32(1, ioaddr + CSR13); 93 iowrite32(1, ioaddr + CSR13);
91 } 94 }
92 if (tulip_debug > 1) 95 if (tulip_debug > 1)
93 printk(KERN_INFO"%s: Testing new 21143 media %s.\n", 96 dev_info(&dev->dev, "Testing new 21143 media %s\n",
94 dev->name, medianame[dev->if_port]); 97 medianame[dev->if_port]);
95 if (new_csr6 != (tp->csr6 & ~0x00D5)) { 98 if (new_csr6 != (tp->csr6 & ~0x00D5)) {
96 tp->csr6 &= 0x00D5; 99 tp->csr6 &= 0x00D5;
97 tp->csr6 |= new_csr6; 100 tp->csr6 |= new_csr6;
@@ -119,8 +122,8 @@ void t21142_start_nway(struct net_device *dev)
119 tp->nway = tp->mediasense = 1; 122 tp->nway = tp->mediasense = 1;
120 tp->nwayset = tp->lpar = 0; 123 tp->nwayset = tp->lpar = 0;
121 if (tulip_debug > 1) 124 if (tulip_debug > 1)
122 printk(KERN_DEBUG "%s: Restarting 21143 autonegotiation, csr14=%8.8x.\n", 125 printk(KERN_DEBUG "%s: Restarting 21143 autonegotiation, csr14=%08x\n",
123 dev->name, csr14); 126 dev->name, csr14);
124 iowrite32(0x0001, ioaddr + CSR13); 127 iowrite32(0x0001, ioaddr + CSR13);
125 udelay(100); 128 udelay(100);
126 iowrite32(csr14, ioaddr + CSR14); 129 iowrite32(csr14, ioaddr + CSR14);
@@ -147,8 +150,9 @@ void t21142_lnk_change(struct net_device *dev, int csr5)
147 if ((csr14 & 0x80) && (csr12 & 0x7000) != 0x5000) 150 if ((csr14 & 0x80) && (csr12 & 0x7000) != 0x5000)
148 csr12 |= 6; 151 csr12 |= 6;
149 if (tulip_debug > 1) 152 if (tulip_debug > 1)
150 printk(KERN_INFO"%s: 21143 link status interrupt %8.8x, CSR5 %x, " 153 dev_info(&dev->dev,
151 "%8.8x.\n", dev->name, csr12, csr5, csr14); 154 "21143 link status interrupt %08x, CSR5 %x, %08x\n",
155 csr12, csr5, csr14);
152 156
153 /* If NWay finished and we have a negotiated partner capability. */ 157 /* If NWay finished and we have a negotiated partner capability. */
154 if (tp->nway && !tp->nwayset && (csr12 & 0x7000) == 0x5000) { 158 if (tp->nway && !tp->nwayset && (csr12 & 0x7000) == 0x5000) {
@@ -171,14 +175,15 @@ void t21142_lnk_change(struct net_device *dev, int csr5)
171 175
172 if (tulip_debug > 1) { 176 if (tulip_debug > 1) {
173 if (tp->nwayset) 177 if (tp->nwayset)
174 printk(KERN_INFO "%s: Switching to %s based on link " 178 dev_info(&dev->dev,
175 "negotiation %4.4x & %4.4x = %4.4x.\n", 179 "Switching to %s based on link negotiation %04x & %04x = %04x\n",
176 dev->name, medianame[dev->if_port], tp->sym_advertise, 180 medianame[dev->if_port],
177 tp->lpar, negotiated); 181 tp->sym_advertise, tp->lpar,
182 negotiated);
178 else 183 else
179 printk(KERN_INFO "%s: Autonegotiation failed, using %s," 184 dev_info(&dev->dev,
180 " link beat status %4.4x.\n", 185 "Autonegotiation failed, using %s, link beat status %04x\n",
181 dev->name, medianame[dev->if_port], csr12); 186 medianame[dev->if_port], csr12);
182 } 187 }
183 188
184 if (tp->mtable) { 189 if (tp->mtable) {
@@ -201,18 +206,18 @@ void t21142_lnk_change(struct net_device *dev, int csr5)
201#if 0 /* Restart shouldn't be needed. */ 206#if 0 /* Restart shouldn't be needed. */
202 iowrite32(tp->csr6 | RxOn, ioaddr + CSR6); 207 iowrite32(tp->csr6 | RxOn, ioaddr + CSR6);
203 if (tulip_debug > 2) 208 if (tulip_debug > 2)
204 printk(KERN_DEBUG "%s: Restarting Tx and Rx, CSR5 is %8.8x.\n", 209 printk(KERN_DEBUG "%s: Restarting Tx and Rx, CSR5 is %08x\n",
205 dev->name, ioread32(ioaddr + CSR5)); 210 dev->name, ioread32(ioaddr + CSR5));
206#endif 211#endif
207 tulip_start_rxtx(tp); 212 tulip_start_rxtx(tp);
208 if (tulip_debug > 2) 213 if (tulip_debug > 2)
209 printk(KERN_DEBUG "%s: Setting CSR6 %8.8x/%x CSR12 %8.8x.\n", 214 printk(KERN_DEBUG "%s: Setting CSR6 %08x/%x CSR12 %08x\n",
210 dev->name, tp->csr6, ioread32(ioaddr + CSR6), 215 dev->name, tp->csr6, ioread32(ioaddr + CSR6),
211 ioread32(ioaddr + CSR12)); 216 ioread32(ioaddr + CSR12));
212 } else if ((tp->nwayset && (csr5 & 0x08000000) 217 } else if ((tp->nwayset && (csr5 & 0x08000000) &&
213 && (dev->if_port == 3 || dev->if_port == 5) 218 (dev->if_port == 3 || dev->if_port == 5) &&
214 && (csr12 & 2) == 2) || 219 (csr12 & 2) == 2) ||
215 (tp->nway && (csr5 & (TPLnkFail)))) { 220 (tp->nway && (csr5 & (TPLnkFail)))) {
216 /* Link blew? Maybe restart NWay. */ 221 /* Link blew? Maybe restart NWay. */
217 del_timer_sync(&tp->timer); 222 del_timer_sync(&tp->timer);
218 t21142_start_nway(dev); 223 t21142_start_nway(dev);
@@ -220,9 +225,9 @@ void t21142_lnk_change(struct net_device *dev, int csr5)
220 add_timer(&tp->timer); 225 add_timer(&tp->timer);
221 } else if (dev->if_port == 3 || dev->if_port == 5) { 226 } else if (dev->if_port == 3 || dev->if_port == 5) {
222 if (tulip_debug > 1) 227 if (tulip_debug > 1)
223 printk(KERN_INFO"%s: 21143 %s link beat %s.\n", 228 dev_info(&dev->dev, "21143 %s link beat %s\n",
224 dev->name, medianame[dev->if_port], 229 medianame[dev->if_port],
225 (csr12 & 2) ? "failed" : "good"); 230 (csr12 & 2) ? "failed" : "good");
226 if ((csr12 & 2) && ! tp->medialock) { 231 if ((csr12 & 2) && ! tp->medialock) {
227 del_timer_sync(&tp->timer); 232 del_timer_sync(&tp->timer);
228 t21142_start_nway(dev); 233 t21142_start_nway(dev);
@@ -232,21 +237,18 @@ void t21142_lnk_change(struct net_device *dev, int csr5)
232 iowrite32(csr14 & ~0x080, ioaddr + CSR14); 237 iowrite32(csr14 & ~0x080, ioaddr + CSR14);
233 } else if (dev->if_port == 0 || dev->if_port == 4) { 238 } else if (dev->if_port == 0 || dev->if_port == 4) {
234 if ((csr12 & 4) == 0) 239 if ((csr12 & 4) == 0)
235 printk(KERN_INFO"%s: 21143 10baseT link beat good.\n", 240 dev_info(&dev->dev, "21143 10baseT link beat good\n");
236 dev->name);
237 } else if (!(csr12 & 4)) { /* 10mbps link beat good. */ 241 } else if (!(csr12 & 4)) { /* 10mbps link beat good. */
238 if (tulip_debug) 242 if (tulip_debug)
239 printk(KERN_INFO"%s: 21143 10mbps sensed media.\n", 243 dev_info(&dev->dev, "21143 10mbps sensed media\n");
240 dev->name);
241 dev->if_port = 0; 244 dev->if_port = 0;
242 } else if (tp->nwayset) { 245 } else if (tp->nwayset) {
243 if (tulip_debug) 246 if (tulip_debug)
244 printk(KERN_INFO"%s: 21143 using NWay-set %s, csr6 %8.8x.\n", 247 dev_info(&dev->dev, "21143 using NWay-set %s, csr6 %08x\n",
245 dev->name, medianame[dev->if_port], tp->csr6); 248 medianame[dev->if_port], tp->csr6);
246 } else { /* 100mbps link beat good. */ 249 } else { /* 100mbps link beat good. */
247 if (tulip_debug) 250 if (tulip_debug)
248 printk(KERN_INFO"%s: 21143 100baseTx sensed media.\n", 251 dev_info(&dev->dev, "21143 100baseTx sensed media\n");
249 dev->name);
250 dev->if_port = 3; 252 dev->if_port = 3;
251 tp->csr6 = 0x838E0000 | (tp->csr6 & 0x20ff); 253 tp->csr6 = 0x838E0000 | (tp->csr6 & 0x20ff);
252 iowrite32(0x0003FF7F, ioaddr + CSR14); 254 iowrite32(0x0003FF7F, ioaddr + CSR14);
diff --git a/drivers/net/tulip/Kconfig b/drivers/net/tulip/Kconfig
index 1cc8cf4425d1..516713fa0a05 100644
--- a/drivers/net/tulip/Kconfig
+++ b/drivers/net/tulip/Kconfig
@@ -101,6 +101,10 @@ config TULIP_NAPI_HW_MITIGATION
101 101
102 If in doubt, say Y. 102 If in doubt, say Y.
103 103
104config TULIP_DM910X
105 def_bool y
106 depends on TULIP && SPARC
107
104config DE4X5 108config DE4X5
105 tristate "Generic DECchip & DIGITAL EtherWORKS PCI/EISA" 109 tristate "Generic DECchip & DIGITAL EtherWORKS PCI/EISA"
106 depends on PCI || EISA 110 depends on PCI || EISA
diff --git a/drivers/net/tulip/de2104x.c b/drivers/net/tulip/de2104x.c
index 74e5ba42d38d..19cafc2b418d 100644
--- a/drivers/net/tulip/de2104x.c
+++ b/drivers/net/tulip/de2104x.c
@@ -42,6 +42,7 @@
42#include <linux/compiler.h> 42#include <linux/compiler.h>
43#include <linux/rtnetlink.h> 43#include <linux/rtnetlink.h>
44#include <linux/crc32.h> 44#include <linux/crc32.h>
45#include <linux/slab.h>
45 46
46#include <asm/io.h> 47#include <asm/io.h>
47#include <asm/irq.h> 48#include <asm/irq.h>
@@ -62,9 +63,9 @@ module_param (debug, int, 0);
62MODULE_PARM_DESC (debug, "de2104x bitmapped message enable number"); 63MODULE_PARM_DESC (debug, "de2104x bitmapped message enable number");
63 64
64/* Set the copy breakpoint for the copy-only-tiny-buffer Rx structure. */ 65/* Set the copy breakpoint for the copy-only-tiny-buffer Rx structure. */
65#if defined(__alpha__) || defined(__arm__) || defined(__hppa__) \ 66#if defined(__alpha__) || defined(__arm__) || defined(__hppa__) || \
66 || defined(CONFIG_SPARC) || defined(__ia64__) \ 67 defined(CONFIG_SPARC) || defined(__ia64__) || \
67 || defined(__sh__) || defined(__mips__) 68 defined(__sh__) || defined(__mips__)
68static int rx_copybreak = 1518; 69static int rx_copybreak = 1518;
69#else 70#else
70static int rx_copybreak = 100; 71static int rx_copybreak = 100;
@@ -337,7 +338,7 @@ static void de21041_media_timer (unsigned long data);
337static unsigned int de_ok_to_advertise (struct de_private *de, u32 new_media); 338static unsigned int de_ok_to_advertise (struct de_private *de, u32 new_media);
338 339
339 340
340static struct pci_device_id de_pci_tbl[] = { 341static DEFINE_PCI_DEVICE_TABLE(de_pci_tbl) = {
341 { PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_TULIP, 342 { PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_TULIP,
342 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, 343 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
343 { PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_TULIP_PLUS, 344 { PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_TULIP_PLUS,
@@ -382,9 +383,9 @@ static void de_rx_err_acct (struct de_private *de, unsigned rx_tail,
382 /* Ingore earlier buffers. */ 383 /* Ingore earlier buffers. */
383 if ((status & 0xffff) != 0x7fff) { 384 if ((status & 0xffff) != 0x7fff) {
384 if (netif_msg_rx_err(de)) 385 if (netif_msg_rx_err(de))
385 printk(KERN_WARNING "%s: Oversized Ethernet frame " 386 dev_warn(&de->dev->dev,
386 "spanned multiple buffers, status %8.8x!\n", 387 "Oversized Ethernet frame spanned multiple buffers, status %08x!\n",
387 de->dev->name, status); 388 status);
388 de->net_stats.rx_length_errors++; 389 de->net_stats.rx_length_errors++;
389 } 390 }
390 } else if (status & RxError) { 391 } else if (status & RxError) {
@@ -487,7 +488,7 @@ rx_next:
487 } 488 }
488 489
489 if (!rx_work) 490 if (!rx_work)
490 printk(KERN_WARNING "%s: rx work limit reached\n", de->dev->name); 491 dev_warn(&de->dev->dev, "rx work limit reached\n");
491 492
492 de->rx_tail = rx_tail; 493 de->rx_tail = rx_tail;
493} 494}
@@ -504,7 +505,8 @@ static irqreturn_t de_interrupt (int irq, void *dev_instance)
504 505
505 if (netif_msg_intr(de)) 506 if (netif_msg_intr(de))
506 printk(KERN_DEBUG "%s: intr, status %08x mode %08x desc %u/%u/%u\n", 507 printk(KERN_DEBUG "%s: intr, status %08x mode %08x desc %u/%u/%u\n",
507 dev->name, status, dr32(MacMode), de->rx_tail, de->tx_head, de->tx_tail); 508 dev->name, status, dr32(MacMode),
509 de->rx_tail, de->tx_head, de->tx_tail);
508 510
509 dw32(MacStatus, status); 511 dw32(MacStatus, status);
510 512
@@ -529,8 +531,9 @@ static irqreturn_t de_interrupt (int irq, void *dev_instance)
529 531
530 pci_read_config_word(de->pdev, PCI_STATUS, &pci_status); 532 pci_read_config_word(de->pdev, PCI_STATUS, &pci_status);
531 pci_write_config_word(de->pdev, PCI_STATUS, pci_status); 533 pci_write_config_word(de->pdev, PCI_STATUS, pci_status);
532 printk(KERN_ERR "%s: PCI bus error, status=%08x, PCI status=%04x\n", 534 dev_err(&de->dev->dev,
533 dev->name, status, pci_status); 535 "PCI bus error, status=%08x, PCI status=%04x\n",
536 status, pci_status);
534 } 537 }
535 538
536 return IRQ_HANDLED; 539 return IRQ_HANDLED;
@@ -582,7 +585,8 @@ static void de_tx (struct de_private *de)
582 de->net_stats.tx_packets++; 585 de->net_stats.tx_packets++;
583 de->net_stats.tx_bytes += skb->len; 586 de->net_stats.tx_bytes += skb->len;
584 if (netif_msg_tx_done(de)) 587 if (netif_msg_tx_done(de))
585 printk(KERN_DEBUG "%s: tx done, slot %d\n", de->dev->name, tx_tail); 588 printk(KERN_DEBUG "%s: tx done, slot %d\n",
589 de->dev->name, tx_tail);
586 } 590 }
587 dev_kfree_skb_irq(skb); 591 dev_kfree_skb_irq(skb);
588 } 592 }
@@ -674,18 +678,17 @@ static void build_setup_frame_hash(u16 *setup_frm, struct net_device *dev)
674 memset(hash_table, 0, sizeof(hash_table)); 678 memset(hash_table, 0, sizeof(hash_table));
675 set_bit_le(255, hash_table); /* Broadcast entry */ 679 set_bit_le(255, hash_table); /* Broadcast entry */
676 /* This should work on big-endian machines as well. */ 680 /* This should work on big-endian machines as well. */
677 for (i = 0, mclist = dev->mc_list; mclist && i < dev->mc_count; 681 netdev_for_each_mc_addr(mclist, dev) {
678 i++, mclist = mclist->next) {
679 int index = ether_crc_le(ETH_ALEN, mclist->dmi_addr) & 0x1ff; 682 int index = ether_crc_le(ETH_ALEN, mclist->dmi_addr) & 0x1ff;
680 683
681 set_bit_le(index, hash_table); 684 set_bit_le(index, hash_table);
685 }
682 686
683 for (i = 0; i < 32; i++) { 687 for (i = 0; i < 32; i++) {
684 *setup_frm++ = hash_table[i]; 688 *setup_frm++ = hash_table[i];
685 *setup_frm++ = hash_table[i]; 689 *setup_frm++ = hash_table[i];
686 }
687 setup_frm = &de->setup_frame[13*6];
688 } 690 }
691 setup_frm = &de->setup_frame[13*6];
689 692
690 /* Fill the final entry with our physical address. */ 693 /* Fill the final entry with our physical address. */
691 eaddrs = (u16 *)dev->dev_addr; 694 eaddrs = (u16 *)dev->dev_addr;
@@ -698,20 +701,18 @@ static void build_setup_frame_perfect(u16 *setup_frm, struct net_device *dev)
698{ 701{
699 struct de_private *de = netdev_priv(dev); 702 struct de_private *de = netdev_priv(dev);
700 struct dev_mc_list *mclist; 703 struct dev_mc_list *mclist;
701 int i;
702 u16 *eaddrs; 704 u16 *eaddrs;
703 705
704 /* We have <= 14 addresses so we can use the wonderful 706 /* We have <= 14 addresses so we can use the wonderful
705 16 address perfect filtering of the Tulip. */ 707 16 address perfect filtering of the Tulip. */
706 for (i = 0, mclist = dev->mc_list; i < dev->mc_count; 708 netdev_for_each_mc_addr(mclist, dev) {
707 i++, mclist = mclist->next) {
708 eaddrs = (u16 *)mclist->dmi_addr; 709 eaddrs = (u16 *)mclist->dmi_addr;
709 *setup_frm++ = *eaddrs; *setup_frm++ = *eaddrs++; 710 *setup_frm++ = *eaddrs; *setup_frm++ = *eaddrs++;
710 *setup_frm++ = *eaddrs; *setup_frm++ = *eaddrs++; 711 *setup_frm++ = *eaddrs; *setup_frm++ = *eaddrs++;
711 *setup_frm++ = *eaddrs; *setup_frm++ = *eaddrs++; 712 *setup_frm++ = *eaddrs; *setup_frm++ = *eaddrs++;
712 } 713 }
713 /* Fill the unused entries with the broadcast address. */ 714 /* Fill the unused entries with the broadcast address. */
714 memset(setup_frm, 0xff, (15-i)*12); 715 memset(setup_frm, 0xff, (15 - netdev_mc_count(dev)) * 12);
715 setup_frm = &de->setup_frame[15*6]; 716 setup_frm = &de->setup_frame[15*6];
716 717
717 /* Fill the final entry with our physical address. */ 718 /* Fill the final entry with our physical address. */
@@ -738,7 +739,7 @@ static void __de_set_rx_mode (struct net_device *dev)
738 goto out; 739 goto out;
739 } 740 }
740 741
741 if ((dev->mc_count > 1000) || (dev->flags & IFF_ALLMULTI)) { 742 if ((netdev_mc_count(dev) > 1000) || (dev->flags & IFF_ALLMULTI)) {
742 /* Too many to filter well -- accept all multicasts. */ 743 /* Too many to filter well -- accept all multicasts. */
743 macmode |= AcceptAllMulticast; 744 macmode |= AcceptAllMulticast;
744 goto out; 745 goto out;
@@ -746,7 +747,7 @@ static void __de_set_rx_mode (struct net_device *dev)
746 747
747 /* Note that only the low-address shortword of setup_frame is valid! 748 /* Note that only the low-address shortword of setup_frame is valid!
748 The values are doubled for big-endian architectures. */ 749 The values are doubled for big-endian architectures. */
749 if (dev->mc_count > 14) /* Must use a multicast hash table. */ 750 if (netdev_mc_count(dev) > 14) /* Must use a multicast hash table. */
750 build_setup_frame_hash (de->setup_frame, dev); 751 build_setup_frame_hash (de->setup_frame, dev);
751 else 752 else
752 build_setup_frame_perfect (de->setup_frame, dev); 753 build_setup_frame_perfect (de->setup_frame, dev);
@@ -870,7 +871,7 @@ static void de_stop_rxtx (struct de_private *de)
870 udelay(100); 871 udelay(100);
871 } 872 }
872 873
873 printk(KERN_WARNING "%s: timeout expired stopping DMA\n", de->dev->name); 874 dev_warn(&de->dev->dev, "timeout expired stopping DMA\n");
874} 875}
875 876
876static inline void de_start_rxtx (struct de_private *de) 877static inline void de_start_rxtx (struct de_private *de)
@@ -905,8 +906,8 @@ static void de_link_up(struct de_private *de)
905 if (!netif_carrier_ok(de->dev)) { 906 if (!netif_carrier_ok(de->dev)) {
906 netif_carrier_on(de->dev); 907 netif_carrier_on(de->dev);
907 if (netif_msg_link(de)) 908 if (netif_msg_link(de))
908 printk(KERN_INFO "%s: link up, media %s\n", 909 dev_info(&de->dev->dev, "link up, media %s\n",
909 de->dev->name, media_name[de->media_type]); 910 media_name[de->media_type]);
910 } 911 }
911} 912}
912 913
@@ -915,7 +916,7 @@ static void de_link_down(struct de_private *de)
915 if (netif_carrier_ok(de->dev)) { 916 if (netif_carrier_ok(de->dev)) {
916 netif_carrier_off(de->dev); 917 netif_carrier_off(de->dev);
917 if (netif_msg_link(de)) 918 if (netif_msg_link(de))
918 printk(KERN_INFO "%s: link down\n", de->dev->name); 919 dev_info(&de->dev->dev, "link down\n");
919 } 920 }
920} 921}
921 922
@@ -925,7 +926,8 @@ static void de_set_media (struct de_private *de)
925 u32 macmode = dr32(MacMode); 926 u32 macmode = dr32(MacMode);
926 927
927 if (de_is_running(de)) 928 if (de_is_running(de))
928 printk(KERN_WARNING "%s: chip is running while changing media!\n", de->dev->name); 929 dev_warn(&de->dev->dev,
930 "chip is running while changing media!\n");
929 931
930 if (de->de21040) 932 if (de->de21040)
931 dw32(CSR11, FULL_DUPLEX_MAGIC); 933 dw32(CSR11, FULL_DUPLEX_MAGIC);
@@ -945,15 +947,15 @@ static void de_set_media (struct de_private *de)
945 macmode &= ~FullDuplex; 947 macmode &= ~FullDuplex;
946 948
947 if (netif_msg_link(de)) { 949 if (netif_msg_link(de)) {
948 printk(KERN_INFO 950 dev_info(&de->dev->dev, "set link %s\n", media_name[media]);
949 "%s: set link %s\n" 951 dev_info(&de->dev->dev, "mode 0x%x, sia 0x%x,0x%x,0x%x,0x%x\n",
950 "%s: mode 0x%x, sia 0x%x,0x%x,0x%x,0x%x\n" 952 dr32(MacMode), dr32(SIAStatus),
951 "%s: set mode 0x%x, set sia 0x%x,0x%x,0x%x\n", 953 dr32(CSR13), dr32(CSR14), dr32(CSR15));
952 de->dev->name, media_name[media], 954
953 de->dev->name, dr32(MacMode), dr32(SIAStatus), 955 dev_info(&de->dev->dev,
954 dr32(CSR13), dr32(CSR14), dr32(CSR15), 956 "set mode 0x%x, set sia 0x%x,0x%x,0x%x\n",
955 de->dev->name, macmode, de->media[media].csr13, 957 macmode, de->media[media].csr13,
956 de->media[media].csr14, de->media[media].csr15); 958 de->media[media].csr14, de->media[media].csr15);
957 } 959 }
958 if (macmode != dr32(MacMode)) 960 if (macmode != dr32(MacMode))
959 dw32(MacMode, macmode); 961 dw32(MacMode, macmode);
@@ -992,9 +994,8 @@ static void de21040_media_timer (unsigned long data)
992 de_link_up(de); 994 de_link_up(de);
993 else 995 else
994 if (netif_msg_timer(de)) 996 if (netif_msg_timer(de))
995 printk(KERN_INFO "%s: %s link ok, status %x\n", 997 dev_info(&dev->dev, "%s link ok, status %x\n",
996 dev->name, media_name[de->media_type], 998 media_name[de->media_type], status);
997 status);
998 return; 999 return;
999 } 1000 }
1000 1001
@@ -1022,8 +1023,8 @@ no_link_yet:
1022 add_timer(&de->media_timer); 1023 add_timer(&de->media_timer);
1023 1024
1024 if (netif_msg_timer(de)) 1025 if (netif_msg_timer(de))
1025 printk(KERN_INFO "%s: no link, trying media %s, status %x\n", 1026 dev_info(&dev->dev, "no link, trying media %s, status %x\n",
1026 dev->name, media_name[de->media_type], status); 1027 media_name[de->media_type], status);
1027} 1028}
1028 1029
1029static unsigned int de_ok_to_advertise (struct de_private *de, u32 new_media) 1030static unsigned int de_ok_to_advertise (struct de_private *de, u32 new_media)
@@ -1079,9 +1080,10 @@ static void de21041_media_timer (unsigned long data)
1079 de_link_up(de); 1080 de_link_up(de);
1080 else 1081 else
1081 if (netif_msg_timer(de)) 1082 if (netif_msg_timer(de))
1082 printk(KERN_INFO "%s: %s link ok, mode %x status %x\n", 1083 dev_info(&dev->dev,
1083 dev->name, media_name[de->media_type], 1084 "%s link ok, mode %x status %x\n",
1084 dr32(MacMode), status); 1085 media_name[de->media_type],
1086 dr32(MacMode), status);
1085 return; 1087 return;
1086 } 1088 }
1087 1089
@@ -1150,8 +1152,8 @@ no_link_yet:
1150 add_timer(&de->media_timer); 1152 add_timer(&de->media_timer);
1151 1153
1152 if (netif_msg_timer(de)) 1154 if (netif_msg_timer(de))
1153 printk(KERN_INFO "%s: no link, trying media %s, status %x\n", 1155 dev_info(&dev->dev, "no link, trying media %s, status %x\n",
1154 dev->name, media_name[de->media_type], status); 1156 media_name[de->media_type], status);
1155} 1157}
1156 1158
1157static void de_media_interrupt (struct de_private *de, u32 status) 1159static void de_media_interrupt (struct de_private *de, u32 status)
@@ -1378,8 +1380,7 @@ static int de_open (struct net_device *dev)
1378 1380
1379 rc = de_alloc_rings(de); 1381 rc = de_alloc_rings(de);
1380 if (rc) { 1382 if (rc) {
1381 printk(KERN_ERR "%s: ring allocation failure, err=%d\n", 1383 dev_err(&dev->dev, "ring allocation failure, err=%d\n", rc);
1382 dev->name, rc);
1383 return rc; 1384 return rc;
1384 } 1385 }
1385 1386
@@ -1387,15 +1388,14 @@ static int de_open (struct net_device *dev)
1387 1388
1388 rc = request_irq(dev->irq, de_interrupt, IRQF_SHARED, dev->name, dev); 1389 rc = request_irq(dev->irq, de_interrupt, IRQF_SHARED, dev->name, dev);
1389 if (rc) { 1390 if (rc) {
1390 printk(KERN_ERR "%s: IRQ %d request failure, err=%d\n", 1391 dev_err(&dev->dev, "IRQ %d request failure, err=%d\n",
1391 dev->name, dev->irq, rc); 1392 dev->irq, rc);
1392 goto err_out_free; 1393 goto err_out_free;
1393 } 1394 }
1394 1395
1395 rc = de_init_hw(de); 1396 rc = de_init_hw(de);
1396 if (rc) { 1397 if (rc) {
1397 printk(KERN_ERR "%s: h/w init failure, err=%d\n", 1398 dev_err(&dev->dev, "h/w init failure, err=%d\n", rc);
1398 dev->name, rc);
1399 goto err_out_free_irq; 1399 goto err_out_free_irq;
1400 } 1400 }
1401 1401
@@ -1666,8 +1666,8 @@ static int de_nway_reset(struct net_device *dev)
1666 status = dr32(SIAStatus); 1666 status = dr32(SIAStatus);
1667 dw32(SIAStatus, (status & ~NWayState) | NWayRestart); 1667 dw32(SIAStatus, (status & ~NWayState) | NWayRestart);
1668 if (netif_msg_link(de)) 1668 if (netif_msg_link(de))
1669 printk(KERN_INFO "%s: link nway restart, status %x,%x\n", 1669 dev_info(&de->dev->dev, "link nway restart, status %x,%x\n",
1670 de->dev->name, status, dr32(SIAStatus)); 1670 status, dr32(SIAStatus));
1671 return 0; 1671 return 0;
1672} 1672}
1673 1673
@@ -1711,7 +1711,7 @@ static void __devinit de21040_get_mac_address (struct de_private *de)
1711 de->dev->dev_addr[i] = value; 1711 de->dev->dev_addr[i] = value;
1712 udelay(1); 1712 udelay(1);
1713 if (boguscnt <= 0) 1713 if (boguscnt <= 0)
1714 printk(KERN_WARNING PFX "timeout reading 21040 MAC address byte %u\n", i); 1714 pr_warning(PFX "timeout reading 21040 MAC address byte %u\n", i);
1715 } 1715 }
1716} 1716}
1717 1717
@@ -1830,9 +1830,8 @@ static void __devinit de21041_get_srom_info (struct de_private *de)
1830 } 1830 }
1831 1831
1832 if (netif_msg_probe(de)) 1832 if (netif_msg_probe(de))
1833 printk(KERN_INFO "de%d: SROM leaf offset %u, default media %s\n", 1833 pr_info("de%d: SROM leaf offset %u, default media %s\n",
1834 de->board_idx, ofs, 1834 de->board_idx, ofs, media_name[de->media_type]);
1835 media_name[de->media_type]);
1836 1835
1837 /* init SIA register values to defaults */ 1836 /* init SIA register values to defaults */
1838 for (i = 0; i < DE_MAX_MEDIA; i++) { 1837 for (i = 0; i < DE_MAX_MEDIA; i++) {
@@ -1879,9 +1878,9 @@ static void __devinit de21041_get_srom_info (struct de_private *de)
1879 de->media[idx].type = idx; 1878 de->media[idx].type = idx;
1880 1879
1881 if (netif_msg_probe(de)) 1880 if (netif_msg_probe(de))
1882 printk(KERN_INFO "de%d: media block #%u: %s", 1881 pr_info("de%d: media block #%u: %s",
1883 de->board_idx, i, 1882 de->board_idx, i,
1884 media_name[de->media[idx].type]); 1883 media_name[de->media[idx].type]);
1885 1884
1886 bufp += sizeof (ib->opts); 1885 bufp += sizeof (ib->opts);
1887 1886
@@ -1893,13 +1892,13 @@ static void __devinit de21041_get_srom_info (struct de_private *de)
1893 sizeof(ib->csr15); 1892 sizeof(ib->csr15);
1894 1893
1895 if (netif_msg_probe(de)) 1894 if (netif_msg_probe(de))
1896 printk(" (%x,%x,%x)\n", 1895 pr_cont(" (%x,%x,%x)\n",
1897 de->media[idx].csr13, 1896 de->media[idx].csr13,
1898 de->media[idx].csr14, 1897 de->media[idx].csr14,
1899 de->media[idx].csr15); 1898 de->media[idx].csr15);
1900 1899
1901 } else if (netif_msg_probe(de)) 1900 } else if (netif_msg_probe(de))
1902 printk("\n"); 1901 pr_cont("\n");
1903 1902
1904 if (bufp > ((void *)&ee_data[DE_EEPROM_SIZE - 3])) 1903 if (bufp > ((void *)&ee_data[DE_EEPROM_SIZE - 3]))
1905 break; 1904 break;
@@ -2005,7 +2004,7 @@ static int __devinit de_init_one (struct pci_dev *pdev,
2005 /* check for invalid IRQ value */ 2004 /* check for invalid IRQ value */
2006 if (pdev->irq < 2) { 2005 if (pdev->irq < 2) {
2007 rc = -EIO; 2006 rc = -EIO;
2008 printk(KERN_ERR PFX "invalid irq (%d) for pci dev %s\n", 2007 pr_err(PFX "invalid irq (%d) for pci dev %s\n",
2009 pdev->irq, pci_name(pdev)); 2008 pdev->irq, pci_name(pdev));
2010 goto err_out_res; 2009 goto err_out_res;
2011 } 2010 }
@@ -2016,14 +2015,14 @@ static int __devinit de_init_one (struct pci_dev *pdev,
2016 pciaddr = pci_resource_start(pdev, 1); 2015 pciaddr = pci_resource_start(pdev, 1);
2017 if (!pciaddr) { 2016 if (!pciaddr) {
2018 rc = -EIO; 2017 rc = -EIO;
2019 printk(KERN_ERR PFX "no MMIO resource for pci dev %s\n", 2018 pr_err(PFX "no MMIO resource for pci dev %s\n", pci_name(pdev));
2020 pci_name(pdev));
2021 goto err_out_res; 2019 goto err_out_res;
2022 } 2020 }
2023 if (pci_resource_len(pdev, 1) < DE_REGS_SIZE) { 2021 if (pci_resource_len(pdev, 1) < DE_REGS_SIZE) {
2024 rc = -EIO; 2022 rc = -EIO;
2025 printk(KERN_ERR PFX "MMIO resource (%llx) too small on pci dev %s\n", 2023 pr_err(PFX "MMIO resource (%llx) too small on pci dev %s\n",
2026 (unsigned long long)pci_resource_len(pdev, 1), pci_name(pdev)); 2024 (unsigned long long)pci_resource_len(pdev, 1),
2025 pci_name(pdev));
2027 goto err_out_res; 2026 goto err_out_res;
2028 } 2027 }
2029 2028
@@ -2031,9 +2030,9 @@ static int __devinit de_init_one (struct pci_dev *pdev,
2031 regs = ioremap_nocache(pciaddr, DE_REGS_SIZE); 2030 regs = ioremap_nocache(pciaddr, DE_REGS_SIZE);
2032 if (!regs) { 2031 if (!regs) {
2033 rc = -EIO; 2032 rc = -EIO;
2034 printk(KERN_ERR PFX "Cannot map PCI MMIO (%llx@%lx) on pci dev %s\n", 2033 pr_err(PFX "Cannot map PCI MMIO (%llx@%lx) on pci dev %s\n",
2035 (unsigned long long)pci_resource_len(pdev, 1), 2034 (unsigned long long)pci_resource_len(pdev, 1),
2036 pciaddr, pci_name(pdev)); 2035 pciaddr, pci_name(pdev));
2037 goto err_out_res; 2036 goto err_out_res;
2038 } 2037 }
2039 dev->base_addr = (unsigned long) regs; 2038 dev->base_addr = (unsigned long) regs;
@@ -2044,8 +2043,7 @@ static int __devinit de_init_one (struct pci_dev *pdev,
2044 /* make sure hardware is not running */ 2043 /* make sure hardware is not running */
2045 rc = de_reset_mac(de); 2044 rc = de_reset_mac(de);
2046 if (rc) { 2045 if (rc) {
2047 printk(KERN_ERR PFX "Cannot reset MAC, pci dev %s\n", 2046 pr_err(PFX "Cannot reset MAC, pci dev %s\n", pci_name(pdev));
2048 pci_name(pdev));
2049 goto err_out_iomap; 2047 goto err_out_iomap;
2050 } 2048 }
2051 2049
@@ -2065,12 +2063,11 @@ static int __devinit de_init_one (struct pci_dev *pdev,
2065 goto err_out_iomap; 2063 goto err_out_iomap;
2066 2064
2067 /* print info about board and interface just registered */ 2065 /* print info about board and interface just registered */
2068 printk (KERN_INFO "%s: %s at 0x%lx, %pM, IRQ %d\n", 2066 dev_info(&dev->dev, "%s at 0x%lx, %pM, IRQ %d\n",
2069 dev->name, 2067 de->de21040 ? "21040" : "21041",
2070 de->de21040 ? "21040" : "21041", 2068 dev->base_addr,
2071 dev->base_addr, 2069 dev->dev_addr,
2072 dev->dev_addr, 2070 dev->irq);
2073 dev->irq);
2074 2071
2075 pci_set_drvdata(pdev, dev); 2072 pci_set_drvdata(pdev, dev);
2076 2073
@@ -2158,8 +2155,7 @@ static int de_resume (struct pci_dev *pdev)
2158 if (!netif_running(dev)) 2155 if (!netif_running(dev))
2159 goto out_attach; 2156 goto out_attach;
2160 if ((retval = pci_enable_device(pdev))) { 2157 if ((retval = pci_enable_device(pdev))) {
2161 printk (KERN_ERR "%s: pci_enable_device failed in resume\n", 2158 dev_err(&dev->dev, "pci_enable_device failed in resume\n");
2162 dev->name);
2163 goto out; 2159 goto out;
2164 } 2160 }
2165 de_init_hw(de); 2161 de_init_hw(de);
diff --git a/drivers/net/tulip/de4x5.c b/drivers/net/tulip/de4x5.c
index a8349b7200b5..09b57193a16a 100644
--- a/drivers/net/tulip/de4x5.c
+++ b/drivers/net/tulip/de4x5.c
@@ -450,7 +450,6 @@
450#include <linux/ptrace.h> 450#include <linux/ptrace.h>
451#include <linux/errno.h> 451#include <linux/errno.h>
452#include <linux/ioport.h> 452#include <linux/ioport.h>
453#include <linux/slab.h>
454#include <linux/pci.h> 453#include <linux/pci.h>
455#include <linux/eisa.h> 454#include <linux/eisa.h>
456#include <linux/delay.h> 455#include <linux/delay.h>
@@ -467,6 +466,7 @@
467#include <linux/dma-mapping.h> 466#include <linux/dma-mapping.h>
468#include <linux/moduleparam.h> 467#include <linux/moduleparam.h>
469#include <linux/bitops.h> 468#include <linux/bitops.h>
469#include <linux/gfp.h>
470 470
471#include <asm/io.h> 471#include <asm/io.h>
472#include <asm/dma.h> 472#include <asm/dma.h>
@@ -1951,9 +1951,9 @@ static void
1951SetMulticastFilter(struct net_device *dev) 1951SetMulticastFilter(struct net_device *dev)
1952{ 1952{
1953 struct de4x5_private *lp = netdev_priv(dev); 1953 struct de4x5_private *lp = netdev_priv(dev);
1954 struct dev_mc_list *dmi=dev->mc_list; 1954 struct dev_mc_list *dmi;
1955 u_long iobase = dev->base_addr; 1955 u_long iobase = dev->base_addr;
1956 int i, j, bit, byte; 1956 int i, bit, byte;
1957 u16 hashcode; 1957 u16 hashcode;
1958 u32 omr, crc; 1958 u32 omr, crc;
1959 char *pa; 1959 char *pa;
@@ -1963,12 +1963,11 @@ SetMulticastFilter(struct net_device *dev)
1963 omr &= ~(OMR_PR | OMR_PM); 1963 omr &= ~(OMR_PR | OMR_PM);
1964 pa = build_setup_frame(dev, ALL); /* Build the basic frame */ 1964 pa = build_setup_frame(dev, ALL); /* Build the basic frame */
1965 1965
1966 if ((dev->flags & IFF_ALLMULTI) || (dev->mc_count > 14)) { 1966 if ((dev->flags & IFF_ALLMULTI) || (netdev_mc_count(dev) > 14)) {
1967 omr |= OMR_PM; /* Pass all multicasts */ 1967 omr |= OMR_PM; /* Pass all multicasts */
1968 } else if (lp->setup_f == HASH_PERF) { /* Hash Filtering */ 1968 } else if (lp->setup_f == HASH_PERF) { /* Hash Filtering */
1969 for (i=0;i<dev->mc_count;i++) { /* for each address in the list */ 1969 netdev_for_each_mc_addr(dmi, dev) {
1970 addrs=dmi->dmi_addr; 1970 addrs = dmi->dmi_addr;
1971 dmi=dmi->next;
1972 if ((*addrs & 0x01) == 1) { /* multicast address? */ 1971 if ((*addrs & 0x01) == 1) { /* multicast address? */
1973 crc = ether_crc_le(ETH_ALEN, addrs); 1972 crc = ether_crc_le(ETH_ALEN, addrs);
1974 hashcode = crc & HASH_BITS; /* hashcode is 9 LSb of CRC */ 1973 hashcode = crc & HASH_BITS; /* hashcode is 9 LSb of CRC */
@@ -1984,9 +1983,8 @@ SetMulticastFilter(struct net_device *dev)
1984 } 1983 }
1985 } 1984 }
1986 } else { /* Perfect filtering */ 1985 } else { /* Perfect filtering */
1987 for (j=0; j<dev->mc_count; j++) { 1986 netdev_for_each_mc_addr(dmi, dev) {
1988 addrs=dmi->dmi_addr; 1987 addrs = dmi->dmi_addr;
1989 dmi=dmi->next;
1990 for (i=0; i<ETH_ALEN; i++) { 1988 for (i=0; i<ETH_ALEN; i++) {
1991 *(pa + (i&1)) = *addrs++; 1989 *(pa + (i&1)) = *addrs++;
1992 if (i & 0x01) pa += 4; 1990 if (i & 0x01) pa += 4;
diff --git a/drivers/net/tulip/dmfe.c b/drivers/net/tulip/dmfe.c
index a45ded0538b8..9568156dea98 100644
--- a/drivers/net/tulip/dmfe.c
+++ b/drivers/net/tulip/dmfe.c
@@ -61,6 +61,8 @@
61 Test and make sure PCI latency is now correct for all cases. 61 Test and make sure PCI latency is now correct for all cases.
62*/ 62*/
63 63
64#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
65
64#define DRV_NAME "dmfe" 66#define DRV_NAME "dmfe"
65#define DRV_VERSION "1.36.4" 67#define DRV_VERSION "1.36.4"
66#define DRV_RELDATE "2002-01-17" 68#define DRV_RELDATE "2002-01-17"
@@ -72,7 +74,6 @@
72#include <linux/ptrace.h> 74#include <linux/ptrace.h>
73#include <linux/errno.h> 75#include <linux/errno.h>
74#include <linux/ioport.h> 76#include <linux/ioport.h>
75#include <linux/slab.h>
76#include <linux/interrupt.h> 77#include <linux/interrupt.h>
77#include <linux/pci.h> 78#include <linux/pci.h>
78#include <linux/dma-mapping.h> 79#include <linux/dma-mapping.h>
@@ -92,6 +93,10 @@
92#include <asm/uaccess.h> 93#include <asm/uaccess.h>
93#include <asm/irq.h> 94#include <asm/irq.h>
94 95
96#ifdef CONFIG_TULIP_DM910X
97#include <linux/of.h>
98#endif
99
95 100
96/* Board/System/Debug information/definition ---------------- */ 101/* Board/System/Debug information/definition ---------------- */
97#define PCI_DM9132_ID 0x91321282 /* Davicom DM9132 ID */ 102#define PCI_DM9132_ID 0x91321282 /* Davicom DM9132 ID */
@@ -145,16 +150,17 @@
145#define DMFE_TX_TIMEOUT ((3*HZ)/2) /* tx packet time-out time 1.5 s" */ 150#define DMFE_TX_TIMEOUT ((3*HZ)/2) /* tx packet time-out time 1.5 s" */
146#define DMFE_TX_KICK (HZ/2) /* tx packet Kick-out time 0.5 s" */ 151#define DMFE_TX_KICK (HZ/2) /* tx packet Kick-out time 0.5 s" */
147 152
148#define DMFE_DBUG(dbug_now, msg, value) \ 153#define DMFE_DBUG(dbug_now, msg, value) \
149 do { \ 154 do { \
150 if (dmfe_debug || (dbug_now)) \ 155 if (dmfe_debug || (dbug_now)) \
151 printk(KERN_ERR DRV_NAME ": %s %lx\n",\ 156 pr_err("%s %lx\n", \
152 (msg), (long) (value)); \ 157 (msg), (long) (value)); \
153 } while (0) 158 } while (0)
154 159
155#define SHOW_MEDIA_TYPE(mode) \ 160#define SHOW_MEDIA_TYPE(mode) \
156 printk (KERN_INFO DRV_NAME ": Change Speed to %sMhz %s duplex\n" , \ 161 pr_info("Change Speed to %sMhz %s duplex\n" , \
157 (mode & 1) ? "100":"10", (mode & 4) ? "full":"half"); 162 (mode & 1) ? "100":"10", \
163 (mode & 4) ? "full":"half");
158 164
159 165
160/* CR9 definition: SROM/MII */ 166/* CR9 definition: SROM/MII */
@@ -323,8 +329,8 @@ static void poll_dmfe (struct net_device *dev);
323static void dmfe_descriptor_init(struct dmfe_board_info *, unsigned long); 329static void dmfe_descriptor_init(struct dmfe_board_info *, unsigned long);
324static void allocate_rx_buffer(struct dmfe_board_info *); 330static void allocate_rx_buffer(struct dmfe_board_info *);
325static void update_cr6(u32, unsigned long); 331static void update_cr6(u32, unsigned long);
326static void send_filter_frame(struct DEVICE * ,int); 332static void send_filter_frame(struct DEVICE *);
327static void dm9132_id_table(struct DEVICE * ,int); 333static void dm9132_id_table(struct DEVICE *);
328static u16 phy_read(unsigned long, u8, u8, u32); 334static u16 phy_read(unsigned long, u8, u8, u32);
329static void phy_write(unsigned long, u8, u8, u16, u32); 335static void phy_write(unsigned long, u8, u8, u16, u32);
330static void phy_write_1bit(unsigned long, u32); 336static void phy_write_1bit(unsigned long, u32);
@@ -377,6 +383,22 @@ static int __devinit dmfe_init_one (struct pci_dev *pdev,
377 if (!printed_version++) 383 if (!printed_version++)
378 printk(version); 384 printk(version);
379 385
386 /*
387 * SPARC on-board DM910x chips should be handled by the main
388 * tulip driver, except for early DM9100s.
389 */
390#ifdef CONFIG_TULIP_DM910X
391 if ((ent->driver_data == PCI_DM9100_ID && pdev->revision >= 0x30) ||
392 ent->driver_data == PCI_DM9102_ID) {
393 struct device_node *dp = pci_device_to_OF_node(pdev);
394
395 if (dp && of_get_property(dp, "local-mac-address", NULL)) {
396 pr_info("skipping on-board DM910x (use tulip)\n");
397 return -ENODEV;
398 }
399 }
400#endif
401
380 /* Init network device */ 402 /* Init network device */
381 dev = alloc_etherdev(sizeof(*db)); 403 dev = alloc_etherdev(sizeof(*db));
382 if (dev == NULL) 404 if (dev == NULL)
@@ -384,8 +406,7 @@ static int __devinit dmfe_init_one (struct pci_dev *pdev,
384 SET_NETDEV_DEV(dev, &pdev->dev); 406 SET_NETDEV_DEV(dev, &pdev->dev);
385 407
386 if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { 408 if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) {
387 printk(KERN_WARNING DRV_NAME 409 pr_warning("32-bit PCI DMA not available\n");
388 ": 32-bit PCI DMA not available.\n");
389 err = -ENODEV; 410 err = -ENODEV;
390 goto err_out_free; 411 goto err_out_free;
391 } 412 }
@@ -396,13 +417,13 @@ static int __devinit dmfe_init_one (struct pci_dev *pdev,
396 goto err_out_free; 417 goto err_out_free;
397 418
398 if (!pci_resource_start(pdev, 0)) { 419 if (!pci_resource_start(pdev, 0)) {
399 printk(KERN_ERR DRV_NAME ": I/O base is zero\n"); 420 pr_err("I/O base is zero\n");
400 err = -ENODEV; 421 err = -ENODEV;
401 goto err_out_disable; 422 goto err_out_disable;
402 } 423 }
403 424
404 if (pci_resource_len(pdev, 0) < (CHK_IO_SIZE(pdev)) ) { 425 if (pci_resource_len(pdev, 0) < (CHK_IO_SIZE(pdev)) ) {
405 printk(KERN_ERR DRV_NAME ": Allocated I/O size too small\n"); 426 pr_err("Allocated I/O size too small\n");
406 err = -ENODEV; 427 err = -ENODEV;
407 goto err_out_disable; 428 goto err_out_disable;
408 } 429 }
@@ -417,7 +438,7 @@ static int __devinit dmfe_init_one (struct pci_dev *pdev,
417#endif 438#endif
418 439
419 if (pci_request_regions(pdev, DRV_NAME)) { 440 if (pci_request_regions(pdev, DRV_NAME)) {
420 printk(KERN_ERR DRV_NAME ": Failed to request PCI regions\n"); 441 pr_err("Failed to request PCI regions\n");
421 err = -ENODEV; 442 err = -ENODEV;
422 goto err_out_disable; 443 goto err_out_disable;
423 } 444 }
@@ -476,12 +497,9 @@ static int __devinit dmfe_init_one (struct pci_dev *pdev,
476 if (err) 497 if (err)
477 goto err_out_free_buf; 498 goto err_out_free_buf;
478 499
479 printk(KERN_INFO "%s: Davicom DM%04lx at pci%s, %pM, irq %d.\n", 500 dev_info(&dev->dev, "Davicom DM%04lx at pci%s, %pM, irq %d\n",
480 dev->name, 501 ent->driver_data >> 16,
481 ent->driver_data >> 16, 502 pci_name(pdev), dev->dev_addr, dev->irq);
482 pci_name(pdev),
483 dev->dev_addr,
484 dev->irq);
485 503
486 pci_set_master(pdev); 504 pci_set_master(pdev);
487 505
@@ -543,7 +561,7 @@ static int dmfe_open(struct DEVICE *dev)
543 561
544 DMFE_DBUG(0, "dmfe_open", 0); 562 DMFE_DBUG(0, "dmfe_open", 0);
545 563
546 ret = request_irq(dev->irq, &dmfe_interrupt, 564 ret = request_irq(dev->irq, dmfe_interrupt,
547 IRQF_SHARED, dev->name, dev); 565 IRQF_SHARED, dev->name, dev);
548 if (ret) 566 if (ret)
549 return ret; 567 return ret;
@@ -639,9 +657,9 @@ static void dmfe_init_dm910x(struct DEVICE *dev)
639 657
640 /* Send setup frame */ 658 /* Send setup frame */
641 if (db->chip_id == PCI_DM9132_ID) 659 if (db->chip_id == PCI_DM9132_ID)
642 dm9132_id_table(dev, dev->mc_count); /* DM9132 */ 660 dm9132_id_table(dev); /* DM9132 */
643 else 661 else
644 send_filter_frame(dev, dev->mc_count); /* DM9102/DM9102A */ 662 send_filter_frame(dev); /* DM9102/DM9102A */
645 663
646 /* Init CR7, interrupt active bit */ 664 /* Init CR7, interrupt active bit */
647 db->cr7_data = CR7_DEFAULT; 665 db->cr7_data = CR7_DEFAULT;
@@ -675,7 +693,7 @@ static netdev_tx_t dmfe_start_xmit(struct sk_buff *skb,
675 693
676 /* Too large packet check */ 694 /* Too large packet check */
677 if (skb->len > MAX_PACKET_SIZE) { 695 if (skb->len > MAX_PACKET_SIZE) {
678 printk(KERN_ERR DRV_NAME ": big packet = %d\n", (u16)skb->len); 696 pr_err("big packet = %d\n", (u16)skb->len);
679 dev_kfree_skb(skb); 697 dev_kfree_skb(skb);
680 return NETDEV_TX_OK; 698 return NETDEV_TX_OK;
681 } 699 }
@@ -685,8 +703,7 @@ static netdev_tx_t dmfe_start_xmit(struct sk_buff *skb,
685 /* No Tx resource check, it never happen nromally */ 703 /* No Tx resource check, it never happen nromally */
686 if (db->tx_queue_cnt >= TX_FREE_DESC_CNT) { 704 if (db->tx_queue_cnt >= TX_FREE_DESC_CNT) {
687 spin_unlock_irqrestore(&db->lock, flags); 705 spin_unlock_irqrestore(&db->lock, flags);
688 printk(KERN_ERR DRV_NAME ": No Tx resource %ld\n", 706 pr_err("No Tx resource %ld\n", db->tx_queue_cnt);
689 db->tx_queue_cnt);
690 return NETDEV_TX_BUSY; 707 return NETDEV_TX_BUSY;
691 } 708 }
692 709
@@ -758,12 +775,11 @@ static int dmfe_stop(struct DEVICE *dev)
758 775
759#if 0 776#if 0
760 /* show statistic counter */ 777 /* show statistic counter */
761 printk(DRV_NAME ": FU:%lx EC:%lx LC:%lx NC:%lx" 778 printk("FU:%lx EC:%lx LC:%lx NC:%lx LOC:%lx TXJT:%lx RESET:%lx RCR8:%lx FAL:%lx TT:%lx\n",
762 " LOC:%lx TXJT:%lx RESET:%lx RCR8:%lx FAL:%lx TT:%lx\n", 779 db->tx_fifo_underrun, db->tx_excessive_collision,
763 db->tx_fifo_underrun, db->tx_excessive_collision, 780 db->tx_late_collision, db->tx_no_carrier, db->tx_loss_carrier,
764 db->tx_late_collision, db->tx_no_carrier, db->tx_loss_carrier, 781 db->tx_jabber_timeout, db->reset_count, db->reset_cr8,
765 db->tx_jabber_timeout, db->reset_count, db->reset_cr8, 782 db->reset_fatal, db->reset_TXtimeout);
766 db->reset_fatal, db->reset_TXtimeout);
767#endif 783#endif
768 784
769 return 0; 785 return 0;
@@ -864,7 +880,7 @@ static void dmfe_free_tx_pkt(struct DEVICE *dev, struct dmfe_board_info * db)
864 txptr = db->tx_remove_ptr; 880 txptr = db->tx_remove_ptr;
865 while(db->tx_packet_cnt) { 881 while(db->tx_packet_cnt) {
866 tdes0 = le32_to_cpu(txptr->tdes0); 882 tdes0 = le32_to_cpu(txptr->tdes0);
867 /* printk(DRV_NAME ": tdes0=%x\n", tdes0); */ 883 pr_debug("tdes0=%x\n", tdes0);
868 if (tdes0 & 0x80000000) 884 if (tdes0 & 0x80000000)
869 break; 885 break;
870 886
@@ -874,7 +890,7 @@ static void dmfe_free_tx_pkt(struct DEVICE *dev, struct dmfe_board_info * db)
874 890
875 /* Transmit statistic counter */ 891 /* Transmit statistic counter */
876 if ( tdes0 != 0x7fffffff ) { 892 if ( tdes0 != 0x7fffffff ) {
877 /* printk(DRV_NAME ": tdes0=%x\n", tdes0); */ 893 pr_debug("tdes0=%x\n", tdes0);
878 dev->stats.collisions += (tdes0 >> 3) & 0xf; 894 dev->stats.collisions += (tdes0 >> 3) & 0xf;
879 dev->stats.tx_bytes += le32_to_cpu(txptr->tdes1) & 0x7ff; 895 dev->stats.tx_bytes += le32_to_cpu(txptr->tdes1) & 0x7ff;
880 if (tdes0 & TDES0_ERR_MASK) { 896 if (tdes0 & TDES0_ERR_MASK) {
@@ -971,7 +987,7 @@ static void dmfe_rx_packet(struct DEVICE *dev, struct dmfe_board_info * db)
971 /* error summary bit check */ 987 /* error summary bit check */
972 if (rdes0 & 0x8000) { 988 if (rdes0 & 0x8000) {
973 /* This is a error packet */ 989 /* This is a error packet */
974 //printk(DRV_NAME ": rdes0: %lx\n", rdes0); 990 pr_debug("rdes0: %x\n", rdes0);
975 dev->stats.rx_errors++; 991 dev->stats.rx_errors++;
976 if (rdes0 & 1) 992 if (rdes0 & 1)
977 dev->stats.rx_fifo_errors++; 993 dev->stats.rx_fifo_errors++;
@@ -1035,6 +1051,7 @@ static void dmfe_set_filter_mode(struct DEVICE * dev)
1035{ 1051{
1036 struct dmfe_board_info *db = netdev_priv(dev); 1052 struct dmfe_board_info *db = netdev_priv(dev);
1037 unsigned long flags; 1053 unsigned long flags;
1054 int mc_count = netdev_mc_count(dev);
1038 1055
1039 DMFE_DBUG(0, "dmfe_set_filter_mode()", 0); 1056 DMFE_DBUG(0, "dmfe_set_filter_mode()", 0);
1040 spin_lock_irqsave(&db->lock, flags); 1057 spin_lock_irqsave(&db->lock, flags);
@@ -1047,19 +1064,19 @@ static void dmfe_set_filter_mode(struct DEVICE * dev)
1047 return; 1064 return;
1048 } 1065 }
1049 1066
1050 if (dev->flags & IFF_ALLMULTI || dev->mc_count > DMFE_MAX_MULTICAST) { 1067 if (dev->flags & IFF_ALLMULTI || mc_count > DMFE_MAX_MULTICAST) {
1051 DMFE_DBUG(0, "Pass all multicast address", dev->mc_count); 1068 DMFE_DBUG(0, "Pass all multicast address", mc_count);
1052 db->cr6_data &= ~(CR6_PM | CR6_PBF); 1069 db->cr6_data &= ~(CR6_PM | CR6_PBF);
1053 db->cr6_data |= CR6_PAM; 1070 db->cr6_data |= CR6_PAM;
1054 spin_unlock_irqrestore(&db->lock, flags); 1071 spin_unlock_irqrestore(&db->lock, flags);
1055 return; 1072 return;
1056 } 1073 }
1057 1074
1058 DMFE_DBUG(0, "Set multicast address", dev->mc_count); 1075 DMFE_DBUG(0, "Set multicast address", mc_count);
1059 if (db->chip_id == PCI_DM9132_ID) 1076 if (db->chip_id == PCI_DM9132_ID)
1060 dm9132_id_table(dev, dev->mc_count); /* DM9132 */ 1077 dm9132_id_table(dev); /* DM9132 */
1061 else 1078 else
1062 send_filter_frame(dev, dev->mc_count); /* DM9102/DM9102A */ 1079 send_filter_frame(dev); /* DM9102/DM9102A */
1063 spin_unlock_irqrestore(&db->lock, flags); 1080 spin_unlock_irqrestore(&db->lock, flags);
1064} 1081}
1065 1082
@@ -1170,8 +1187,7 @@ static void dmfe_timer(unsigned long data)
1170 if ( time_after(jiffies, dev->trans_start + DMFE_TX_TIMEOUT) ) { 1187 if ( time_after(jiffies, dev->trans_start + DMFE_TX_TIMEOUT) ) {
1171 db->reset_TXtimeout++; 1188 db->reset_TXtimeout++;
1172 db->wait_reset = 1; 1189 db->wait_reset = 1;
1173 printk(KERN_WARNING "%s: Tx timeout - resetting\n", 1190 dev_warn(&dev->dev, "Tx timeout - resetting\n");
1174 dev->name);
1175 } 1191 }
1176 } 1192 }
1177 1193
@@ -1435,7 +1451,7 @@ static void update_cr6(u32 cr6_data, unsigned long ioaddr)
1435 * This setup frame initilize DM910X address filter mode 1451 * This setup frame initilize DM910X address filter mode
1436*/ 1452*/
1437 1453
1438static void dm9132_id_table(struct DEVICE *dev, int mc_cnt) 1454static void dm9132_id_table(struct DEVICE *dev)
1439{ 1455{
1440 struct dev_mc_list *mcptr; 1456 struct dev_mc_list *mcptr;
1441 u16 * addrptr; 1457 u16 * addrptr;
@@ -1455,15 +1471,14 @@ static void dm9132_id_table(struct DEVICE *dev, int mc_cnt)
1455 ioaddr += 4; 1471 ioaddr += 4;
1456 1472
1457 /* Clear Hash Table */ 1473 /* Clear Hash Table */
1458 for (i = 0; i < 4; i++) 1474 memset(hash_table, 0, sizeof(hash_table));
1459 hash_table[i] = 0x0;
1460 1475
1461 /* broadcast address */ 1476 /* broadcast address */
1462 hash_table[3] = 0x8000; 1477 hash_table[3] = 0x8000;
1463 1478
1464 /* the multicast address in Hash Table : 64 bits */ 1479 /* the multicast address in Hash Table : 64 bits */
1465 for (mcptr = dev->mc_list, i = 0; i < mc_cnt; i++, mcptr = mcptr->next) { 1480 netdev_for_each_mc_addr(mcptr, dev) {
1466 hash_val = cal_CRC( (char *) mcptr->dmi_addr, 6, 0) & 0x3f; 1481 hash_val = cal_CRC((char *) mcptr->dmi_addr, 6, 0) & 0x3f;
1467 hash_table[hash_val / 16] |= (u16) 1 << (hash_val % 16); 1482 hash_table[hash_val / 16] |= (u16) 1 << (hash_val % 16);
1468 } 1483 }
1469 1484
@@ -1478,7 +1493,7 @@ static void dm9132_id_table(struct DEVICE *dev, int mc_cnt)
1478 * This setup frame initilize DM910X address filter mode 1493 * This setup frame initilize DM910X address filter mode
1479 */ 1494 */
1480 1495
1481static void send_filter_frame(struct DEVICE *dev, int mc_cnt) 1496static void send_filter_frame(struct DEVICE *dev)
1482{ 1497{
1483 struct dmfe_board_info *db = netdev_priv(dev); 1498 struct dmfe_board_info *db = netdev_priv(dev);
1484 struct dev_mc_list *mcptr; 1499 struct dev_mc_list *mcptr;
@@ -1504,14 +1519,14 @@ static void send_filter_frame(struct DEVICE *dev, int mc_cnt)
1504 *suptr++ = 0xffff; 1519 *suptr++ = 0xffff;
1505 1520
1506 /* fit the multicast address */ 1521 /* fit the multicast address */
1507 for (mcptr = dev->mc_list, i = 0; i < mc_cnt; i++, mcptr = mcptr->next) { 1522 netdev_for_each_mc_addr(mcptr, dev) {
1508 addrptr = (u16 *) mcptr->dmi_addr; 1523 addrptr = (u16 *) mcptr->dmi_addr;
1509 *suptr++ = addrptr[0]; 1524 *suptr++ = addrptr[0];
1510 *suptr++ = addrptr[1]; 1525 *suptr++ = addrptr[1];
1511 *suptr++ = addrptr[2]; 1526 *suptr++ = addrptr[2];
1512 } 1527 }
1513 1528
1514 for (; i<14; i++) { 1529 for (i = netdev_mc_count(dev); i < 14; i++) {
1515 *suptr++ = 0xffff; 1530 *suptr++ = 0xffff;
1516 *suptr++ = 0xffff; 1531 *suptr++ = 0xffff;
1517 *suptr++ = 0xffff; 1532 *suptr++ = 0xffff;
@@ -1625,7 +1640,7 @@ static u8 dmfe_sense_speed(struct dmfe_board_info * db)
1625 else /* DM9102/DM9102A */ 1640 else /* DM9102/DM9102A */
1626 phy_mode = phy_read(db->ioaddr, 1641 phy_mode = phy_read(db->ioaddr,
1627 db->phy_addr, 17, db->chip_id) & 0xf000; 1642 db->phy_addr, 17, db->chip_id) & 0xf000;
1628 /* printk(DRV_NAME ": Phy_mode %x ",phy_mode); */ 1643 pr_debug("Phy_mode %x\n", phy_mode);
1629 switch (phy_mode) { 1644 switch (phy_mode) {
1630 case 0x1000: db->op_mode = DMFE_10MHF; break; 1645 case 0x1000: db->op_mode = DMFE_10MHF; break;
1631 case 0x2000: db->op_mode = DMFE_10MFD; break; 1646 case 0x2000: db->op_mode = DMFE_10MFD; break;
@@ -2068,7 +2083,7 @@ static void dmfe_HPNA_remote_cmd_chk(struct dmfe_board_info * db)
2068 2083
2069 2084
2070 2085
2071static struct pci_device_id dmfe_pci_tbl[] = { 2086static DEFINE_PCI_DEVICE_TABLE(dmfe_pci_tbl) = {
2072 { 0x1282, 0x9132, PCI_ANY_ID, PCI_ANY_ID, 0, 0, PCI_DM9132_ID }, 2087 { 0x1282, 0x9132, PCI_ANY_ID, PCI_ANY_ID, 0, 0, PCI_DM9132_ID },
2073 { 0x1282, 0x9102, PCI_ANY_ID, PCI_ANY_ID, 0, 0, PCI_DM9102_ID }, 2088 { 0x1282, 0x9102, PCI_ANY_ID, PCI_ANY_ID, 0, 0, PCI_DM9102_ID },
2074 { 0x1282, 0x9100, PCI_ANY_ID, PCI_ANY_ID, 0, 0, PCI_DM9100_ID }, 2089 { 0x1282, 0x9100, PCI_ANY_ID, PCI_ANY_ID, 0, 0, PCI_DM9100_ID },
diff --git a/drivers/net/tulip/eeprom.c b/drivers/net/tulip/eeprom.c
index 391acd32a6a5..6002e651b9ea 100644
--- a/drivers/net/tulip/eeprom.c
+++ b/drivers/net/tulip/eeprom.c
@@ -13,6 +13,7 @@
13*/ 13*/
14 14
15#include <linux/pci.h> 15#include <linux/pci.h>
16#include <linux/slab.h>
16#include "tulip.h" 17#include "tulip.h"
17#include <linux/init.h> 18#include <linux/init.h>
18#include <asm/unaligned.h> 19#include <asm/unaligned.h>
@@ -143,6 +144,12 @@ static void __devinit tulip_build_fake_mediatable(struct tulip_private *tp)
143 144
144void __devinit tulip_parse_eeprom(struct net_device *dev) 145void __devinit tulip_parse_eeprom(struct net_device *dev)
145{ 146{
147 /*
148 dev is not registered at this point, so logging messages can't
149 use dev_<level> or netdev_<level> but dev->name is good via a
150 hack in the caller
151 */
152
146 /* The last media info list parsed, for multiport boards. */ 153 /* The last media info list parsed, for multiport boards. */
147 static struct mediatable *last_mediatable; 154 static struct mediatable *last_mediatable;
148 static unsigned char *last_ee_data; 155 static unsigned char *last_ee_data;
@@ -161,36 +168,33 @@ void __devinit tulip_parse_eeprom(struct net_device *dev)
161 if (ee_data[0] == 0xff) { 168 if (ee_data[0] == 0xff) {
162 if (last_mediatable) { 169 if (last_mediatable) {
163 controller_index++; 170 controller_index++;
164 printk(KERN_INFO "%s: Controller %d of multiport board.\n", 171 pr_info("%s: Controller %d of multiport board\n",
165 dev->name, controller_index); 172 dev->name, controller_index);
166 tp->mtable = last_mediatable; 173 tp->mtable = last_mediatable;
167 ee_data = last_ee_data; 174 ee_data = last_ee_data;
168 goto subsequent_board; 175 goto subsequent_board;
169 } else 176 } else
170 printk(KERN_INFO "%s: Missing EEPROM, this interface may " 177 pr_info("%s: Missing EEPROM, this interface may not work correctly!\n",
171 "not work correctly!\n", 178 dev->name);
172 dev->name);
173 return; 179 return;
174 } 180 }
175 /* Do a fix-up based on the vendor half of the station address prefix. */ 181 /* Do a fix-up based on the vendor half of the station address prefix. */
176 for (i = 0; eeprom_fixups[i].name; i++) { 182 for (i = 0; eeprom_fixups[i].name; i++) {
177 if (dev->dev_addr[0] == eeprom_fixups[i].addr0 183 if (dev->dev_addr[0] == eeprom_fixups[i].addr0 &&
178 && dev->dev_addr[1] == eeprom_fixups[i].addr1 184 dev->dev_addr[1] == eeprom_fixups[i].addr1 &&
179 && dev->dev_addr[2] == eeprom_fixups[i].addr2) { 185 dev->dev_addr[2] == eeprom_fixups[i].addr2) {
180 if (dev->dev_addr[2] == 0xE8 && ee_data[0x1a] == 0x55) 186 if (dev->dev_addr[2] == 0xE8 && ee_data[0x1a] == 0x55)
181 i++; /* An Accton EN1207, not an outlaw Maxtech. */ 187 i++; /* An Accton EN1207, not an outlaw Maxtech. */
182 memcpy(ee_data + 26, eeprom_fixups[i].newtable, 188 memcpy(ee_data + 26, eeprom_fixups[i].newtable,
183 sizeof(eeprom_fixups[i].newtable)); 189 sizeof(eeprom_fixups[i].newtable));
184 printk(KERN_INFO "%s: Old format EEPROM on '%s' board. Using" 190 pr_info("%s: Old format EEPROM on '%s' board. Using substitute media control info\n",
185 " substitute media control info.\n", 191 dev->name, eeprom_fixups[i].name);
186 dev->name, eeprom_fixups[i].name);
187 break; 192 break;
188 } 193 }
189 } 194 }
190 if (eeprom_fixups[i].name == NULL) { /* No fixup found. */ 195 if (eeprom_fixups[i].name == NULL) { /* No fixup found. */
191 printk(KERN_INFO "%s: Old style EEPROM with no media selection " 196 pr_info("%s: Old style EEPROM with no media selection information\n",
192 "information.\n", 197 dev->name);
193 dev->name);
194 return; 198 return;
195 } 199 }
196 } 200 }
@@ -218,7 +222,8 @@ subsequent_board:
218 /* 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 */
219 if (count == 0) { 223 if (count == 0) {
220 if (tulip_debug > 0) 224 if (tulip_debug > 0)
221 printk(KERN_WARNING "%s: no phy info, aborting mtable build\n", dev->name); 225 pr_warning("%s: no phy info, aborting mtable build\n",
226 dev->name);
222 return; 227 return;
223 } 228 }
224 229
@@ -234,8 +239,10 @@ subsequent_board:
234 mtable->has_nonmii = mtable->has_mii = mtable->has_reset = 0; 239 mtable->has_nonmii = mtable->has_mii = mtable->has_reset = 0;
235 mtable->csr15dir = mtable->csr15val = 0; 240 mtable->csr15dir = mtable->csr15val = 0;
236 241
237 printk(KERN_INFO "%s: EEPROM default media type %s.\n", dev->name, 242 pr_info("%s: EEPROM default media type %s\n",
238 media & 0x0800 ? "Autosense" : medianame[media & MEDIA_MASK]); 243 dev->name,
244 media & 0x0800 ? "Autosense"
245 : medianame[media & MEDIA_MASK]);
239 for (i = 0; i < count; i++) { 246 for (i = 0; i < count; i++) {
240 struct medialeaf *leaf = &mtable->mleaf[i]; 247 struct medialeaf *leaf = &mtable->mleaf[i];
241 248
@@ -298,16 +305,17 @@ subsequent_board:
298 } 305 }
299 if (tulip_debug > 1 && leaf->media == 11) { 306 if (tulip_debug > 1 && leaf->media == 11) {
300 unsigned char *bp = leaf->leafdata; 307 unsigned char *bp = leaf->leafdata;
301 printk(KERN_INFO "%s: MII interface PHY %d, setup/reset " 308 pr_info("%s: MII interface PHY %d, setup/reset sequences %d/%d long, capabilities %02x %02x\n",
302 "sequences %d/%d long, capabilities %2.2x %2.2x.\n", 309 dev->name,
303 dev->name, bp[0], bp[1], bp[2 + bp[1]*2], 310 bp[0], bp[1], bp[2 + bp[1]*2],
304 bp[5 + bp[2 + bp[1]*2]*2], bp[4 + bp[2 + bp[1]*2]*2]); 311 bp[5 + bp[2 + bp[1]*2]*2],
312 bp[4 + bp[2 + bp[1]*2]*2]);
305 } 313 }
306 printk(KERN_INFO "%s: Index #%d - Media %s (#%d) described " 314 pr_info("%s: Index #%d - Media %s (#%d) described by a %s (%d) block\n",
307 "by a %s (%d) block.\n", 315 dev->name,
308 dev->name, i, medianame[leaf->media & 15], leaf->media, 316 i, medianame[leaf->media & 15], leaf->media,
309 leaf->type < ARRAY_SIZE(block_name) ? block_name[leaf->type] : "<unknown>", 317 leaf->type < ARRAY_SIZE(block_name) ? block_name[leaf->type] : "<unknown>",
310 leaf->type); 318 leaf->type);
311 } 319 }
312 if (new_advertise) 320 if (new_advertise)
313 tp->sym_advertise = new_advertise; 321 tp->sym_advertise = new_advertise;
diff --git a/drivers/net/tulip/interrupt.c b/drivers/net/tulip/interrupt.c
index c8d220cf2cce..1faf7a4d7202 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 %8.8x.\n", entry, 128 printk(KERN_DEBUG " In tulip_rx(), entry %d %08x\n",
129 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 printk(KERN_DEBUG " In tulip_poll(), hardware disappeared\n");
134 break; 134 break;
135 } 135 }
136 /* Acknowledge current RX interrupt sources. */ 136 /* Acknowledge current RX interrupt sources. */
@@ -146,7 +146,7 @@ int tulip_poll(struct napi_struct *napi, int budget)
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 %8.8x.\n", 149 printk(KERN_DEBUG "%s: In tulip_rx(), entry %d %08x\n",
150 dev->name, entry, status); 150 dev->name, entry, status);
151 151
152 if (++work_done >= budget) 152 if (++work_done >= budget)
@@ -170,22 +170,22 @@ int tulip_poll(struct napi_struct *napi, int budget)
170 RxDescCollisionSeen | 170 RxDescCollisionSeen |
171 RxDescRunt | 171 RxDescRunt |
172 RxDescDescErr | 172 RxDescDescErr |
173 RxWholePkt)) != RxWholePkt 173 RxWholePkt)) != RxWholePkt ||
174 || pkt_len > 1518) { 174 pkt_len > 1518) {
175 if ((status & (RxLengthOver2047 | 175 if ((status & (RxLengthOver2047 |
176 RxWholePkt)) != RxWholePkt) { 176 RxWholePkt)) != RxWholePkt) {
177 /* Ingore earlier buffers. */ 177 /* Ingore earlier buffers. */
178 if ((status & 0xffff) != 0x7fff) { 178 if ((status & 0xffff) != 0x7fff) {
179 if (tulip_debug > 1) 179 if (tulip_debug > 1)
180 printk(KERN_WARNING "%s: Oversized Ethernet frame " 180 dev_warn(&dev->dev,
181 "spanned multiple buffers, status %8.8x!\n", 181 "Oversized Ethernet frame spanned multiple buffers, status %08x!\n",
182 dev->name, status); 182 status);
183 tp->stats.rx_length_errors++; 183 tp->stats.rx_length_errors++;
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 %8.8x.\n", 188 printk(KERN_DEBUG "%s: Receive error, Rx status %08x\n",
189 dev->name, status); 189 dev->name, status);
190 tp->stats.rx_errors++; /* end of a packet.*/ 190 tp->stats.rx_errors++; /* end of a packet.*/
191 if (pkt_len > 1518 || 191 if (pkt_len > 1518 ||
@@ -201,8 +201,8 @@ int tulip_poll(struct napi_struct *napi, int budget)
201 201
202 /* Check if the packet is long enough to accept without copying 202 /* Check if the packet is long enough to accept without copying
203 to a minimally-sized skbuff. */ 203 to a minimally-sized skbuff. */
204 if (pkt_len < tulip_rx_copybreak 204 if (pkt_len < tulip_rx_copybreak &&
205 && (skb = dev_alloc_skb(pkt_len + 2)) != NULL) { 205 (skb = dev_alloc_skb(pkt_len + 2)) != NULL) {
206 skb_reserve(skb, 2); /* 16 byte align the IP header */ 206 skb_reserve(skb, 2); /* 16 byte align the IP header */
207 pci_dma_sync_single_for_cpu(tp->pdev, 207 pci_dma_sync_single_for_cpu(tp->pdev,
208 tp->rx_buffers[entry].mapping, 208 tp->rx_buffers[entry].mapping,
@@ -226,12 +226,11 @@ int tulip_poll(struct napi_struct *napi, int budget)
226#ifndef final_version 226#ifndef final_version
227 if (tp->rx_buffers[entry].mapping != 227 if (tp->rx_buffers[entry].mapping !=
228 le32_to_cpu(tp->rx_ring[entry].buffer1)) { 228 le32_to_cpu(tp->rx_ring[entry].buffer1)) {
229 printk(KERN_ERR "%s: Internal fault: The skbuff addresses " 229 dev_err(&dev->dev,
230 "do not match in tulip_rx: %08x vs. %08llx %p / %p.\n", 230 "Internal fault: The skbuff addresses do not match in tulip_rx: %08x vs. %08llx %p / %p\n",
231 dev->name, 231 le32_to_cpu(tp->rx_ring[entry].buffer1),
232 le32_to_cpu(tp->rx_ring[entry].buffer1), 232 (unsigned long long)tp->rx_buffers[entry].mapping,
233 (unsigned long long)tp->rx_buffers[entry].mapping, 233 skb->head, temp);
234 skb->head, temp);
235 } 234 }
236#endif 235#endif
237 236
@@ -365,16 +364,16 @@ static int tulip_rx(struct net_device *dev)
365 int received = 0; 364 int received = 0;
366 365
367 if (tulip_debug > 4) 366 if (tulip_debug > 4)
368 printk(KERN_DEBUG " In tulip_rx(), entry %d %8.8x.\n", entry, 367 printk(KERN_DEBUG " In tulip_rx(), entry %d %08x\n",
369 tp->rx_ring[entry].status); 368 entry, tp->rx_ring[entry].status);
370 /* If we own the next entry, it is a new packet. Send it up. */ 369 /* If we own the next entry, it is a new packet. Send it up. */
371 while ( ! (tp->rx_ring[entry].status & cpu_to_le32(DescOwned))) { 370 while ( ! (tp->rx_ring[entry].status & cpu_to_le32(DescOwned))) {
372 s32 status = le32_to_cpu(tp->rx_ring[entry].status); 371 s32 status = le32_to_cpu(tp->rx_ring[entry].status);
373 short pkt_len; 372 short pkt_len;
374 373
375 if (tulip_debug > 5) 374 if (tulip_debug > 5)
376 printk(KERN_DEBUG "%s: In tulip_rx(), entry %d %8.8x.\n", 375 printk(KERN_DEBUG "%s: In tulip_rx(), entry %d %08x\n",
377 dev->name, entry, status); 376 dev->name, entry, status);
378 if (--rx_work_limit < 0) 377 if (--rx_work_limit < 0)
379 break; 378 break;
380 379
@@ -395,23 +394,23 @@ static int tulip_rx(struct net_device *dev)
395 RxDescCollisionSeen | 394 RxDescCollisionSeen |
396 RxDescRunt | 395 RxDescRunt |
397 RxDescDescErr | 396 RxDescDescErr |
398 RxWholePkt)) != RxWholePkt 397 RxWholePkt)) != RxWholePkt ||
399 || pkt_len > 1518) { 398 pkt_len > 1518) {
400 if ((status & (RxLengthOver2047 | 399 if ((status & (RxLengthOver2047 |
401 RxWholePkt)) != RxWholePkt) { 400 RxWholePkt)) != RxWholePkt) {
402 /* Ingore earlier buffers. */ 401 /* Ingore earlier buffers. */
403 if ((status & 0xffff) != 0x7fff) { 402 if ((status & 0xffff) != 0x7fff) {
404 if (tulip_debug > 1) 403 if (tulip_debug > 1)
405 printk(KERN_WARNING "%s: Oversized Ethernet frame " 404 dev_warn(&dev->dev,
406 "spanned multiple buffers, status %8.8x!\n", 405 "Oversized Ethernet frame spanned multiple buffers, status %08x!\n",
407 dev->name, status); 406 status);
408 tp->stats.rx_length_errors++; 407 tp->stats.rx_length_errors++;
409 } 408 }
410 } else { 409 } else {
411 /* There was a fatal error. */ 410 /* There was a fatal error. */
412 if (tulip_debug > 2) 411 if (tulip_debug > 2)
413 printk(KERN_DEBUG "%s: Receive error, Rx status %8.8x.\n", 412 printk(KERN_DEBUG "%s: Receive error, Rx status %08x\n",
414 dev->name, status); 413 dev->name, status);
415 tp->stats.rx_errors++; /* end of a packet.*/ 414 tp->stats.rx_errors++; /* end of a packet.*/
416 if (pkt_len > 1518 || 415 if (pkt_len > 1518 ||
417 (status & RxDescRunt)) 416 (status & RxDescRunt))
@@ -425,8 +424,8 @@ static int tulip_rx(struct net_device *dev)
425 424
426 /* Check if the packet is long enough to accept without copying 425 /* Check if the packet is long enough to accept without copying
427 to a minimally-sized skbuff. */ 426 to a minimally-sized skbuff. */
428 if (pkt_len < tulip_rx_copybreak 427 if (pkt_len < tulip_rx_copybreak &&
429 && (skb = dev_alloc_skb(pkt_len + 2)) != NULL) { 428 (skb = dev_alloc_skb(pkt_len + 2)) != NULL) {
430 skb_reserve(skb, 2); /* 16 byte align the IP header */ 429 skb_reserve(skb, 2); /* 16 byte align the IP header */
431 pci_dma_sync_single_for_cpu(tp->pdev, 430 pci_dma_sync_single_for_cpu(tp->pdev,
432 tp->rx_buffers[entry].mapping, 431 tp->rx_buffers[entry].mapping,
@@ -450,12 +449,11 @@ static int tulip_rx(struct net_device *dev)
450#ifndef final_version 449#ifndef final_version
451 if (tp->rx_buffers[entry].mapping != 450 if (tp->rx_buffers[entry].mapping !=
452 le32_to_cpu(tp->rx_ring[entry].buffer1)) { 451 le32_to_cpu(tp->rx_ring[entry].buffer1)) {
453 printk(KERN_ERR "%s: Internal fault: The skbuff addresses " 452 dev_err(&dev->dev,
454 "do not match in tulip_rx: %08x vs. %Lx %p / %p.\n", 453 "Internal fault: The skbuff addresses do not match in tulip_rx: %08x vs. %Lx %p / %p\n",
455 dev->name, 454 le32_to_cpu(tp->rx_ring[entry].buffer1),
456 le32_to_cpu(tp->rx_ring[entry].buffer1), 455 (long long)tp->rx_buffers[entry].mapping,
457 (long long)tp->rx_buffers[entry].mapping, 456 skb->head, temp);
458 skb->head, temp);
459 } 457 }
460#endif 458#endif
461 459
@@ -569,7 +567,7 @@ irqreturn_t tulip_interrupt(int irq, void *dev_instance)
569#endif /* CONFIG_TULIP_NAPI */ 567#endif /* CONFIG_TULIP_NAPI */
570 568
571 if (tulip_debug > 4) 569 if (tulip_debug > 4)
572 printk(KERN_DEBUG "%s: interrupt csr5=%#8.8x new csr5=%#8.8x.\n", 570 printk(KERN_DEBUG "%s: interrupt csr5=%#8.8x new csr5=%#8.8x\n",
573 dev->name, csr5, ioread32(ioaddr + CSR5)); 571 dev->name, csr5, ioread32(ioaddr + CSR5));
574 572
575 573
@@ -601,8 +599,8 @@ irqreturn_t tulip_interrupt(int irq, void *dev_instance)
601 /* There was an major error, log it. */ 599 /* There was an major error, log it. */
602#ifndef final_version 600#ifndef final_version
603 if (tulip_debug > 1) 601 if (tulip_debug > 1)
604 printk(KERN_DEBUG "%s: Transmit error, Tx status %8.8x.\n", 602 printk(KERN_DEBUG "%s: Transmit error, Tx status %08x\n",
605 dev->name, status); 603 dev->name, status);
606#endif 604#endif
607 tp->stats.tx_errors++; 605 tp->stats.tx_errors++;
608 if (status & 0x4104) tp->stats.tx_aborted_errors++; 606 if (status & 0x4104) tp->stats.tx_aborted_errors++;
@@ -631,8 +629,9 @@ irqreturn_t tulip_interrupt(int irq, void *dev_instance)
631 629
632#ifndef final_version 630#ifndef final_version
633 if (tp->cur_tx - dirty_tx > TX_RING_SIZE) { 631 if (tp->cur_tx - dirty_tx > TX_RING_SIZE) {
634 printk(KERN_ERR "%s: Out-of-sync dirty pointer, %d vs. %d.\n", 632 dev_err(&dev->dev,
635 dev->name, dirty_tx, tp->cur_tx); 633 "Out-of-sync dirty pointer, %d vs. %d\n",
634 dirty_tx, tp->cur_tx);
636 dirty_tx += TX_RING_SIZE; 635 dirty_tx += TX_RING_SIZE;
637 } 636 }
638#endif 637#endif
@@ -643,9 +642,10 @@ irqreturn_t tulip_interrupt(int irq, void *dev_instance)
643 tp->dirty_tx = dirty_tx; 642 tp->dirty_tx = dirty_tx;
644 if (csr5 & TxDied) { 643 if (csr5 & TxDied) {
645 if (tulip_debug > 2) 644 if (tulip_debug > 2)
646 printk(KERN_WARNING "%s: The transmitter stopped." 645 dev_warn(&dev->dev,
647 " CSR5 is %x, CSR6 %x, new CSR6 %x.\n", 646 "The transmitter stopped. CSR5 is %x, CSR6 %x, new CSR6 %x\n",
648 dev->name, csr5, ioread32(ioaddr + CSR6), tp->csr6); 647 csr5, ioread32(ioaddr + CSR6),
648 tp->csr6);
649 tulip_restart_rxtx(tp); 649 tulip_restart_rxtx(tp);
650 } 650 }
651 spin_unlock(&tp->lock); 651 spin_unlock(&tp->lock);
@@ -696,8 +696,9 @@ irqreturn_t tulip_interrupt(int irq, void *dev_instance)
696 * to the 21142/3 docs that is). 696 * to the 21142/3 docs that is).
697 * -- rmk 697 * -- rmk
698 */ 698 */
699 printk(KERN_ERR "%s: (%lu) System Error occurred (%d)\n", 699 dev_err(&dev->dev,
700 dev->name, tp->nir, error); 700 "(%lu) System Error occurred (%d)\n",
701 tp->nir, error);
701 } 702 }
702 /* Clear all error sources, included undocumented ones! */ 703 /* Clear all error sources, included undocumented ones! */
703 iowrite32(0x0800f7ba, ioaddr + CSR5); 704 iowrite32(0x0800f7ba, ioaddr + CSR5);
@@ -706,16 +707,17 @@ irqreturn_t tulip_interrupt(int irq, void *dev_instance)
706 if (csr5 & TimerInt) { 707 if (csr5 & TimerInt) {
707 708
708 if (tulip_debug > 2) 709 if (tulip_debug > 2)
709 printk(KERN_ERR "%s: Re-enabling interrupts, %8.8x.\n", 710 dev_err(&dev->dev,
710 dev->name, csr5); 711 "Re-enabling interrupts, %08x\n",
712 csr5);
711 iowrite32(tulip_tbl[tp->chip_id].valid_intrs, ioaddr + CSR7); 713 iowrite32(tulip_tbl[tp->chip_id].valid_intrs, ioaddr + CSR7);
712 tp->ttimer = 0; 714 tp->ttimer = 0;
713 oi++; 715 oi++;
714 } 716 }
715 if (tx > maxtx || rx > maxrx || oi > maxoi) { 717 if (tx > maxtx || rx > maxrx || oi > maxoi) {
716 if (tulip_debug > 1) 718 if (tulip_debug > 1)
717 printk(KERN_WARNING "%s: Too much work during an interrupt, " 719 dev_warn(&dev->dev, "Too much work during an interrupt, csr5=0x%08x. (%lu) (%d,%d,%d)\n",
718 "csr5=0x%8.8x. (%lu) (%d,%d,%d)\n", dev->name, csr5, tp->nir, tx, rx, oi); 720 csr5, tp->nir, tx, rx, oi);
719 721
720 /* Acknowledge all interrupt sources. */ 722 /* Acknowledge all interrupt sources. */
721 iowrite32(0x8001ffff, ioaddr + CSR5); 723 iowrite32(0x8001ffff, ioaddr + CSR5);
@@ -764,14 +766,18 @@ irqreturn_t tulip_interrupt(int irq, void *dev_instance)
764 entry = tp->dirty_rx % RX_RING_SIZE; 766 entry = tp->dirty_rx % RX_RING_SIZE;
765 if (tp->rx_buffers[entry].skb == NULL) { 767 if (tp->rx_buffers[entry].skb == NULL) {
766 if (tulip_debug > 1) 768 if (tulip_debug > 1)
767 printk(KERN_WARNING "%s: in rx suspend mode: (%lu) (tp->cur_rx = %u, ttimer = %d, rx = %d) go/stay in suspend mode\n", dev->name, tp->nir, tp->cur_rx, tp->ttimer, rx); 769 dev_warn(&dev->dev,
770 "in rx suspend mode: (%lu) (tp->cur_rx = %u, ttimer = %d, rx = %d) go/stay in suspend mode\n",
771 tp->nir, tp->cur_rx, tp->ttimer, rx);
768 if (tp->chip_id == LC82C168) { 772 if (tp->chip_id == LC82C168) {
769 iowrite32(0x00, ioaddr + CSR7); 773 iowrite32(0x00, ioaddr + CSR7);
770 mod_timer(&tp->timer, RUN_AT(HZ/50)); 774 mod_timer(&tp->timer, RUN_AT(HZ/50));
771 } else { 775 } else {
772 if (tp->ttimer == 0 || (ioread32(ioaddr + CSR11) & 0xffff) == 0) { 776 if (tp->ttimer == 0 || (ioread32(ioaddr + CSR11) & 0xffff) == 0) {
773 if (tulip_debug > 1) 777 if (tulip_debug > 1)
774 printk(KERN_WARNING "%s: in rx suspend mode: (%lu) set timer\n", dev->name, tp->nir); 778 dev_warn(&dev->dev,
779 "in rx suspend mode: (%lu) set timer\n",
780 tp->nir);
775 iowrite32(tulip_tbl[tp->chip_id].valid_intrs | TimerInt, 781 iowrite32(tulip_tbl[tp->chip_id].valid_intrs | TimerInt,
776 ioaddr + CSR7); 782 ioaddr + CSR7);
777 iowrite32(TimerInt, ioaddr + CSR5); 783 iowrite32(TimerInt, ioaddr + CSR5);
@@ -787,8 +793,8 @@ irqreturn_t tulip_interrupt(int irq, void *dev_instance)
787 } 793 }
788 794
789 if (tulip_debug > 4) 795 if (tulip_debug > 4)
790 printk(KERN_DEBUG "%s: exiting interrupt, csr5=%#4.4x.\n", 796 printk(KERN_DEBUG "%s: exiting interrupt, csr5=%#04x\n",
791 dev->name, ioread32(ioaddr + CSR5)); 797 dev->name, ioread32(ioaddr + CSR5));
792 798
793 return IRQ_HANDLED; 799 return IRQ_HANDLED;
794} 800}
diff --git a/drivers/net/tulip/media.c b/drivers/net/tulip/media.c
index daddfa51853e..68b170ae4d15 100644
--- a/drivers/net/tulip/media.c
+++ b/drivers/net/tulip/media.c
@@ -182,9 +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" 185 printk(KERN_DEBUG "%s: Using a 21140 non-MII transceiver with control setting %02x\n",
186 " with control setting %2.2x.\n", 186 dev->name, p[1]);
187 dev->name, p[1]);
188 dev->if_port = p[0]; 187 dev->if_port = p[0];
189 if (startup) 188 if (startup)
190 iowrite32(mtable->csr12dir | 0x100, ioaddr + CSR12); 189 iowrite32(mtable->csr12dir | 0x100, ioaddr + CSR12);
@@ -205,15 +204,15 @@ void tulip_select_media(struct net_device *dev, int startup)
205 struct medialeaf *rleaf = &mtable->mleaf[mtable->has_reset]; 204 struct medialeaf *rleaf = &mtable->mleaf[mtable->has_reset];
206 unsigned char *rst = rleaf->leafdata; 205 unsigned char *rst = rleaf->leafdata;
207 if (tulip_debug > 1) 206 if (tulip_debug > 1)
208 printk(KERN_DEBUG "%s: Resetting the transceiver.\n", 207 printk(KERN_DEBUG "%s: Resetting the transceiver\n",
209 dev->name); 208 dev->name);
210 for (i = 0; i < rst[0]; i++) 209 for (i = 0; i < rst[0]; i++)
211 iowrite32(get_u16(rst + 1 + (i<<1)) << 16, ioaddr + CSR15); 210 iowrite32(get_u16(rst + 1 + (i<<1)) << 16, ioaddr + CSR15);
212 } 211 }
213 if (tulip_debug > 1) 212 if (tulip_debug > 1)
214 printk(KERN_DEBUG "%s: 21143 non-MII %s transceiver control " 213 printk(KERN_DEBUG "%s: 21143 non-MII %s transceiver control %04x/%04x\n",
215 "%4.4x/%4.4x.\n", 214 dev->name, medianame[dev->if_port],
216 dev->name, medianame[dev->if_port], setup[0], setup[1]); 215 setup[0], setup[1]);
217 if (p[0] & 0x40) { /* SIA (CSR13-15) setup values are provided. */ 216 if (p[0] & 0x40) { /* SIA (CSR13-15) setup values are provided. */
218 csr13val = setup[0]; 217 csr13val = setup[0];
219 csr14val = setup[1]; 218 csr14val = setup[1];
@@ -240,8 +239,8 @@ void tulip_select_media(struct net_device *dev, int startup)
240 if (startup) iowrite32(csr13val, ioaddr + CSR13); 239 if (startup) iowrite32(csr13val, ioaddr + CSR13);
241 } 240 }
242 if (tulip_debug > 1) 241 if (tulip_debug > 1)
243 printk(KERN_DEBUG "%s: Setting CSR15 to %8.8x/%8.8x.\n", 242 printk(KERN_DEBUG "%s: Setting CSR15 to %08x/%08x\n",
244 dev->name, csr15dir, csr15val); 243 dev->name, csr15dir, csr15val);
245 if (mleaf->type == 4) 244 if (mleaf->type == 4)
246 new_csr6 = 0x82020000 | ((setup[2] & 0x71) << 18); 245 new_csr6 = 0x82020000 | ((setup[2] & 0x71) << 18);
247 else 246 else
@@ -317,8 +316,9 @@ void tulip_select_media(struct net_device *dev, int startup)
317 if (tp->mii_advertise == 0) 316 if (tp->mii_advertise == 0)
318 tp->mii_advertise = tp->advertising[phy_num]; 317 tp->mii_advertise = tp->advertising[phy_num];
319 if (tulip_debug > 1) 318 if (tulip_debug > 1)
320 printk(KERN_DEBUG "%s: Advertising %4.4x on MII %d.\n", 319 printk(KERN_DEBUG "%s: Advertising %04x on MII %d\n",
321 dev->name, tp->mii_advertise, tp->phys[phy_num]); 320 dev->name, tp->mii_advertise,
321 tp->phys[phy_num]);
322 tulip_mdio_write(dev, tp->phys[phy_num], 4, tp->mii_advertise); 322 tulip_mdio_write(dev, tp->phys[phy_num], 4, tp->mii_advertise);
323 } 323 }
324 break; 324 break;
@@ -335,8 +335,8 @@ void tulip_select_media(struct net_device *dev, int startup)
335 struct medialeaf *rleaf = &mtable->mleaf[mtable->has_reset]; 335 struct medialeaf *rleaf = &mtable->mleaf[mtable->has_reset];
336 unsigned char *rst = rleaf->leafdata; 336 unsigned char *rst = rleaf->leafdata;
337 if (tulip_debug > 1) 337 if (tulip_debug > 1)
338 printk(KERN_DEBUG "%s: Resetting the transceiver.\n", 338 printk(KERN_DEBUG "%s: Resetting the transceiver\n",
339 dev->name); 339 dev->name);
340 for (i = 0; i < rst[0]; i++) 340 for (i = 0; i < rst[0]; i++)
341 iowrite32(get_u16(rst + 1 + (i<<1)) << 16, ioaddr + CSR15); 341 iowrite32(get_u16(rst + 1 + (i<<1)) << 16, ioaddr + CSR15);
342 } 342 }
@@ -344,20 +344,20 @@ void tulip_select_media(struct net_device *dev, int startup)
344 break; 344 break;
345 } 345 }
346 default: 346 default:
347 printk(KERN_DEBUG "%s: Invalid media table selection %d.\n", 347 printk(KERN_DEBUG "%s: Invalid media table selection %d\n",
348 dev->name, mleaf->type); 348 dev->name, mleaf->type);
349 new_csr6 = 0x020E0000; 349 new_csr6 = 0x020E0000;
350 } 350 }
351 if (tulip_debug > 1) 351 if (tulip_debug > 1)
352 printk(KERN_DEBUG "%s: Using media type %s, CSR12 is %2.2x.\n", 352 printk(KERN_DEBUG "%s: Using media type %s, CSR12 is %02x\n",
353 dev->name, medianame[dev->if_port], 353 dev->name, medianame[dev->if_port],
354 ioread32(ioaddr + CSR12) & 0xff); 354 ioread32(ioaddr + CSR12) & 0xff);
355 } else if (tp->chip_id == LC82C168) { 355 } else if (tp->chip_id == LC82C168) {
356 if (startup && ! tp->medialock) 356 if (startup && ! tp->medialock)
357 dev->if_port = tp->mii_cnt ? 11 : 0; 357 dev->if_port = tp->mii_cnt ? 11 : 0;
358 if (tulip_debug > 1) 358 if (tulip_debug > 1)
359 printk(KERN_DEBUG "%s: PNIC PHY status is %3.3x, media %s.\n", 359 printk(KERN_DEBUG "%s: PNIC PHY status is %3.3x, media %s\n",
360 dev->name, ioread32(ioaddr + 0xB8), medianame[dev->if_port]); 360 dev->name, ioread32(ioaddr + 0xB8), medianame[dev->if_port]);
361 if (tp->mii_cnt) { 361 if (tp->mii_cnt) {
362 new_csr6 = 0x810C0000; 362 new_csr6 = 0x810C0000;
363 iowrite32(0x0001, ioaddr + CSR15); 363 iowrite32(0x0001, ioaddr + CSR15);
@@ -388,10 +388,9 @@ void tulip_select_media(struct net_device *dev, int startup)
388 } else 388 } else
389 new_csr6 = 0x03860000; 389 new_csr6 = 0x03860000;
390 if (tulip_debug > 1) 390 if (tulip_debug > 1)
391 printk(KERN_DEBUG "%s: No media description table, assuming " 391 printk(KERN_DEBUG "%s: No media description table, assuming %s transceiver, CSR12 %02x\n",
392 "%s transceiver, CSR12 %2.2x.\n", 392 dev->name, medianame[dev->if_port],
393 dev->name, medianame[dev->if_port], 393 ioread32(ioaddr + CSR12));
394 ioread32(ioaddr + CSR12));
395 } 394 }
396 395
397 tp->csr6 = new_csr6 | (tp->csr6 & 0xfdff) | (tp->full_duplex ? 0x0200 : 0); 396 tp->csr6 = new_csr6 | (tp->csr6 & 0xfdff) | (tp->full_duplex ? 0x0200 : 0);
@@ -415,16 +414,17 @@ int tulip_check_duplex(struct net_device *dev)
415 bmsr = tulip_mdio_read(dev, tp->phys[0], MII_BMSR); 414 bmsr = tulip_mdio_read(dev, tp->phys[0], MII_BMSR);
416 lpa = tulip_mdio_read(dev, tp->phys[0], MII_LPA); 415 lpa = tulip_mdio_read(dev, tp->phys[0], MII_LPA);
417 if (tulip_debug > 1) 416 if (tulip_debug > 1)
418 printk(KERN_INFO "%s: MII status %4.4x, Link partner report " 417 dev_info(&dev->dev, "MII status %04x, Link partner report %04x\n",
419 "%4.4x.\n", dev->name, bmsr, lpa); 418 bmsr, lpa);
420 if (bmsr == 0xffff) 419 if (bmsr == 0xffff)
421 return -2; 420 return -2;
422 if ((bmsr & BMSR_LSTATUS) == 0) { 421 if ((bmsr & BMSR_LSTATUS) == 0) {
423 int new_bmsr = tulip_mdio_read(dev, tp->phys[0], MII_BMSR); 422 int new_bmsr = tulip_mdio_read(dev, tp->phys[0], MII_BMSR);
424 if ((new_bmsr & BMSR_LSTATUS) == 0) { 423 if ((new_bmsr & BMSR_LSTATUS) == 0) {
425 if (tulip_debug > 1) 424 if (tulip_debug > 1)
426 printk(KERN_INFO "%s: No link beat on the MII interface," 425 dev_info(&dev->dev,
427 " status %4.4x.\n", dev->name, new_bmsr); 426 "No link beat on the MII interface, status %04x\n",
427 new_bmsr);
428 return -1; 428 return -1;
429 } 429 }
430 } 430 }
@@ -443,10 +443,10 @@ int tulip_check_duplex(struct net_device *dev)
443 tulip_restart_rxtx(tp); 443 tulip_restart_rxtx(tp);
444 444
445 if (tulip_debug > 0) 445 if (tulip_debug > 0)
446 printk(KERN_INFO "%s: Setting %s-duplex based on MII" 446 dev_info(&dev->dev,
447 "#%d link partner capability of %4.4x.\n", 447 "Setting %s-duplex based on MII#%d link partner capability of %04x\n",
448 dev->name, tp->full_duplex ? "full" : "half", 448 tp->full_duplex ? "full" : "half",
449 tp->phys[0], lpa); 449 tp->phys[0], lpa);
450 return 1; 450 return 1;
451 } 451 }
452 452
@@ -468,8 +468,8 @@ void __devinit tulip_find_mii (struct net_device *dev, int board_idx)
468 int phy = phyn & 0x1f; 468 int phy = phyn & 0x1f;
469 int mii_status = tulip_mdio_read (dev, phy, MII_BMSR); 469 int mii_status = tulip_mdio_read (dev, phy, MII_BMSR);
470 if ((mii_status & 0x8301) == 0x8001 || 470 if ((mii_status & 0x8301) == 0x8001 ||
471 ((mii_status & BMSR_100BASE4) == 0 471 ((mii_status & BMSR_100BASE4) == 0 &&
472 && (mii_status & 0x7800) != 0)) { 472 (mii_status & 0x7800) != 0)) {
473 /* preserve Becker logic, gain indentation level */ 473 /* preserve Becker logic, gain indentation level */
474 } else { 474 } else {
475 continue; 475 continue;
@@ -501,15 +501,13 @@ void __devinit tulip_find_mii (struct net_device *dev, int board_idx)
501 501
502 tp->phys[phy_idx++] = phy; 502 tp->phys[phy_idx++] = phy;
503 503
504 printk (KERN_INFO "tulip%d: MII transceiver #%d " 504 pr_info("tulip%d: MII transceiver #%d config %04x status %04x advertising %04x\n",
505 "config %4.4x status %4.4x advertising %4.4x.\n",
506 board_idx, phy, mii_reg0, mii_status, mii_advert); 505 board_idx, phy, mii_reg0, mii_status, mii_advert);
507 506
508 /* Fixup for DLink with miswired PHY. */ 507 /* Fixup for DLink with miswired PHY. */
509 if (mii_advert != to_advert) { 508 if (mii_advert != to_advert) {
510 printk (KERN_DEBUG "tulip%d: Advertising %4.4x on PHY %d," 509 printk(KERN_DEBUG "tulip%d: Advertising %04x on PHY %d, previously advertising %04x\n",
511 " previously advertising %4.4x.\n", 510 board_idx, to_advert, phy, mii_advert);
512 board_idx, to_advert, phy, mii_advert);
513 tulip_mdio_write (dev, phy, 4, to_advert); 511 tulip_mdio_write (dev, phy, 4, to_advert);
514 } 512 }
515 513
@@ -554,7 +552,7 @@ void __devinit tulip_find_mii (struct net_device *dev, int board_idx)
554 } 552 }
555 tp->mii_cnt = phy_idx; 553 tp->mii_cnt = phy_idx;
556 if (tp->mtable && tp->mtable->has_mii && phy_idx == 0) { 554 if (tp->mtable && tp->mtable->has_mii && phy_idx == 0) {
557 printk (KERN_INFO "tulip%d: ***WARNING***: No MII transceiver found!\n", 555 pr_info("tulip%d: ***WARNING***: No MII transceiver found!\n",
558 board_idx); 556 board_idx);
559 tp->phys[0] = 1; 557 tp->phys[0] = 1;
560 } 558 }
diff --git a/drivers/net/tulip/pnic.c b/drivers/net/tulip/pnic.c
index d3253ed09dfc..966efa1a27d7 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 %8.8x, %s.\n", 43 printk(KERN_DEBUG "%s: PNIC autonegotiated status %08x, %s\n",
44 dev->name, phy_reg, medianame[dev->if_port]); 44 dev->name, 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 %8.8x, CSR5 %8.8x.\n", 61 printk(KERN_DEBUG "%s: PNIC link changed state %08x, CSR5 %08x\n",
62 dev->name, phy_reg, csr5); 62 dev->name, 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,9 +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 %8.8x, %s " 117 printk(KERN_DEBUG "%s: PNIC timer PHY status %08x, %s CSR5 %08x\n",
118 "CSR5 %8.8x.\n", 118 dev->name, phy_reg, medianame[dev->if_port], csr5);
119 dev->name, phy_reg, medianame[dev->if_port], csr5);
120 if (phy_reg & 0x04000000) { /* Remote link fault */ 119 if (phy_reg & 0x04000000) { /* Remote link fault */
121 iowrite32(0x0201F078, ioaddr + 0xB8); 120 iowrite32(0x0201F078, ioaddr + 0xB8);
122 next_tick = 1*HZ; 121 next_tick = 1*HZ;
@@ -126,10 +125,11 @@ void pnic_timer(unsigned long data)
126 next_tick = 60*HZ; 125 next_tick = 60*HZ;
127 } else if (csr5 & TPLnkFail) { /* 100baseTx link beat */ 126 } else if (csr5 & TPLnkFail) { /* 100baseTx link beat */
128 if (tulip_debug > 1) 127 if (tulip_debug > 1)
129 printk(KERN_DEBUG "%s: %s link beat failed, CSR12 %4.4x, " 128 printk(KERN_DEBUG "%s: %s link beat failed, CSR12 %04x, CSR5 %08x, PHY %03x\n",
130 "CSR5 %8.8x, PHY %3.3x.\n", 129 dev->name, medianame[dev->if_port],
131 dev->name, medianame[dev->if_port], csr12, 130 csr12,
132 ioread32(ioaddr + CSR5), ioread32(ioaddr + 0xB8)); 131 ioread32(ioaddr + CSR5),
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)) {
@@ -151,10 +151,11 @@ void pnic_timer(unsigned long data)
151 tulip_restart_rxtx(tp); 151 tulip_restart_rxtx(tp);
152 dev->trans_start = jiffies; 152 dev->trans_start = jiffies;
153 if (tulip_debug > 1) 153 if (tulip_debug > 1)
154 printk(KERN_INFO "%s: Changing PNIC configuration to %s " 154 dev_info(&dev->dev,
155 "%s-duplex, CSR6 %8.8x.\n", 155 "Changing PNIC configuration to %s %s-duplex, CSR6 %08x\n",
156 dev->name, medianame[dev->if_port], 156 medianame[dev->if_port],
157 tp->full_duplex ? "full" : "half", new_csr6); 157 tp->full_duplex ? "full" : "half",
158 new_csr6);
158 } 159 }
159 } 160 }
160 } 161 }
@@ -162,7 +163,7 @@ too_good_connection:
162 mod_timer(&tp->timer, RUN_AT(next_tick)); 163 mod_timer(&tp->timer, RUN_AT(next_tick));
163 if(!ioread32(ioaddr + CSR7)) { 164 if(!ioread32(ioaddr + CSR7)) {
164 if (tulip_debug > 1) 165 if (tulip_debug > 1)
165 printk(KERN_INFO "%s: sw timer wakeup.\n", dev->name); 166 dev_info(&dev->dev, "sw timer wakeup\n");
166 disable_irq(dev->irq); 167 disable_irq(dev->irq);
167 tulip_refill_rx(dev); 168 tulip_refill_rx(dev);
168 enable_irq(dev->irq); 169 enable_irq(dev->irq);
diff --git a/drivers/net/tulip/pnic2.c b/drivers/net/tulip/pnic2.c
index f49579128fb5..b8197666021e 100644
--- a/drivers/net/tulip/pnic2.c
+++ b/drivers/net/tulip/pnic2.c
@@ -87,8 +87,8 @@ void pnic2_timer(unsigned long data)
87 int next_tick = 60*HZ; 87 int next_tick = 60*HZ;
88 88
89 if (tulip_debug > 3) 89 if (tulip_debug > 3)
90 printk(KERN_INFO"%s: PNIC2 negotiation status %8.8x.\n", 90 dev_info(&dev->dev, "PNIC2 negotiation status %08x\n",
91 dev->name,ioread32(ioaddr + CSR12)); 91 ioread32(ioaddr + CSR12));
92 92
93 if (next_tick) { 93 if (next_tick) {
94 mod_timer(&tp->timer, RUN_AT(next_tick)); 94 mod_timer(&tp->timer, RUN_AT(next_tick));
@@ -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, " 128 printk(KERN_DEBUG "%s: Restarting PNIC2 autonegotiation, csr14=%08x\n",
129 "csr14=%8.8x.\n", dev->name, csr14); 129 dev->name, 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,8 @@ 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, " 140 printk(KERN_DEBUG "%s: On Entry to Nway, csr6=%08x\n",
141 "csr6=%8.8x.\n", dev->name, tp->csr6); 141 dev->name, tp->csr6);
142 142
143 /* mask off any bits not to touch 143 /* mask off any bits not to touch
144 * comment at top of file explains mask value 144 * comment at top of file explains mask value
@@ -181,9 +181,9 @@ void pnic2_lnk_change(struct net_device *dev, int csr5)
181 int csr12 = ioread32(ioaddr + CSR12); 181 int csr12 = ioread32(ioaddr + CSR12);
182 182
183 if (tulip_debug > 1) 183 if (tulip_debug > 1)
184 printk(KERN_INFO"%s: PNIC2 link status interrupt %8.8x, " 184 dev_info(&dev->dev,
185 " CSR5 %x, %8.8x.\n", dev->name, csr12, 185 "PNIC2 link status interrupt %08x, CSR5 %x, %08x\n",
186 csr5, ioread32(ioaddr + CSR14)); 186 csr12, csr5, ioread32(ioaddr + CSR14));
187 187
188 /* If NWay finished and we have a negotiated partner capability. 188 /* If NWay finished and we have a negotiated partner capability.
189 * check bits 14:12 for bit pattern 101 - all is good 189 * check bits 14:12 for bit pattern 101 - all is good
@@ -215,9 +215,9 @@ void pnic2_lnk_change(struct net_device *dev, int csr5)
215 else if (negotiated & 0x0020) dev->if_port = 0; 215 else if (negotiated & 0x0020) dev->if_port = 0;
216 else { 216 else {
217 if (tulip_debug > 1) 217 if (tulip_debug > 1)
218 printk(KERN_INFO "%s: funny autonegotiate result " 218 dev_info(&dev->dev,
219 "csr12 %8.8x advertising %4.4x\n", 219 "funny autonegotiate result csr12 %08x advertising %04x\n",
220 dev->name, csr12, tp->sym_advertise); 220 csr12, tp->sym_advertise);
221 tp->nwayset = 0; 221 tp->nwayset = 0;
222 /* so check if 100baseTx link state is okay */ 222 /* so check if 100baseTx link state is okay */
223 if ((csr12 & 2) == 0 && (tp->sym_advertise & 0x0180)) 223 if ((csr12 & 2) == 0 && (tp->sym_advertise & 0x0180))
@@ -231,10 +231,11 @@ void pnic2_lnk_change(struct net_device *dev, int csr5)
231 231
232 if (tulip_debug > 1) { 232 if (tulip_debug > 1) {
233 if (tp->nwayset) 233 if (tp->nwayset)
234 printk(KERN_INFO "%s: Switching to %s based on link " 234 dev_info(&dev->dev,
235 "negotiation %4.4x & %4.4x = %4.4x.\n", 235 "Switching to %s based on link negotiation %04x & %04x = %04x\n",
236 dev->name, medianame[dev->if_port], 236 medianame[dev->if_port],
237 tp->sym_advertise, tp->lpar, negotiated); 237 tp->sym_advertise, tp->lpar,
238 negotiated);
238 } 239 }
239 240
240 /* remember to turn off bit 7 - autonegotiate 241 /* remember to turn off bit 7 - autonegotiate
@@ -270,9 +271,9 @@ void pnic2_lnk_change(struct net_device *dev, int csr5)
270 iowrite32(1, ioaddr + CSR13); 271 iowrite32(1, ioaddr + CSR13);
271 272
272 if (tulip_debug > 2) 273 if (tulip_debug > 2)
273 printk(KERN_DEBUG "%s: Setting CSR6 %8.8x/%x CSR12 " 274 printk(KERN_DEBUG "%s: Setting CSR6 %08x/%x CSR12 %08x\n",
274 "%8.8x.\n", dev->name, tp->csr6, 275 dev->name, tp->csr6,
275 ioread32(ioaddr + CSR6), ioread32(ioaddr + CSR12)); 276 ioread32(ioaddr + CSR6), ioread32(ioaddr + CSR12));
276 277
277 /* now the following actually writes out the 278 /* now the following actually writes out the
278 * new csr6 values 279 * new csr6 values
@@ -282,9 +283,9 @@ void pnic2_lnk_change(struct net_device *dev, int csr5)
282 return; 283 return;
283 284
284 } else { 285 } else {
285 printk(KERN_INFO "%s: Autonegotiation failed, " 286 dev_info(&dev->dev,
286 "using %s, link beat status %4.4x.\n", 287 "Autonegotiation failed, using %s, link beat status %04x\n",
287 dev->name, medianame[dev->if_port], csr12); 288 medianame[dev->if_port], csr12);
288 289
289 /* remember to turn off bit 7 - autonegotiate 290 /* remember to turn off bit 7 - autonegotiate
290 * enable so we don't forget 291 * enable so we don't forget
@@ -316,9 +317,9 @@ void pnic2_lnk_change(struct net_device *dev, int csr5)
316 } 317 }
317 } 318 }
318 319
319 if ((tp->nwayset && (csr5 & 0x08000000) 320 if ((tp->nwayset && (csr5 & 0x08000000) &&
320 && (dev->if_port == 3 || dev->if_port == 5) 321 (dev->if_port == 3 || dev->if_port == 5) &&
321 && (csr12 & 2) == 2) || (tp->nway && (csr5 & (TPLnkFail)))) { 322 (csr12 & 2) == 2) || (tp->nway && (csr5 & (TPLnkFail)))) {
322 323
323 /* Link blew? Maybe restart NWay. */ 324 /* Link blew? Maybe restart NWay. */
324 325
@@ -339,9 +340,9 @@ void pnic2_lnk_change(struct net_device *dev, int csr5)
339 /* we are at 100mb and a potential link change occurred */ 340 /* we are at 100mb and a potential link change occurred */
340 341
341 if (tulip_debug > 1) 342 if (tulip_debug > 1)
342 printk(KERN_INFO"%s: PNIC2 %s link beat %s.\n", 343 dev_info(&dev->dev, "PNIC2 %s link beat %s\n",
343 dev->name, medianame[dev->if_port], 344 medianame[dev->if_port],
344 (csr12 & 2) ? "failed" : "good"); 345 (csr12 & 2) ? "failed" : "good");
345 346
346 /* check 100 link beat */ 347 /* check 100 link beat */
347 348
@@ -364,9 +365,9 @@ void pnic2_lnk_change(struct net_device *dev, int csr5)
364 /* we are at 10mb and a potential link change occurred */ 365 /* we are at 10mb and a potential link change occurred */
365 366
366 if (tulip_debug > 1) 367 if (tulip_debug > 1)
367 printk(KERN_INFO"%s: PNIC2 %s link beat %s.\n", 368 dev_info(&dev->dev, "PNIC2 %s link beat %s\n",
368 dev->name, medianame[dev->if_port], 369 medianame[dev->if_port],
369 (csr12 & 4) ? "failed" : "good"); 370 (csr12 & 4) ? "failed" : "good");
370 371
371 372
372 tp->nway = 0; 373 tp->nway = 0;
@@ -385,7 +386,7 @@ void pnic2_lnk_change(struct net_device *dev, int csr5)
385 386
386 387
387 if (tulip_debug > 1) 388 if (tulip_debug > 1)
388 printk(KERN_INFO"%s: PNIC2 Link Change Default?\n",dev->name); 389 dev_info(&dev->dev, "PNIC2 Link Change Default?\n");
389 390
390 /* if all else fails default to trying 10baseT-HD */ 391 /* if all else fails default to trying 10baseT-HD */
391 dev->if_port = 0; 392 dev->if_port = 0;
diff --git a/drivers/net/tulip/timer.c b/drivers/net/tulip/timer.c
index a0e084223082..36c2725ec886 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 %8.8x mode" 31 printk(KERN_DEBUG "%s: Media selection tick, %s, status %08x mode %08x SIA %08x %08x %08x %08x\n",
32 " %8.8x SIA %8.8x %8.8x %8.8x %8.8x.\n", 32 dev->name, medianame[dev->if_port],
33 dev->name, medianame[dev->if_port], ioread32(ioaddr + CSR5), 33 ioread32(ioaddr + CSR5), ioread32(ioaddr + CSR6),
34 ioread32(ioaddr + CSR6), 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 %8.8x " 51 printk(KERN_DEBUG "%s: network media monitor CSR6 %08x CSR12 0x%02x\n",
52 "CSR12 0x%2.2x.\n", 52 dev->name,
53 dev->name, ioread32(ioaddr + CSR6), csr12 & 0xff); 53 ioread32(ioaddr + CSR6), 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,9 +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 " 65 printk(KERN_DEBUG "%s: Transceiver monitor tick CSR12=%#02x, no media sense\n",
66 "CSR12=%#2.2x, no media sense.\n", 66 dev->name, csr12);
67 dev->name, csr12);
68 if (mleaf->type == 4) { 67 if (mleaf->type == 4) {
69 if (mleaf->media == 3 && (csr12 & 0x02)) 68 if (mleaf->media == 3 && (csr12 & 0x02))
70 goto select_next_media; 69 goto select_next_media;
@@ -72,16 +71,16 @@ void tulip_media_task(struct work_struct *work)
72 break; 71 break;
73 } 72 }
74 if (tulip_debug > 2) 73 if (tulip_debug > 2)
75 printk(KERN_DEBUG "%s: Transceiver monitor tick: CSR12=%#2.2x" 74 printk(KERN_DEBUG "%s: Transceiver monitor tick: CSR12=%#02x bit %d is %d, expecting %d\n",
76 " bit %d is %d, expecting %d.\n", 75 dev->name, csr12, (bitnum >> 1) & 7,
77 dev->name, csr12, (bitnum >> 1) & 7, 76 (csr12 & (1 << ((bitnum >> 1) & 7))) != 0,
78 (csr12 & (1 << ((bitnum >> 1) & 7))) != 0, 77 (bitnum >= 0));
79 (bitnum >= 0));
80 /* Check that the specified bit has the proper value. */ 78 /* Check that the specified bit has the proper value. */
81 if ((bitnum < 0) != 79 if ((bitnum < 0) !=
82 ((csr12 & (1 << ((bitnum >> 1) & 7))) != 0)) { 80 ((csr12 & (1 << ((bitnum >> 1) & 7))) != 0)) {
83 if (tulip_debug > 2) 81 if (tulip_debug > 2)
84 printk(KERN_DEBUG "%s: Link beat detected for %s.\n", dev->name, 82 printk(KERN_DEBUG "%s: Link beat detected for %s\n",
83 dev->name,
85 medianame[mleaf->media & MEDIA_MASK]); 84 medianame[mleaf->media & MEDIA_MASK]);
86 if ((p[2] & 0x61) == 0x01) /* Bogus Znyx board. */ 85 if ((p[2] & 0x61) == 0x01) /* Bogus Znyx board. */
87 goto actually_mii; 86 goto actually_mii;
@@ -100,9 +99,9 @@ void tulip_media_task(struct work_struct *work)
100 if (tulip_media_cap[dev->if_port] & MediaIsFD) 99 if (tulip_media_cap[dev->if_port] & MediaIsFD)
101 goto select_next_media; /* Skip FD entries. */ 100 goto select_next_media; /* Skip FD entries. */
102 if (tulip_debug > 1) 101 if (tulip_debug > 1)
103 printk(KERN_DEBUG "%s: No link beat on media %s," 102 printk(KERN_DEBUG "%s: No link beat on media %s, trying transceiver type %s\n",
104 " trying transceiver type %s.\n", 103 dev->name,
105 dev->name, medianame[mleaf->media & MEDIA_MASK], 104 medianame[mleaf->media & MEDIA_MASK],
106 medianame[tp->mtable->mleaf[tp->cur_index].media]); 105 medianame[tp->mtable->mleaf[tp->cur_index].media]);
107 tulip_select_media(dev, 0); 106 tulip_select_media(dev, 0);
108 /* Restart the transmit process. */ 107 /* Restart the transmit process. */
@@ -151,8 +150,8 @@ void mxic_timer(unsigned long data)
151 int next_tick = 60*HZ; 150 int next_tick = 60*HZ;
152 151
153 if (tulip_debug > 3) { 152 if (tulip_debug > 3) {
154 printk(KERN_INFO"%s: MXIC negotiation status %8.8x.\n", dev->name, 153 dev_info(&dev->dev, "MXIC negotiation status %08x\n",
155 ioread32(ioaddr + CSR12)); 154 ioread32(ioaddr + CSR12));
156 } 155 }
157 if (next_tick) { 156 if (next_tick) {
158 mod_timer(&tp->timer, RUN_AT(next_tick)); 157 mod_timer(&tp->timer, RUN_AT(next_tick));
@@ -167,11 +166,10 @@ void comet_timer(unsigned long data)
167 int next_tick = 60*HZ; 166 int next_tick = 60*HZ;
168 167
169 if (tulip_debug > 1) 168 if (tulip_debug > 1)
170 printk(KERN_DEBUG "%s: Comet link status %4.4x partner capability " 169 printk(KERN_DEBUG "%s: Comet link status %04x partner capability %04x\n",
171 "%4.4x.\n", 170 dev->name,
172 dev->name, 171 tulip_mdio_read(dev, tp->phys[0], 1),
173 tulip_mdio_read(dev, tp->phys[0], 1), 172 tulip_mdio_read(dev, tp->phys[0], 5));
174 tulip_mdio_read(dev, tp->phys[0], 5));
175 /* mod_timer synchronizes us with potential add_timer calls 173 /* mod_timer synchronizes us with potential add_timer calls
176 * from interrupts. 174 * from interrupts.
177 */ 175 */
diff --git a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c
index 6b2330e4206e..3810db9dc2de 100644
--- a/drivers/net/tulip/tulip_core.c
+++ b/drivers/net/tulip/tulip_core.c
@@ -24,6 +24,7 @@
24 24
25#include <linux/module.h> 25#include <linux/module.h>
26#include <linux/pci.h> 26#include <linux/pci.h>
27#include <linux/slab.h>
27#include "tulip.h" 28#include "tulip.h"
28#include <linux/init.h> 29#include <linux/init.h>
29#include <linux/etherdevice.h> 30#include <linux/etherdevice.h>
@@ -41,7 +42,6 @@
41static char version[] __devinitdata = 42static char version[] __devinitdata =
42 "Linux Tulip driver version " DRV_VERSION " (" DRV_RELDATE ")\n"; 43 "Linux Tulip driver version " DRV_VERSION " (" DRV_RELDATE ")\n";
43 44
44
45/* A few user-configurable values. */ 45/* A few user-configurable values. */
46 46
47/* Maximum events (Rx packets, etc.) to handle at each interrupt. */ 47/* Maximum events (Rx packets, etc.) to handle at each interrupt. */
@@ -64,9 +64,9 @@ const char * const medianame[32] = {
64}; 64};
65 65
66/* Set the copy breakpoint for the copy-only-tiny-buffer Rx structure. */ 66/* Set the copy breakpoint for the copy-only-tiny-buffer Rx structure. */
67#if defined(__alpha__) || defined(__arm__) || defined(__hppa__) \ 67#if defined(__alpha__) || defined(__arm__) || defined(__hppa__) || \
68 || defined(CONFIG_SPARC) || defined(__ia64__) \ 68 defined(CONFIG_SPARC) || defined(__ia64__) || \
69 || defined(__sh__) || defined(__mips__) 69 defined(__sh__) || defined(__mips__)
70static int rx_copybreak = 1518; 70static int rx_copybreak = 1518;
71#else 71#else
72static int rx_copybreak = 100; 72static int rx_copybreak = 100;
@@ -196,9 +196,13 @@ struct tulip_chip_table tulip_tbl[] = {
196 | HAS_NWAY | HAS_PCI_MWI, tulip_timer, tulip_media_task }, 196 | HAS_NWAY | HAS_PCI_MWI, tulip_timer, tulip_media_task },
197 197
198 /* DM910X */ 198 /* DM910X */
199#ifdef CONFIG_TULIP_DM910X
199 { "Davicom DM9102/DM9102A", 128, 0x0001ebef, 200 { "Davicom DM9102/DM9102A", 128, 0x0001ebef,
200 HAS_MII | HAS_MEDIA_TABLE | CSR12_IN_SROM | HAS_ACPI, 201 HAS_MII | HAS_MEDIA_TABLE | CSR12_IN_SROM | HAS_ACPI,
201 tulip_timer, tulip_media_task }, 202 tulip_timer, tulip_media_task },
203#else
204 { NULL },
205#endif
202 206
203 /* RS7112 */ 207 /* RS7112 */
204 { "Conexant LANfinity", 256, 0x0001ebef, 208 { "Conexant LANfinity", 256, 0x0001ebef,
@@ -207,7 +211,7 @@ struct tulip_chip_table tulip_tbl[] = {
207}; 211};
208 212
209 213
210static struct pci_device_id tulip_pci_tbl[] = { 214static DEFINE_PCI_DEVICE_TABLE(tulip_pci_tbl) = {
211 { 0x1011, 0x0009, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DC21140 }, 215 { 0x1011, 0x0009, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DC21140 },
212 { 0x1011, 0x0019, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DC21143 }, 216 { 0x1011, 0x0019, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DC21143 },
213 { 0x11AD, 0x0002, PCI_ANY_ID, PCI_ANY_ID, 0, 0, LC82C168 }, 217 { 0x11AD, 0x0002, PCI_ANY_ID, PCI_ANY_ID, 0, 0, LC82C168 },
@@ -228,8 +232,10 @@ static struct pci_device_id tulip_pci_tbl[] = {
228 { 0x1259, 0xa120, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET }, 232 { 0x1259, 0xa120, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET },
229 { 0x11F6, 0x9881, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMPEX9881 }, 233 { 0x11F6, 0x9881, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMPEX9881 },
230 { 0x8086, 0x0039, PCI_ANY_ID, PCI_ANY_ID, 0, 0, I21145 }, 234 { 0x8086, 0x0039, PCI_ANY_ID, PCI_ANY_ID, 0, 0, I21145 },
235#ifdef CONFIG_TULIP_DM910X
231 { 0x1282, 0x9100, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DM910X }, 236 { 0x1282, 0x9100, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DM910X },
232 { 0x1282, 0x9102, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DM910X }, 237 { 0x1282, 0x9102, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DM910X },
238#endif
233 { 0x1113, 0x1216, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET }, 239 { 0x1113, 0x1216, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET },
234 { 0x1113, 0x1217, PCI_ANY_ID, PCI_ANY_ID, 0, 0, MX98715 }, 240 { 0x1113, 0x1217, PCI_ANY_ID, PCI_ANY_ID, 0, 0, MX98715 },
235 { 0x1113, 0x9511, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET }, 241 { 0x1113, 0x9511, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET },
@@ -243,6 +249,7 @@ static struct pci_device_id tulip_pci_tbl[] = {
243 { 0x17B3, 0xAB08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET }, 249 { 0x17B3, 0xAB08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET },
244 { 0x10b7, 0x9300, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET }, /* 3Com 3CSOHO100B-TX */ 250 { 0x10b7, 0x9300, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET }, /* 3Com 3CSOHO100B-TX */
245 { 0x14ea, 0xab08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET }, /* Planex FNW-3602-TX */ 251 { 0x14ea, 0xab08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET }, /* Planex FNW-3602-TX */
252 { 0x1414, 0x0001, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET }, /* Microsoft MN-120 */
246 { 0x1414, 0x0002, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET }, 253 { 0x1414, 0x0002, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET },
247 { } /* terminate list */ 254 { } /* terminate list */
248}; 255};
@@ -319,7 +326,8 @@ static void tulip_up(struct net_device *dev)
319 udelay(100); 326 udelay(100);
320 327
321 if (tulip_debug > 1) 328 if (tulip_debug > 1)
322 printk(KERN_DEBUG "%s: tulip_up(), irq==%d.\n", dev->name, dev->irq); 329 printk(KERN_DEBUG "%s: tulip_up(), irq==%d\n",
330 dev->name, dev->irq);
323 331
324 iowrite32(tp->rx_ring_dma, ioaddr + CSR3); 332 iowrite32(tp->rx_ring_dma, ioaddr + CSR3);
325 iowrite32(tp->tx_ring_dma, ioaddr + CSR4); 333 iowrite32(tp->tx_ring_dma, ioaddr + CSR4);
@@ -380,8 +388,9 @@ static void tulip_up(struct net_device *dev)
380 (dev->if_port == 12 ? 0 : dev->if_port); 388 (dev->if_port == 12 ? 0 : dev->if_port);
381 for (i = 0; i < tp->mtable->leafcount; i++) 389 for (i = 0; i < tp->mtable->leafcount; i++)
382 if (tp->mtable->mleaf[i].media == looking_for) { 390 if (tp->mtable->mleaf[i].media == looking_for) {
383 printk(KERN_INFO "%s: Using user-specified media %s.\n", 391 dev_info(&dev->dev,
384 dev->name, medianame[dev->if_port]); 392 "Using user-specified media %s\n",
393 medianame[dev->if_port]);
385 goto media_picked; 394 goto media_picked;
386 } 395 }
387 } 396 }
@@ -389,8 +398,9 @@ static void tulip_up(struct net_device *dev)
389 int looking_for = tp->mtable->defaultmedia & MEDIA_MASK; 398 int looking_for = tp->mtable->defaultmedia & MEDIA_MASK;
390 for (i = 0; i < tp->mtable->leafcount; i++) 399 for (i = 0; i < tp->mtable->leafcount; i++)
391 if (tp->mtable->mleaf[i].media == looking_for) { 400 if (tp->mtable->mleaf[i].media == looking_for) {
392 printk(KERN_INFO "%s: Using EEPROM-set media %s.\n", 401 dev_info(&dev->dev,
393 dev->name, medianame[looking_for]); 402 "Using EEPROM-set media %s\n",
403 medianame[looking_for]);
394 goto media_picked; 404 goto media_picked;
395 } 405 }
396 } 406 }
@@ -417,9 +427,10 @@ media_picked:
417 if (tp->mii_cnt) { 427 if (tp->mii_cnt) {
418 tulip_select_media(dev, 1); 428 tulip_select_media(dev, 1);
419 if (tulip_debug > 1) 429 if (tulip_debug > 1)
420 printk(KERN_INFO "%s: Using MII transceiver %d, status " 430 dev_info(&dev->dev,
421 "%4.4x.\n", 431 "Using MII transceiver %d, status %04x\n",
422 dev->name, tp->phys[0], tulip_mdio_read(dev, tp->phys[0], 1)); 432 tp->phys[0],
433 tulip_mdio_read(dev, tp->phys[0], 1));
423 iowrite32(csr6_mask_defstate, ioaddr + CSR6); 434 iowrite32(csr6_mask_defstate, ioaddr + CSR6);
424 tp->csr6 = csr6_mask_hdcap; 435 tp->csr6 = csr6_mask_hdcap;
425 dev->if_port = 11; 436 dev->if_port = 11;
@@ -449,8 +460,8 @@ media_picked:
449 iowrite32(0x0201B078, ioaddr + 0xB8); 460 iowrite32(0x0201B078, ioaddr + 0xB8);
450 next_tick = 1*HZ; 461 next_tick = 1*HZ;
451 } 462 }
452 } else if ((tp->chip_id == MX98713 || tp->chip_id == COMPEX9881) 463 } else if ((tp->chip_id == MX98713 || tp->chip_id == COMPEX9881) &&
453 && ! tp->medialock) { 464 ! tp->medialock) {
454 dev->if_port = 0; 465 dev->if_port = 0;
455 tp->csr6 = 0x01880000 | (tp->full_duplex ? 0x0200 : 0); 466 tp->csr6 = 0x01880000 | (tp->full_duplex ? 0x0200 : 0);
456 iowrite32(0x0f370000 | ioread16(ioaddr + 0x80), ioaddr + 0x80); 467 iowrite32(0x0f370000 | ioread16(ioaddr + 0x80), ioaddr + 0x80);
@@ -483,9 +494,10 @@ media_picked:
483 iowrite32(0, ioaddr + CSR2); /* Rx poll demand */ 494 iowrite32(0, ioaddr + CSR2); /* Rx poll demand */
484 495
485 if (tulip_debug > 2) { 496 if (tulip_debug > 2) {
486 printk(KERN_DEBUG "%s: Done tulip_up(), CSR0 %8.8x, CSR5 %8.8x CSR6 %8.8x.\n", 497 printk(KERN_DEBUG "%s: Done tulip_up(), CSR0 %08x, CSR5 %08x CSR6 %08x\n",
487 dev->name, ioread32(ioaddr + CSR0), ioread32(ioaddr + CSR5), 498 dev->name, ioread32(ioaddr + CSR0),
488 ioread32(ioaddr + CSR6)); 499 ioread32(ioaddr + CSR5),
500 ioread32(ioaddr + CSR6));
489 } 501 }
490 502
491 /* Set the timer to switch to check for link beat and perhaps switch 503 /* Set the timer to switch to check for link beat and perhaps switch
@@ -506,7 +518,7 @@ tulip_open(struct net_device *dev)
506 518
507 tulip_init_ring (dev); 519 tulip_init_ring (dev);
508 520
509 retval = request_irq(dev->irq, &tulip_interrupt, IRQF_SHARED, dev->name, dev); 521 retval = request_irq(dev->irq, tulip_interrupt, IRQF_SHARED, dev->name, dev);
510 if (retval) 522 if (retval)
511 goto free_ring; 523 goto free_ring;
512 524
@@ -533,27 +545,30 @@ static void tulip_tx_timeout(struct net_device *dev)
533 if (tulip_media_cap[dev->if_port] & MediaIsMII) { 545 if (tulip_media_cap[dev->if_port] & MediaIsMII) {
534 /* Do nothing -- the media monitor should handle this. */ 546 /* Do nothing -- the media monitor should handle this. */
535 if (tulip_debug > 1) 547 if (tulip_debug > 1)
536 printk(KERN_WARNING "%s: Transmit timeout using MII device.\n", 548 dev_warn(&dev->dev,
537 dev->name); 549 "Transmit timeout using MII device\n");
538 } else if (tp->chip_id == DC21140 || tp->chip_id == DC21142 550 } else if (tp->chip_id == DC21140 || tp->chip_id == DC21142 ||
539 || tp->chip_id == MX98713 || tp->chip_id == COMPEX9881 551 tp->chip_id == MX98713 || tp->chip_id == COMPEX9881 ||
540 || tp->chip_id == DM910X) { 552 tp->chip_id == DM910X) {
541 printk(KERN_WARNING "%s: 21140 transmit timed out, status %8.8x, " 553 dev_warn(&dev->dev,
542 "SIA %8.8x %8.8x %8.8x %8.8x, resetting...\n", 554 "21140 transmit timed out, status %08x, SIA %08x %08x %08x %08x, resetting...\n",
543 dev->name, ioread32(ioaddr + CSR5), ioread32(ioaddr + CSR12), 555 ioread32(ioaddr + CSR5), ioread32(ioaddr + CSR12),
544 ioread32(ioaddr + CSR13), ioread32(ioaddr + CSR14), ioread32(ioaddr + CSR15)); 556 ioread32(ioaddr + CSR13), ioread32(ioaddr + CSR14),
557 ioread32(ioaddr + CSR15));
545 tp->timeout_recovery = 1; 558 tp->timeout_recovery = 1;
546 schedule_work(&tp->media_work); 559 schedule_work(&tp->media_work);
547 goto out_unlock; 560 goto out_unlock;
548 } else if (tp->chip_id == PNIC2) { 561 } else if (tp->chip_id == PNIC2) {
549 printk(KERN_WARNING "%s: PNIC2 transmit timed out, status %8.8x, " 562 dev_warn(&dev->dev,
550 "CSR6/7 %8.8x / %8.8x CSR12 %8.8x, resetting...\n", 563 "PNIC2 transmit timed out, status %08x, CSR6/7 %08x / %08x CSR12 %08x, resetting...\n",
551 dev->name, (int)ioread32(ioaddr + CSR5), (int)ioread32(ioaddr + CSR6), 564 (int)ioread32(ioaddr + CSR5),
552 (int)ioread32(ioaddr + CSR7), (int)ioread32(ioaddr + CSR12)); 565 (int)ioread32(ioaddr + CSR6),
566 (int)ioread32(ioaddr + CSR7),
567 (int)ioread32(ioaddr + CSR12));
553 } else { 568 } else {
554 printk(KERN_WARNING "%s: Transmit timed out, status %8.8x, CSR12 " 569 dev_warn(&dev->dev,
555 "%8.8x, resetting...\n", 570 "Transmit timed out, status %08x, CSR12 %08x, resetting...\n",
556 dev->name, ioread32(ioaddr + CSR5), ioread32(ioaddr + CSR12)); 571 ioread32(ioaddr + CSR5), ioread32(ioaddr + CSR12));
557 dev->if_port = 0; 572 dev->if_port = 0;
558 } 573 }
559 574
@@ -563,26 +578,26 @@ static void tulip_tx_timeout(struct net_device *dev)
563 for (i = 0; i < RX_RING_SIZE; i++) { 578 for (i = 0; i < RX_RING_SIZE; i++) {
564 u8 *buf = (u8 *)(tp->rx_ring[i].buffer1); 579 u8 *buf = (u8 *)(tp->rx_ring[i].buffer1);
565 int j; 580 int j;
566 printk(KERN_DEBUG "%2d: %8.8x %8.8x %8.8x %8.8x " 581 printk(KERN_DEBUG
567 "%2.2x %2.2x %2.2x.\n", 582 "%2d: %08x %08x %08x %08x %02x %02x %02x\n",
568 i, (unsigned int)tp->rx_ring[i].status, 583 i,
569 (unsigned int)tp->rx_ring[i].length, 584 (unsigned int)tp->rx_ring[i].status,
570 (unsigned int)tp->rx_ring[i].buffer1, 585 (unsigned int)tp->rx_ring[i].length,
571 (unsigned int)tp->rx_ring[i].buffer2, 586 (unsigned int)tp->rx_ring[i].buffer1,
572 buf[0], buf[1], buf[2]); 587 (unsigned int)tp->rx_ring[i].buffer2,
588 buf[0], buf[1], buf[2]);
573 for (j = 0; buf[j] != 0xee && j < 1600; j++) 589 for (j = 0; buf[j] != 0xee && j < 1600; j++)
574 if (j < 100) 590 if (j < 100)
575 printk(KERN_CONT " %2.2x", buf[j]); 591 pr_cont(" %02x", buf[j]);
576 printk(KERN_CONT " j=%d.\n", j); 592 pr_cont(" j=%d\n", j);
577 } 593 }
578 printk(KERN_DEBUG " Rx ring %8.8x: ", (int)tp->rx_ring); 594 printk(KERN_DEBUG " Rx ring %08x: ", (int)tp->rx_ring);
579 for (i = 0; i < RX_RING_SIZE; i++) 595 for (i = 0; i < RX_RING_SIZE; i++)
580 printk(KERN_CONT " %8.8x", 596 pr_cont(" %08x", (unsigned int)tp->rx_ring[i].status);
581 (unsigned int)tp->rx_ring[i].status); 597 printk(KERN_DEBUG " Tx ring %08x: ", (int)tp->tx_ring);
582 printk(KERN_DEBUG " Tx ring %8.8x: ", (int)tp->tx_ring);
583 for (i = 0; i < TX_RING_SIZE; i++) 598 for (i = 0; i < TX_RING_SIZE; i++)
584 printk(KERN_CONT " %8.8x", (unsigned int)tp->tx_ring[i].status); 599 pr_cont(" %08x", (unsigned int)tp->tx_ring[i].status);
585 printk(KERN_CONT "\n"); 600 pr_cont("\n");
586 } 601 }
587#endif 602#endif
588 603
@@ -825,8 +840,9 @@ static int tulip_close (struct net_device *dev)
825 tulip_down (dev); 840 tulip_down (dev);
826 841
827 if (tulip_debug > 1) 842 if (tulip_debug > 1)
828 printk (KERN_DEBUG "%s: Shutting down ethercard, status was %2.2x.\n", 843 dev_printk(KERN_DEBUG, &dev->dev,
829 dev->name, ioread32 (ioaddr + CSR5)); 844 "Shutting down ethercard, status was %02x\n",
845 ioread32 (ioaddr + CSR5));
830 846
831 free_irq (dev->irq, dev); 847 free_irq (dev->irq, dev);
832 848
@@ -982,12 +998,10 @@ static void build_setup_frame_hash(u16 *setup_frm, struct net_device *dev)
982 memset(hash_table, 0, sizeof(hash_table)); 998 memset(hash_table, 0, sizeof(hash_table));
983 set_bit_le(255, hash_table); /* Broadcast entry */ 999 set_bit_le(255, hash_table); /* Broadcast entry */
984 /* This should work on big-endian machines as well. */ 1000 /* This should work on big-endian machines as well. */
985 for (i = 0, mclist = dev->mc_list; mclist && i < dev->mc_count; 1001 netdev_for_each_mc_addr(mclist, dev) {
986 i++, mclist = mclist->next) {
987 int index = ether_crc_le(ETH_ALEN, mclist->dmi_addr) & 0x1ff; 1002 int index = ether_crc_le(ETH_ALEN, mclist->dmi_addr) & 0x1ff;
988 1003
989 set_bit_le(index, hash_table); 1004 set_bit_le(index, hash_table);
990
991 } 1005 }
992 for (i = 0; i < 32; i++) { 1006 for (i = 0; i < 32; i++) {
993 *setup_frm++ = hash_table[i]; 1007 *setup_frm++ = hash_table[i];
@@ -1006,20 +1020,18 @@ static void build_setup_frame_perfect(u16 *setup_frm, struct net_device *dev)
1006{ 1020{
1007 struct tulip_private *tp = netdev_priv(dev); 1021 struct tulip_private *tp = netdev_priv(dev);
1008 struct dev_mc_list *mclist; 1022 struct dev_mc_list *mclist;
1009 int i;
1010 u16 *eaddrs; 1023 u16 *eaddrs;
1011 1024
1012 /* We have <= 14 addresses so we can use the wonderful 1025 /* We have <= 14 addresses so we can use the wonderful
1013 16 address perfect filtering of the Tulip. */ 1026 16 address perfect filtering of the Tulip. */
1014 for (i = 0, mclist = dev->mc_list; i < dev->mc_count; 1027 netdev_for_each_mc_addr(mclist, dev) {
1015 i++, mclist = mclist->next) {
1016 eaddrs = (u16 *)mclist->dmi_addr; 1028 eaddrs = (u16 *)mclist->dmi_addr;
1017 *setup_frm++ = *eaddrs; *setup_frm++ = *eaddrs++; 1029 *setup_frm++ = *eaddrs; *setup_frm++ = *eaddrs++;
1018 *setup_frm++ = *eaddrs; *setup_frm++ = *eaddrs++; 1030 *setup_frm++ = *eaddrs; *setup_frm++ = *eaddrs++;
1019 *setup_frm++ = *eaddrs; *setup_frm++ = *eaddrs++; 1031 *setup_frm++ = *eaddrs; *setup_frm++ = *eaddrs++;
1020 } 1032 }
1021 /* Fill the unused entries with the broadcast address. */ 1033 /* Fill the unused entries with the broadcast address. */
1022 memset(setup_frm, 0xff, (15-i)*12); 1034 memset(setup_frm, 0xff, (15 - netdev_mc_count(dev)) * 12);
1023 setup_frm = &tp->setup_frame[15*6]; 1035 setup_frm = &tp->setup_frame[15*6];
1024 1036
1025 /* Fill the final entry with our physical address. */ 1037 /* Fill the final entry with our physical address. */
@@ -1042,7 +1054,8 @@ static void set_rx_mode(struct net_device *dev)
1042 if (dev->flags & IFF_PROMISC) { /* Set promiscuous. */ 1054 if (dev->flags & IFF_PROMISC) { /* Set promiscuous. */
1043 tp->csr6 |= AcceptAllMulticast | AcceptAllPhys; 1055 tp->csr6 |= AcceptAllMulticast | AcceptAllPhys;
1044 csr6 |= AcceptAllMulticast | AcceptAllPhys; 1056 csr6 |= AcceptAllMulticast | AcceptAllPhys;
1045 } else if ((dev->mc_count > 1000) || (dev->flags & IFF_ALLMULTI)) { 1057 } else if ((netdev_mc_count(dev) > 1000) ||
1058 (dev->flags & IFF_ALLMULTI)) {
1046 /* Too many to filter well -- accept all multicasts. */ 1059 /* Too many to filter well -- accept all multicasts. */
1047 tp->csr6 |= AcceptAllMulticast; 1060 tp->csr6 |= AcceptAllMulticast;
1048 csr6 |= AcceptAllMulticast; 1061 csr6 |= AcceptAllMulticast;
@@ -1050,15 +1063,14 @@ static void set_rx_mode(struct net_device *dev)
1050 /* Some work-alikes have only a 64-entry hash filter table. */ 1063 /* Some work-alikes have only a 64-entry hash filter table. */
1051 /* Should verify correctness on big-endian/__powerpc__ */ 1064 /* Should verify correctness on big-endian/__powerpc__ */
1052 struct dev_mc_list *mclist; 1065 struct dev_mc_list *mclist;
1053 int i; 1066 if (netdev_mc_count(dev) > 64) {
1054 if (dev->mc_count > 64) { /* Arbitrary non-effective limit. */ 1067 /* Arbitrary non-effective limit. */
1055 tp->csr6 |= AcceptAllMulticast; 1068 tp->csr6 |= AcceptAllMulticast;
1056 csr6 |= AcceptAllMulticast; 1069 csr6 |= AcceptAllMulticast;
1057 } else { 1070 } else {
1058 u32 mc_filter[2] = {0, 0}; /* Multicast hash filter */ 1071 u32 mc_filter[2] = {0, 0}; /* Multicast hash filter */
1059 int filterbit; 1072 int filterbit;
1060 for (i = 0, mclist = dev->mc_list; mclist && i < dev->mc_count; 1073 netdev_for_each_mc_addr(mclist, dev) {
1061 i++, mclist = mclist->next) {
1062 if (tp->flags & COMET_MAC_ADDR) 1074 if (tp->flags & COMET_MAC_ADDR)
1063 filterbit = ether_crc_le(ETH_ALEN, mclist->dmi_addr); 1075 filterbit = ether_crc_le(ETH_ALEN, mclist->dmi_addr);
1064 else 1076 else
@@ -1066,10 +1078,10 @@ static void set_rx_mode(struct net_device *dev)
1066 filterbit &= 0x3f; 1078 filterbit &= 0x3f;
1067 mc_filter[filterbit >> 5] |= 1 << (filterbit & 31); 1079 mc_filter[filterbit >> 5] |= 1 << (filterbit & 31);
1068 if (tulip_debug > 2) 1080 if (tulip_debug > 2)
1069 printk(KERN_INFO "%s: Added filter for %pM" 1081 dev_info(&dev->dev,
1070 " %8.8x bit %d.\n", 1082 "Added filter for %pM %08x bit %d\n",
1071 dev->name, mclist->dmi_addr, 1083 mclist->dmi_addr,
1072 ether_crc(ETH_ALEN, mclist->dmi_addr), filterbit); 1084 ether_crc(ETH_ALEN, mclist->dmi_addr), filterbit);
1073 } 1085 }
1074 if (mc_filter[0] == tp->mc_filter[0] && 1086 if (mc_filter[0] == tp->mc_filter[0] &&
1075 mc_filter[1] == tp->mc_filter[1]) 1087 mc_filter[1] == tp->mc_filter[1])
@@ -1092,7 +1104,8 @@ static void set_rx_mode(struct net_device *dev)
1092 1104
1093 /* Note that only the low-address shortword of setup_frame is valid! 1105 /* Note that only the low-address shortword of setup_frame is valid!
1094 The values are doubled for big-endian architectures. */ 1106 The values are doubled for big-endian architectures. */
1095 if (dev->mc_count > 14) { /* Must use a multicast hash table. */ 1107 if (netdev_mc_count(dev) > 14) {
1108 /* Must use a multicast hash table. */
1096 build_setup_frame_hash(tp->setup_frame, dev); 1109 build_setup_frame_hash(tp->setup_frame, dev);
1097 tx_flags = 0x08400000 | 192; 1110 tx_flags = 0x08400000 | 192;
1098 } else { 1111 } else {
@@ -1281,9 +1294,8 @@ static int __devinit tulip_init_one (struct pci_dev *pdev,
1281 unsigned int force_csr0 = 0; 1294 unsigned int force_csr0 = 0;
1282 1295
1283#ifndef MODULE 1296#ifndef MODULE
1284 static int did_version; /* Already printed version info. */ 1297 if (tulip_debug > 0)
1285 if (tulip_debug > 0 && did_version++ == 0) 1298 printk_once(KERN_INFO "%s", version);
1286 printk (KERN_INFO "%s", version);
1287#endif 1299#endif
1288 1300
1289 board_idx++; 1301 board_idx++;
@@ -1294,23 +1306,33 @@ static int __devinit tulip_init_one (struct pci_dev *pdev,
1294 */ 1306 */
1295 1307
1296 if (pdev->subsystem_vendor == PCI_VENDOR_ID_LMC) { 1308 if (pdev->subsystem_vendor == PCI_VENDOR_ID_LMC) {
1297 printk (KERN_ERR PFX "skipping LMC card.\n"); 1309 pr_err(PFX "skipping LMC card\n");
1298 return -ENODEV; 1310 return -ENODEV;
1299 } 1311 }
1300 1312
1301 /* 1313 /*
1302 * Early DM9100's need software CRC and the DMFE driver 1314 * DM910x chips should be handled by the dmfe driver, except
1315 * on-board chips on SPARC systems. Also, early DM9100s need
1316 * software CRC which only the dmfe driver supports.
1303 */ 1317 */
1304 1318
1305 if (pdev->vendor == 0x1282 && pdev->device == 0x9100) 1319#ifdef CONFIG_TULIP_DM910X
1306 { 1320 if (chip_idx == DM910X) {
1307 /* Read Chip revision */ 1321 struct device_node *dp;
1308 if (pdev->revision < 0x30) 1322
1309 { 1323 if (pdev->vendor == 0x1282 && pdev->device == 0x9100 &&
1310 printk(KERN_ERR PFX "skipping early DM9100 with Crc bug (use dmfe)\n"); 1324 pdev->revision < 0x30) {
1325 pr_info(PFX "skipping early DM9100 with Crc bug (use dmfe)\n");
1326 return -ENODEV;
1327 }
1328
1329 dp = pci_device_to_OF_node(pdev);
1330 if (!(dp && of_get_property(dp, "local-mac-address", NULL))) {
1331 pr_info(PFX "skipping DM910x expansion card (use dmfe)\n");
1311 return -ENODEV; 1332 return -ENODEV;
1312 } 1333 }
1313 } 1334 }
1335#endif
1314 1336
1315 /* 1337 /*
1316 * Looks for early PCI chipsets where people report hangs 1338 * Looks for early PCI chipsets where people report hangs
@@ -1353,9 +1375,8 @@ static int __devinit tulip_init_one (struct pci_dev *pdev,
1353 1375
1354 i = pci_enable_device(pdev); 1376 i = pci_enable_device(pdev);
1355 if (i) { 1377 if (i) {
1356 printk (KERN_ERR PFX 1378 pr_err(PFX "Cannot enable tulip board #%d, aborting\n",
1357 "Cannot enable tulip board #%d, aborting\n", 1379 board_idx);
1358 board_idx);
1359 return i; 1380 return i;
1360 } 1381 }
1361 1382
@@ -1364,22 +1385,22 @@ static int __devinit tulip_init_one (struct pci_dev *pdev,
1364 /* alloc_etherdev ensures aligned and zeroed private structures */ 1385 /* alloc_etherdev ensures aligned and zeroed private structures */
1365 dev = alloc_etherdev (sizeof (*tp)); 1386 dev = alloc_etherdev (sizeof (*tp));
1366 if (!dev) { 1387 if (!dev) {
1367 printk (KERN_ERR PFX "ether device alloc failed, aborting\n"); 1388 pr_err(PFX "ether device alloc failed, aborting\n");
1368 return -ENOMEM; 1389 return -ENOMEM;
1369 } 1390 }
1370 1391
1371 SET_NETDEV_DEV(dev, &pdev->dev); 1392 SET_NETDEV_DEV(dev, &pdev->dev);
1372 if (pci_resource_len (pdev, 0) < tulip_tbl[chip_idx].io_size) { 1393 if (pci_resource_len (pdev, 0) < tulip_tbl[chip_idx].io_size) {
1373 printk (KERN_ERR PFX "%s: I/O region (0x%llx@0x%llx) too small, " 1394 pr_err(PFX "%s: I/O region (0x%llx@0x%llx) too small, aborting\n",
1374 "aborting\n", pci_name(pdev), 1395 pci_name(pdev),
1375 (unsigned long long)pci_resource_len (pdev, 0), 1396 (unsigned long long)pci_resource_len (pdev, 0),
1376 (unsigned long long)pci_resource_start (pdev, 0)); 1397 (unsigned long long)pci_resource_start (pdev, 0));
1377 goto err_out_free_netdev; 1398 goto err_out_free_netdev;
1378 } 1399 }
1379 1400
1380 /* grab all resources from both PIO and MMIO regions, as we 1401 /* grab all resources from both PIO and MMIO regions, as we
1381 * don't want anyone else messing around with our hardware */ 1402 * don't want anyone else messing around with our hardware */
1382 if (pci_request_regions (pdev, "tulip")) 1403 if (pci_request_regions (pdev, DRV_NAME))
1383 goto err_out_free_netdev; 1404 goto err_out_free_netdev;
1384 1405
1385 ioaddr = pci_iomap(pdev, TULIP_BAR, tulip_tbl[chip_idx].io_size); 1406 ioaddr = pci_iomap(pdev, TULIP_BAR, tulip_tbl[chip_idx].io_size);
@@ -1538,8 +1559,10 @@ static int __devinit tulip_init_one (struct pci_dev *pdev,
1538 } 1559 }
1539 } 1560 }
1540 /* Lite-On boards have the address byte-swapped. */ 1561 /* Lite-On boards have the address byte-swapped. */
1541 if ((dev->dev_addr[0] == 0xA0 || dev->dev_addr[0] == 0xC0 || dev->dev_addr[0] == 0x02) 1562 if ((dev->dev_addr[0] == 0xA0 ||
1542 && dev->dev_addr[1] == 0x00) 1563 dev->dev_addr[0] == 0xC0 ||
1564 dev->dev_addr[0] == 0x02) &&
1565 dev->dev_addr[1] == 0x00)
1543 for (i = 0; i < 6; i+=2) { 1566 for (i = 0; i < 6; i+=2) {
1544 char tmp = dev->dev_addr[i]; 1567 char tmp = dev->dev_addr[i];
1545 dev->dev_addr[i] = dev->dev_addr[i+1]; 1568 dev->dev_addr[i] = dev->dev_addr[i+1];
@@ -1590,8 +1613,8 @@ static int __devinit tulip_init_one (struct pci_dev *pdev,
1590 if (dev->mem_start & MEDIA_MASK) 1613 if (dev->mem_start & MEDIA_MASK)
1591 tp->default_port = dev->mem_start & MEDIA_MASK; 1614 tp->default_port = dev->mem_start & MEDIA_MASK;
1592 if (tp->default_port) { 1615 if (tp->default_port) {
1593 printk(KERN_INFO "tulip%d: Transceiver selection forced to %s.\n", 1616 pr_info(DRV_NAME "%d: Transceiver selection forced to %s\n",
1594 board_idx, medianame[tp->default_port & MEDIA_MASK]); 1617 board_idx, medianame[tp->default_port & MEDIA_MASK]);
1595 tp->medialock = 1; 1618 tp->medialock = 1;
1596 if (tulip_media_cap[tp->default_port] & MediaAlwaysFD) 1619 if (tulip_media_cap[tp->default_port] & MediaAlwaysFD)
1597 tp->full_duplex = 1; 1620 tp->full_duplex = 1;
@@ -1606,7 +1629,7 @@ static int __devinit tulip_init_one (struct pci_dev *pdev,
1606 } 1629 }
1607 1630
1608 if (tp->flags & HAS_MEDIA_TABLE) { 1631 if (tp->flags & HAS_MEDIA_TABLE) {
1609 sprintf(dev->name, "tulip%d", board_idx); /* hack */ 1632 sprintf(dev->name, DRV_NAME "%d", board_idx); /* hack */
1610 tulip_parse_eeprom(dev); 1633 tulip_parse_eeprom(dev);
1611 strcpy(dev->name, "eth%d"); /* un-hack */ 1634 strcpy(dev->name, "eth%d"); /* un-hack */
1612 } 1635 }
@@ -1642,20 +1665,18 @@ static int __devinit tulip_init_one (struct pci_dev *pdev,
1642 if (register_netdev(dev)) 1665 if (register_netdev(dev))
1643 goto err_out_free_ring; 1666 goto err_out_free_ring;
1644 1667
1645 printk(KERN_INFO "%s: %s rev %d at " 1668 pci_set_drvdata(pdev, dev);
1669
1670 dev_info(&dev->dev,
1646#ifdef CONFIG_TULIP_MMIO 1671#ifdef CONFIG_TULIP_MMIO
1647 "MMIO" 1672 "%s rev %d at MMIO %#llx,%s %pM, IRQ %d\n",
1648#else 1673#else
1649 "Port" 1674 "%s rev %d at Port %#llx,%s %pM, IRQ %d\n",
1650#endif 1675#endif
1651 " %#llx,", dev->name, chip_name, pdev->revision, 1676 chip_name, pdev->revision,
1652 (unsigned long long) pci_resource_start(pdev, TULIP_BAR)); 1677 (unsigned long long)pci_resource_start(pdev, TULIP_BAR),
1653 pci_set_drvdata(pdev, dev); 1678 eeprom_missing ? " EEPROM not present," : "",
1654 1679 dev->dev_addr, irq);
1655 if (eeprom_missing)
1656 printk(" EEPROM not present,");
1657 printk(" %pM", dev->dev_addr);
1658 printk(", IRQ %d.\n", irq);
1659 1680
1660 if (tp->chip_id == PNIC2) 1681 if (tp->chip_id == PNIC2)
1661 tp->link_change = pnic2_lnk_change; 1682 tp->link_change = pnic2_lnk_change;
@@ -1778,12 +1799,12 @@ static int tulip_resume(struct pci_dev *pdev)
1778 return 0; 1799 return 0;
1779 1800
1780 if ((retval = pci_enable_device(pdev))) { 1801 if ((retval = pci_enable_device(pdev))) {
1781 printk (KERN_ERR "tulip: pci_enable_device failed in resume\n"); 1802 pr_err(PFX "pci_enable_device failed in resume\n");
1782 return retval; 1803 return retval;
1783 } 1804 }
1784 1805
1785 if ((retval = request_irq(dev->irq, &tulip_interrupt, IRQF_SHARED, dev->name, dev))) { 1806 if ((retval = request_irq(dev->irq, tulip_interrupt, IRQF_SHARED, dev->name, dev))) {
1786 printk (KERN_ERR "tulip: request_irq failed in resume\n"); 1807 pr_err(PFX "request_irq failed in resume\n");
1787 return retval; 1808 return retval;
1788 } 1809 }
1789 1810
@@ -1853,7 +1874,7 @@ static struct pci_driver tulip_driver = {
1853static int __init tulip_init (void) 1874static int __init tulip_init (void)
1854{ 1875{
1855#ifdef MODULE 1876#ifdef MODULE
1856 printk (KERN_INFO "%s", version); 1877 pr_info("%s", version);
1857#endif 1878#endif
1858 1879
1859 /* copy module parms into globals */ 1880 /* copy module parms into globals */
diff --git a/drivers/net/tulip/uli526x.c b/drivers/net/tulip/uli526x.c
index c457a0ca55ad..a589dd34891e 100644
--- a/drivers/net/tulip/uli526x.c
+++ b/drivers/net/tulip/uli526x.c
@@ -12,6 +12,8 @@
12 12
13*/ 13*/
14 14
15#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
16
15#define DRV_NAME "uli526x" 17#define DRV_NAME "uli526x"
16#define DRV_VERSION "0.9.3" 18#define DRV_VERSION "0.9.3"
17#define DRV_RELDATE "2005-7-29" 19#define DRV_RELDATE "2005-7-29"
@@ -23,7 +25,6 @@
23#include <linux/timer.h> 25#include <linux/timer.h>
24#include <linux/errno.h> 26#include <linux/errno.h>
25#include <linux/ioport.h> 27#include <linux/ioport.h>
26#include <linux/slab.h>
27#include <linux/interrupt.h> 28#include <linux/interrupt.h>
28#include <linux/pci.h> 29#include <linux/pci.h>
29#include <linux/init.h> 30#include <linux/init.h>
@@ -82,9 +83,16 @@
82#define ULI526X_TX_TIMEOUT ((16*HZ)/2) /* tx packet time-out time 8 s" */ 83#define ULI526X_TX_TIMEOUT ((16*HZ)/2) /* tx packet time-out time 8 s" */
83#define ULI526X_TX_KICK (4*HZ/2) /* tx packet Kick-out time 2 s" */ 84#define ULI526X_TX_KICK (4*HZ/2) /* tx packet Kick-out time 2 s" */
84 85
85#define ULI526X_DBUG(dbug_now, msg, value) if (uli526x_debug || (dbug_now)) printk(KERN_ERR DRV_NAME ": %s %lx\n", (msg), (long) (value)) 86#define ULI526X_DBUG(dbug_now, msg, value) \
87do { \
88 if (uli526x_debug || (dbug_now)) \
89 pr_err("%s %lx\n", (msg), (long) (value)); \
90} while (0)
86 91
87#define SHOW_MEDIA_TYPE(mode) printk(KERN_ERR DRV_NAME ": Change Speed to %sMhz %s duplex\n",mode & 1 ?"100":"10", mode & 4 ? "full":"half"); 92#define SHOW_MEDIA_TYPE(mode) \
93 pr_err("Change Speed to %sMhz %s duplex\n", \
94 mode & 1 ? "100" : "10", \
95 mode & 4 ? "full" : "half");
88 96
89 97
90/* CR9 definition: SROM/MII */ 98/* CR9 definition: SROM/MII */
@@ -284,7 +292,7 @@ static int __devinit uli526x_init_one (struct pci_dev *pdev,
284 SET_NETDEV_DEV(dev, &pdev->dev); 292 SET_NETDEV_DEV(dev, &pdev->dev);
285 293
286 if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { 294 if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) {
287 printk(KERN_WARNING DRV_NAME ": 32-bit PCI DMA not available.\n"); 295 pr_warning("32-bit PCI DMA not available\n");
288 err = -ENODEV; 296 err = -ENODEV;
289 goto err_out_free; 297 goto err_out_free;
290 } 298 }
@@ -295,19 +303,19 @@ static int __devinit uli526x_init_one (struct pci_dev *pdev,
295 goto err_out_free; 303 goto err_out_free;
296 304
297 if (!pci_resource_start(pdev, 0)) { 305 if (!pci_resource_start(pdev, 0)) {
298 printk(KERN_ERR DRV_NAME ": I/O base is zero\n"); 306 pr_err("I/O base is zero\n");
299 err = -ENODEV; 307 err = -ENODEV;
300 goto err_out_disable; 308 goto err_out_disable;
301 } 309 }
302 310
303 if (pci_resource_len(pdev, 0) < (ULI526X_IO_SIZE) ) { 311 if (pci_resource_len(pdev, 0) < (ULI526X_IO_SIZE) ) {
304 printk(KERN_ERR DRV_NAME ": Allocated I/O size too small\n"); 312 pr_err("Allocated I/O size too small\n");
305 err = -ENODEV; 313 err = -ENODEV;
306 goto err_out_disable; 314 goto err_out_disable;
307 } 315 }
308 316
309 if (pci_request_regions(pdev, DRV_NAME)) { 317 if (pci_request_regions(pdev, DRV_NAME)) {
310 printk(KERN_ERR DRV_NAME ": Failed to request PCI regions\n"); 318 pr_err("Failed to request PCI regions\n");
311 err = -ENODEV; 319 err = -ENODEV;
312 goto err_out_disable; 320 goto err_out_disable;
313 } 321 }
@@ -382,9 +390,9 @@ static int __devinit uli526x_init_one (struct pci_dev *pdev,
382 if (err) 390 if (err)
383 goto err_out_res; 391 goto err_out_res;
384 392
385 printk(KERN_INFO "%s: ULi M%04lx at pci%s, %pM, irq %d.\n", 393 dev_info(&dev->dev, "ULi M%04lx at pci%s, %pM, irq %d\n",
386 dev->name,ent->driver_data >> 16,pci_name(pdev), 394 ent->driver_data >> 16, pci_name(pdev),
387 dev->dev_addr, dev->irq); 395 dev->dev_addr, dev->irq);
388 396
389 pci_set_master(pdev); 397 pci_set_master(pdev);
390 398
@@ -461,7 +469,7 @@ static int uli526x_open(struct net_device *dev)
461 /* Initialize ULI526X board */ 469 /* Initialize ULI526X board */
462 uli526x_init(dev); 470 uli526x_init(dev);
463 471
464 ret = request_irq(dev->irq, &uli526x_interrupt, IRQF_SHARED, dev->name, dev); 472 ret = request_irq(dev->irq, uli526x_interrupt, IRQF_SHARED, dev->name, dev);
465 if (ret) 473 if (ret)
466 return ret; 474 return ret;
467 475
@@ -516,7 +524,7 @@ static void uli526x_init(struct net_device *dev)
516 } 524 }
517 } 525 }
518 if(phy_tmp == 32) 526 if(phy_tmp == 32)
519 printk(KERN_WARNING "Can not find the phy address!!!"); 527 pr_warning("Can not find the phy address!!!");
520 /* Parser SROM and media mode */ 528 /* Parser SROM and media mode */
521 db->media_mode = uli526x_media_mode; 529 db->media_mode = uli526x_media_mode;
522 530
@@ -548,7 +556,7 @@ static void uli526x_init(struct net_device *dev)
548 update_cr6(db->cr6_data, ioaddr); 556 update_cr6(db->cr6_data, ioaddr);
549 557
550 /* Send setup frame */ 558 /* Send setup frame */
551 send_filter_frame(dev, dev->mc_count); /* M5261/M5263 */ 559 send_filter_frame(dev, netdev_mc_count(dev)); /* M5261/M5263 */
552 560
553 /* Init CR7, interrupt active bit */ 561 /* Init CR7, interrupt active bit */
554 db->cr7_data = CR7_DEFAULT; 562 db->cr7_data = CR7_DEFAULT;
@@ -582,7 +590,7 @@ static netdev_tx_t uli526x_start_xmit(struct sk_buff *skb,
582 590
583 /* Too large packet check */ 591 /* Too large packet check */
584 if (skb->len > MAX_PACKET_SIZE) { 592 if (skb->len > MAX_PACKET_SIZE) {
585 printk(KERN_ERR DRV_NAME ": big packet = %d\n", (u16)skb->len); 593 pr_err("big packet = %d\n", (u16)skb->len);
586 dev_kfree_skb(skb); 594 dev_kfree_skb(skb);
587 return NETDEV_TX_OK; 595 return NETDEV_TX_OK;
588 } 596 }
@@ -592,7 +600,7 @@ static netdev_tx_t uli526x_start_xmit(struct sk_buff *skb,
592 /* No Tx resource check, it never happen nromally */ 600 /* No Tx resource check, it never happen nromally */
593 if (db->tx_packet_cnt >= TX_FREE_DESC_CNT) { 601 if (db->tx_packet_cnt >= TX_FREE_DESC_CNT) {
594 spin_unlock_irqrestore(&db->lock, flags); 602 spin_unlock_irqrestore(&db->lock, flags);
595 printk(KERN_ERR DRV_NAME ": No Tx resource %ld\n", db->tx_packet_cnt); 603 pr_err("No Tx resource %ld\n", db->tx_packet_cnt);
596 return NETDEV_TX_BUSY; 604 return NETDEV_TX_BUSY;
597 } 605 }
598 606
@@ -842,13 +850,15 @@ static void uli526x_rx_packet(struct net_device *dev, struct uli526x_board_info
842 850
843 if ( !(rdes0 & 0x8000) || 851 if ( !(rdes0 & 0x8000) ||
844 ((db->cr6_data & CR6_PM) && (rxlen>6)) ) { 852 ((db->cr6_data & CR6_PM) && (rxlen>6)) ) {
853 struct sk_buff *new_skb = NULL;
854
845 skb = rxptr->rx_skb_ptr; 855 skb = rxptr->rx_skb_ptr;
846 856
847 /* Good packet, send to upper layer */ 857 /* Good packet, send to upper layer */
848 /* Shorst packet used new SKB */ 858 /* Shorst packet used new SKB */
849 if ( (rxlen < RX_COPY_SIZE) && 859 if ((rxlen < RX_COPY_SIZE) &&
850 ( (skb = dev_alloc_skb(rxlen + 2) ) 860 (((new_skb = dev_alloc_skb(rxlen + 2)) != NULL))) {
851 != NULL) ) { 861 skb = new_skb;
852 /* size less than COPY_SIZE, allocate a rxlen SKB */ 862 /* size less than COPY_SIZE, allocate a rxlen SKB */
853 skb_reserve(skb, 2); /* 16byte align */ 863 skb_reserve(skb, 2); /* 16byte align */
854 memcpy(skb_put(skb, rxlen), 864 memcpy(skb_put(skb, rxlen),
@@ -897,16 +907,18 @@ static void uli526x_set_filter_mode(struct net_device * dev)
897 return; 907 return;
898 } 908 }
899 909
900 if (dev->flags & IFF_ALLMULTI || dev->mc_count > ULI5261_MAX_MULTICAST) { 910 if (dev->flags & IFF_ALLMULTI ||
901 ULI526X_DBUG(0, "Pass all multicast address", dev->mc_count); 911 netdev_mc_count(dev) > ULI5261_MAX_MULTICAST) {
912 ULI526X_DBUG(0, "Pass all multicast address",
913 netdev_mc_count(dev));
902 db->cr6_data &= ~(CR6_PM | CR6_PBF); 914 db->cr6_data &= ~(CR6_PM | CR6_PBF);
903 db->cr6_data |= CR6_PAM; 915 db->cr6_data |= CR6_PAM;
904 spin_unlock_irqrestore(&db->lock, flags); 916 spin_unlock_irqrestore(&db->lock, flags);
905 return; 917 return;
906 } 918 }
907 919
908 ULI526X_DBUG(0, "Set multicast address", dev->mc_count); 920 ULI526X_DBUG(0, "Set multicast address", netdev_mc_count(dev));
909 send_filter_frame(dev, dev->mc_count); /* M5261/M5263 */ 921 send_filter_frame(dev, netdev_mc_count(dev)); /* M5261/M5263 */
910 spin_unlock_irqrestore(&db->lock, flags); 922 spin_unlock_irqrestore(&db->lock, flags);
911} 923}
912 924
@@ -1058,7 +1070,7 @@ static void uli526x_timer(unsigned long data)
1058 /* Link Failed */ 1070 /* Link Failed */
1059 ULI526X_DBUG(0, "Link Failed", tmp_cr12); 1071 ULI526X_DBUG(0, "Link Failed", tmp_cr12);
1060 netif_carrier_off(dev); 1072 netif_carrier_off(dev);
1061 printk(KERN_INFO "uli526x: %s NIC Link is Down\n",dev->name); 1073 pr_info("%s NIC Link is Down\n",dev->name);
1062 db->link_failed = 1; 1074 db->link_failed = 1;
1063 1075
1064 /* For Force 10/100M Half/Full mode: Enable Auto-Nego mode */ 1076 /* For Force 10/100M Half/Full mode: Enable Auto-Nego mode */
@@ -1090,11 +1102,11 @@ static void uli526x_timer(unsigned long data)
1090 } 1102 }
1091 if(db->op_mode==ULI526X_10MFD || db->op_mode==ULI526X_100MFD) 1103 if(db->op_mode==ULI526X_10MFD || db->op_mode==ULI526X_100MFD)
1092 { 1104 {
1093 printk(KERN_INFO "uli526x: %s NIC Link is Up %d Mbps Full duplex\n",dev->name,TmpSpeed); 1105 pr_info("%s NIC Link is Up %d Mbps Full duplex\n",dev->name,TmpSpeed);
1094 } 1106 }
1095 else 1107 else
1096 { 1108 {
1097 printk(KERN_INFO "uli526x: %s NIC Link is Up %d Mbps Half duplex\n",dev->name,TmpSpeed); 1109 pr_info("%s NIC Link is Up %d Mbps Half duplex\n",dev->name,TmpSpeed);
1098 } 1110 }
1099 netif_carrier_on(dev); 1111 netif_carrier_on(dev);
1100 } 1112 }
@@ -1104,7 +1116,7 @@ static void uli526x_timer(unsigned long data)
1104 { 1116 {
1105 if(db->init==1) 1117 if(db->init==1)
1106 { 1118 {
1107 printk(KERN_INFO "uli526x: %s NIC Link is Down\n",dev->name); 1119 pr_info("%s NIC Link is Down\n",dev->name);
1108 netif_carrier_off(dev); 1120 netif_carrier_off(dev);
1109 } 1121 }
1110 } 1122 }
@@ -1230,8 +1242,7 @@ static int uli526x_resume(struct pci_dev *pdev)
1230 1242
1231 err = pci_set_power_state(pdev, PCI_D0); 1243 err = pci_set_power_state(pdev, PCI_D0);
1232 if (err) { 1244 if (err) {
1233 printk(KERN_WARNING "%s: Could not put device into D0\n", 1245 dev_warn(&dev->dev, "Could not put device into D0\n");
1234 dev->name);
1235 return err; 1246 return err;
1236 } 1247 }
1237 1248
@@ -1405,14 +1416,14 @@ static void send_filter_frame(struct net_device *dev, int mc_cnt)
1405 *suptr++ = 0xffff << FLT_SHIFT; 1416 *suptr++ = 0xffff << FLT_SHIFT;
1406 1417
1407 /* fit the multicast address */ 1418 /* fit the multicast address */
1408 for (mcptr = dev->mc_list, i = 0; i < mc_cnt; i++, mcptr = mcptr->next) { 1419 netdev_for_each_mc_addr(mcptr, dev) {
1409 addrptr = (u16 *) mcptr->dmi_addr; 1420 addrptr = (u16 *) mcptr->dmi_addr;
1410 *suptr++ = addrptr[0] << FLT_SHIFT; 1421 *suptr++ = addrptr[0] << FLT_SHIFT;
1411 *suptr++ = addrptr[1] << FLT_SHIFT; 1422 *suptr++ = addrptr[1] << FLT_SHIFT;
1412 *suptr++ = addrptr[2] << FLT_SHIFT; 1423 *suptr++ = addrptr[2] << FLT_SHIFT;
1413 } 1424 }
1414 1425
1415 for (; i<14; i++) { 1426 for (i = netdev_mc_count(dev); i < 14; i++) {
1416 *suptr++ = 0xffff << FLT_SHIFT; 1427 *suptr++ = 0xffff << FLT_SHIFT;
1417 *suptr++ = 0xffff << FLT_SHIFT; 1428 *suptr++ = 0xffff << FLT_SHIFT;
1418 *suptr++ = 0xffff << FLT_SHIFT; 1429 *suptr++ = 0xffff << FLT_SHIFT;
@@ -1432,7 +1443,7 @@ static void send_filter_frame(struct net_device *dev, int mc_cnt)
1432 update_cr6(db->cr6_data, dev->base_addr); 1443 update_cr6(db->cr6_data, dev->base_addr);
1433 dev->trans_start = jiffies; 1444 dev->trans_start = jiffies;
1434 } else 1445 } else
1435 printk(KERN_ERR DRV_NAME ": No Tx resource - Send_filter_frame!\n"); 1446 pr_err("No Tx resource - Send_filter_frame!\n");
1436} 1447}
1437 1448
1438 1449
@@ -1783,7 +1794,7 @@ static u16 phy_read_1bit(unsigned long ioaddr, u32 chip_id)
1783} 1794}
1784 1795
1785 1796
1786static struct pci_device_id uli526x_pci_tbl[] = { 1797static DEFINE_PCI_DEVICE_TABLE(uli526x_pci_tbl) = {
1787 { 0x10B9, 0x5261, PCI_ANY_ID, PCI_ANY_ID, 0, 0, PCI_ULI5261_ID }, 1798 { 0x10B9, 0x5261, PCI_ANY_ID, PCI_ANY_ID, 0, 0, PCI_ULI5261_ID },
1788 { 0x10B9, 0x5263, PCI_ANY_ID, PCI_ANY_ID, 0, 0, PCI_ULI5263_ID }, 1799 { 0x10B9, 0x5263, PCI_ANY_ID, PCI_ANY_ID, 0, 0, PCI_ULI5263_ID },
1789 { 0, } 1800 { 0, }
diff --git a/drivers/net/tulip/winbond-840.c b/drivers/net/tulip/winbond-840.c
index b38d3b7f6e35..98dbf6cc1d68 100644
--- a/drivers/net/tulip/winbond-840.c
+++ b/drivers/net/tulip/winbond-840.c
@@ -114,7 +114,6 @@ static int full_duplex[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
114#include <linux/timer.h> 114#include <linux/timer.h>
115#include <linux/errno.h> 115#include <linux/errno.h>
116#include <linux/ioport.h> 116#include <linux/ioport.h>
117#include <linux/slab.h>
118#include <linux/interrupt.h> 117#include <linux/interrupt.h>
119#include <linux/pci.h> 118#include <linux/pci.h>
120#include <linux/dma-mapping.h> 119#include <linux/dma-mapping.h>
@@ -218,7 +217,7 @@ enum chip_capability_flags {
218 CanHaveMII=1, HasBrokenTx=2, AlwaysFDX=4, FDXOnNoMII=8, 217 CanHaveMII=1, HasBrokenTx=2, AlwaysFDX=4, FDXOnNoMII=8,
219}; 218};
220 219
221static const struct pci_device_id w840_pci_tbl[] = { 220static DEFINE_PCI_DEVICE_TABLE(w840_pci_tbl) = {
222 { 0x1050, 0x0840, PCI_ANY_ID, 0x8153, 0, 0, 0 }, 221 { 0x1050, 0x0840, PCI_ANY_ID, 0x8153, 0, 0, 0 },
223 { 0x1050, 0x0840, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1 }, 222 { 0x1050, 0x0840, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1 },
224 { 0x11f6, 0x2011, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 2 }, 223 { 0x11f6, 0x2011, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 2 },
@@ -376,8 +375,8 @@ static int __devinit w840_probe1 (struct pci_dev *pdev,
376 irq = pdev->irq; 375 irq = pdev->irq;
377 376
378 if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { 377 if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) {
379 printk(KERN_WARNING "Winbond-840: Device %s disabled due to DMA limitations.\n", 378 pr_warning("Winbond-840: Device %s disabled due to DMA limitations\n",
380 pci_name(pdev)); 379 pci_name(pdev));
381 return -EIO; 380 return -EIO;
382 } 381 }
383 dev = alloc_etherdev(sizeof(*np)); 382 dev = alloc_etherdev(sizeof(*np));
@@ -422,8 +421,9 @@ static int __devinit w840_probe1 (struct pci_dev *pdev,
422 if (option & 0x200) 421 if (option & 0x200)
423 np->mii_if.full_duplex = 1; 422 np->mii_if.full_duplex = 1;
424 if (option & 15) 423 if (option & 15)
425 printk(KERN_INFO "%s: ignoring user supplied media type %d", 424 dev_info(&dev->dev,
426 dev->name, option & 15); 425 "ignoring user supplied media type %d",
426 option & 15);
427 } 427 }
428 if (find_cnt < MAX_UNITS && full_duplex[find_cnt] > 0) 428 if (find_cnt < MAX_UNITS && full_duplex[find_cnt] > 0)
429 np->mii_if.full_duplex = 1; 429 np->mii_if.full_duplex = 1;
@@ -440,9 +440,8 @@ static int __devinit w840_probe1 (struct pci_dev *pdev,
440 if (i) 440 if (i)
441 goto err_out_cleardev; 441 goto err_out_cleardev;
442 442
443 printk(KERN_INFO "%s: %s at %p, %pM, IRQ %d.\n", 443 dev_info(&dev->dev, "%s at %p, %pM, IRQ %d\n",
444 dev->name, pci_id_tbl[chip_idx].name, ioaddr, 444 pci_id_tbl[chip_idx].name, ioaddr, dev->dev_addr, irq);
445 dev->dev_addr, irq);
446 445
447 if (np->drv_flags & CanHaveMII) { 446 if (np->drv_flags & CanHaveMII) {
448 int phy, phy_idx = 0; 447 int phy, phy_idx = 0;
@@ -453,16 +452,17 @@ static int __devinit w840_probe1 (struct pci_dev *pdev,
453 np->mii_if.advertising = mdio_read(dev, phy, MII_ADVERTISE); 452 np->mii_if.advertising = mdio_read(dev, phy, MII_ADVERTISE);
454 np->mii = (mdio_read(dev, phy, MII_PHYSID1) << 16)+ 453 np->mii = (mdio_read(dev, phy, MII_PHYSID1) << 16)+
455 mdio_read(dev, phy, MII_PHYSID2); 454 mdio_read(dev, phy, MII_PHYSID2);
456 printk(KERN_INFO "%s: MII PHY %8.8xh found at address %d, status " 455 dev_info(&dev->dev,
457 "0x%4.4x advertising %4.4x.\n", 456 "MII PHY %08xh found at address %d, status 0x%04x advertising %04x\n",
458 dev->name, np->mii, phy, mii_status, np->mii_if.advertising); 457 np->mii, phy, mii_status,
458 np->mii_if.advertising);
459 } 459 }
460 } 460 }
461 np->mii_cnt = phy_idx; 461 np->mii_cnt = phy_idx;
462 np->mii_if.phy_id = np->phys[0]; 462 np->mii_if.phy_id = np->phys[0];
463 if (phy_idx == 0) { 463 if (phy_idx == 0) {
464 printk(KERN_WARNING "%s: MII PHY not found -- this device may " 464 dev_warn(&dev->dev,
465 "not operate correctly.\n", dev->name); 465 "MII PHY not found -- this device may not operate correctly\n");
466 } 466 }
467 } 467 }
468 468
@@ -639,13 +639,13 @@ static int netdev_open(struct net_device *dev)
639 iowrite32(0x00000001, ioaddr + PCIBusCfg); /* Reset */ 639 iowrite32(0x00000001, ioaddr + PCIBusCfg); /* Reset */
640 640
641 netif_device_detach(dev); 641 netif_device_detach(dev);
642 i = request_irq(dev->irq, &intr_handler, IRQF_SHARED, dev->name, dev); 642 i = request_irq(dev->irq, intr_handler, IRQF_SHARED, dev->name, dev);
643 if (i) 643 if (i)
644 goto out_err; 644 goto out_err;
645 645
646 if (debug > 1) 646 if (debug > 1)
647 printk(KERN_DEBUG "%s: w89c840_open() irq %d.\n", 647 printk(KERN_DEBUG "%s: w89c840_open() irq %d\n",
648 dev->name, dev->irq); 648 dev->name, dev->irq);
649 649
650 if((i=alloc_ringdesc(dev))) 650 if((i=alloc_ringdesc(dev)))
651 goto out_err; 651 goto out_err;
@@ -657,7 +657,7 @@ static int netdev_open(struct net_device *dev)
657 657
658 netif_start_queue(dev); 658 netif_start_queue(dev);
659 if (debug > 2) 659 if (debug > 2)
660 printk(KERN_DEBUG "%s: Done netdev_open().\n", dev->name); 660 printk(KERN_DEBUG "%s: Done netdev_open()\n", dev->name);
661 661
662 /* Set the timer to check for link beat. */ 662 /* Set the timer to check for link beat. */
663 init_timer(&np->timer); 663 init_timer(&np->timer);
@@ -688,16 +688,18 @@ static int update_link(struct net_device *dev)
688 if (!(mii_reg & 0x4)) { 688 if (!(mii_reg & 0x4)) {
689 if (netif_carrier_ok(dev)) { 689 if (netif_carrier_ok(dev)) {
690 if (debug) 690 if (debug)
691 printk(KERN_INFO "%s: MII #%d reports no link. Disabling watchdog.\n", 691 dev_info(&dev->dev,
692 dev->name, np->phys[0]); 692 "MII #%d reports no link. Disabling watchdog\n",
693 np->phys[0]);
693 netif_carrier_off(dev); 694 netif_carrier_off(dev);
694 } 695 }
695 return np->csr6; 696 return np->csr6;
696 } 697 }
697 if (!netif_carrier_ok(dev)) { 698 if (!netif_carrier_ok(dev)) {
698 if (debug) 699 if (debug)
699 printk(KERN_INFO "%s: MII #%d link is back. Enabling watchdog.\n", 700 dev_info(&dev->dev,
700 dev->name, np->phys[0]); 701 "MII #%d link is back. Enabling watchdog\n",
702 np->phys[0]);
701 netif_carrier_on(dev); 703 netif_carrier_on(dev);
702 } 704 }
703 705
@@ -729,9 +731,10 @@ static int update_link(struct net_device *dev)
729 if (fasteth) 731 if (fasteth)
730 result |= 0x20000000; 732 result |= 0x20000000;
731 if (result != np->csr6 && debug) 733 if (result != np->csr6 && debug)
732 printk(KERN_INFO "%s: Setting %dMBit-%s-duplex based on MII#%d\n", 734 dev_info(&dev->dev,
733 dev->name, fasteth ? 100 : 10, 735 "Setting %dMBit-%s-duplex based on MII#%d\n",
734 duplex ? "full" : "half", np->phys[0]); 736 fasteth ? 100 : 10, duplex ? "full" : "half",
737 np->phys[0]);
735 return result; 738 return result;
736} 739}
737 740
@@ -763,8 +766,8 @@ static inline void update_csr6(struct net_device *dev, int new)
763 766
764 limit--; 767 limit--;
765 if(!limit) { 768 if(!limit) {
766 printk(KERN_INFO "%s: couldn't stop rxtx, IntrStatus %xh.\n", 769 dev_info(&dev->dev,
767 dev->name, csr5); 770 "couldn't stop rxtx, IntrStatus %xh\n", csr5);
768 break; 771 break;
769 } 772 }
770 udelay(1); 773 udelay(1);
@@ -783,10 +786,9 @@ static void netdev_timer(unsigned long data)
783 void __iomem *ioaddr = np->base_addr; 786 void __iomem *ioaddr = np->base_addr;
784 787
785 if (debug > 2) 788 if (debug > 2)
786 printk(KERN_DEBUG "%s: Media selection timer tick, status %8.8x " 789 printk(KERN_DEBUG "%s: Media selection timer tick, status %08x config %08x\n",
787 "config %8.8x.\n", 790 dev->name, ioread32(ioaddr + IntrStatus),
788 dev->name, ioread32(ioaddr + IntrStatus), 791 ioread32(ioaddr + NetworkConfig));
789 ioread32(ioaddr + NetworkConfig));
790 spin_lock_irq(&np->lock); 792 spin_lock_irq(&np->lock);
791 update_csr6(dev, update_link(dev)); 793 update_csr6(dev, update_link(dev));
792 spin_unlock_irq(&np->lock); 794 spin_unlock_irq(&np->lock);
@@ -899,8 +901,8 @@ static void init_registers(struct net_device *dev)
899 /* When not a module we can work around broken '486 PCI boards. */ 901 /* When not a module we can work around broken '486 PCI boards. */
900 if (boot_cpu_data.x86 <= 4) { 902 if (boot_cpu_data.x86 <= 4) {
901 i |= 0x4800; 903 i |= 0x4800;
902 printk(KERN_INFO "%s: This is a 386/486 PCI system, setting cache " 904 dev_info(&dev->dev,
903 "alignment to 8 longwords.\n", dev->name); 905 "This is a 386/486 PCI system, setting cache alignment to 8 longwords\n");
904 } else { 906 } else {
905 i |= 0xE000; 907 i |= 0xE000;
906 } 908 }
@@ -931,22 +933,23 @@ static void tx_timeout(struct net_device *dev)
931 struct netdev_private *np = netdev_priv(dev); 933 struct netdev_private *np = netdev_priv(dev);
932 void __iomem *ioaddr = np->base_addr; 934 void __iomem *ioaddr = np->base_addr;
933 935
934 printk(KERN_WARNING "%s: Transmit timed out, status %8.8x," 936 dev_warn(&dev->dev, "Transmit timed out, status %08x, resetting...\n",
935 " resetting...\n", dev->name, ioread32(ioaddr + IntrStatus)); 937 ioread32(ioaddr + IntrStatus));
936 938
937 { 939 {
938 int i; 940 int i;
939 printk(KERN_DEBUG " Rx ring %p: ", np->rx_ring); 941 printk(KERN_DEBUG " Rx ring %p: ", np->rx_ring);
940 for (i = 0; i < RX_RING_SIZE; i++) 942 for (i = 0; i < RX_RING_SIZE; i++)
941 printk(" %8.8x", (unsigned int)np->rx_ring[i].status); 943 printk(KERN_CONT " %08x", (unsigned int)np->rx_ring[i].status);
942 printk(KERN_DEBUG" Tx ring %p: ", np->tx_ring); 944 printk(KERN_CONT "\n");
945 printk(KERN_DEBUG " Tx ring %p: ", np->tx_ring);
943 for (i = 0; i < TX_RING_SIZE; i++) 946 for (i = 0; i < TX_RING_SIZE; i++)
944 printk(" %8.8x", np->tx_ring[i].status); 947 printk(KERN_CONT " %08x", np->tx_ring[i].status);
945 printk("\n"); 948 printk(KERN_CONT "\n");
946 } 949 }
947 printk(KERN_DEBUG "Tx cur %d Tx dirty %d Tx Full %d, q bytes %d.\n", 950 printk(KERN_DEBUG "Tx cur %d Tx dirty %d Tx Full %d, q bytes %d\n",
948 np->cur_tx, np->dirty_tx, np->tx_full, np->tx_q_bytes); 951 np->cur_tx, np->dirty_tx, np->tx_full, np->tx_q_bytes);
949 printk(KERN_DEBUG "Tx Descriptor addr %xh.\n",ioread32(ioaddr+0x4C)); 952 printk(KERN_DEBUG "Tx Descriptor addr %xh\n", ioread32(ioaddr+0x4C));
950 953
951 disable_irq(dev->irq); 954 disable_irq(dev->irq);
952 spin_lock_irq(&np->lock); 955 spin_lock_irq(&np->lock);
@@ -1055,8 +1058,8 @@ static netdev_tx_t start_tx(struct sk_buff *skb, struct net_device *dev)
1055 dev->trans_start = jiffies; 1058 dev->trans_start = jiffies;
1056 1059
1057 if (debug > 4) { 1060 if (debug > 4) {
1058 printk(KERN_DEBUG "%s: Transmit frame #%d queued in slot %d.\n", 1061 printk(KERN_DEBUG "%s: Transmit frame #%d queued in slot %d\n",
1059 dev->name, np->cur_tx, entry); 1062 dev->name, np->cur_tx, entry);
1060 } 1063 }
1061 return NETDEV_TX_OK; 1064 return NETDEV_TX_OK;
1062} 1065}
@@ -1073,8 +1076,8 @@ static void netdev_tx_done(struct net_device *dev)
1073 if (tx_status & 0x8000) { /* There was an error, log it. */ 1076 if (tx_status & 0x8000) { /* There was an error, log it. */
1074#ifndef final_version 1077#ifndef final_version
1075 if (debug > 1) 1078 if (debug > 1)
1076 printk(KERN_DEBUG "%s: Transmit error, Tx status %8.8x.\n", 1079 printk(KERN_DEBUG "%s: Transmit error, Tx status %08x\n",
1077 dev->name, tx_status); 1080 dev->name, tx_status);
1078#endif 1081#endif
1079 np->stats.tx_errors++; 1082 np->stats.tx_errors++;
1080 if (tx_status & 0x0104) np->stats.tx_aborted_errors++; 1083 if (tx_status & 0x0104) np->stats.tx_aborted_errors++;
@@ -1086,8 +1089,8 @@ static void netdev_tx_done(struct net_device *dev)
1086 } else { 1089 } else {
1087#ifndef final_version 1090#ifndef final_version
1088 if (debug > 3) 1091 if (debug > 3)
1089 printk(KERN_DEBUG "%s: Transmit slot %d ok, Tx status %8.8x.\n", 1092 printk(KERN_DEBUG "%s: Transmit slot %d ok, Tx status %08x\n",
1090 dev->name, entry, tx_status); 1093 dev->name, entry, tx_status);
1091#endif 1094#endif
1092 np->stats.tx_bytes += np->tx_skbuff[entry]->len; 1095 np->stats.tx_bytes += np->tx_skbuff[entry]->len;
1093 np->stats.collisions += (tx_status >> 3) & 15; 1096 np->stats.collisions += (tx_status >> 3) & 15;
@@ -1130,8 +1133,8 @@ static irqreturn_t intr_handler(int irq, void *dev_instance)
1130 iowrite32(intr_status & 0x001ffff, ioaddr + IntrStatus); 1133 iowrite32(intr_status & 0x001ffff, ioaddr + IntrStatus);
1131 1134
1132 if (debug > 4) 1135 if (debug > 4)
1133 printk(KERN_DEBUG "%s: Interrupt, status %4.4x.\n", 1136 printk(KERN_DEBUG "%s: Interrupt, status %04x\n",
1134 dev->name, intr_status); 1137 dev->name, intr_status);
1135 1138
1136 if ((intr_status & (NormalIntr|AbnormalIntr)) == 0) 1139 if ((intr_status & (NormalIntr|AbnormalIntr)) == 0)
1137 break; 1140 break;
@@ -1156,8 +1159,9 @@ static irqreturn_t intr_handler(int irq, void *dev_instance)
1156 netdev_error(dev, intr_status); 1159 netdev_error(dev, intr_status);
1157 1160
1158 if (--work_limit < 0) { 1161 if (--work_limit < 0) {
1159 printk(KERN_WARNING "%s: Too much work at interrupt, " 1162 dev_warn(&dev->dev,
1160 "status=0x%4.4x.\n", dev->name, intr_status); 1163 "Too much work at interrupt, status=0x%04x\n",
1164 intr_status);
1161 /* Set the timer to re-enable the other interrupts after 1165 /* Set the timer to re-enable the other interrupts after
1162 10*82usec ticks. */ 1166 10*82usec ticks. */
1163 spin_lock(&np->lock); 1167 spin_lock(&np->lock);
@@ -1171,8 +1175,8 @@ static irqreturn_t intr_handler(int irq, void *dev_instance)
1171 } while (1); 1175 } while (1);
1172 1176
1173 if (debug > 3) 1177 if (debug > 3)
1174 printk(KERN_DEBUG "%s: exiting interrupt, status=%#4.4x.\n", 1178 printk(KERN_DEBUG "%s: exiting interrupt, status=%#4.4x\n",
1175 dev->name, ioread32(ioaddr + IntrStatus)); 1179 dev->name, ioread32(ioaddr + IntrStatus));
1176 return IRQ_RETVAL(handled); 1180 return IRQ_RETVAL(handled);
1177} 1181}
1178 1182
@@ -1185,8 +1189,8 @@ static int netdev_rx(struct net_device *dev)
1185 int work_limit = np->dirty_rx + RX_RING_SIZE - np->cur_rx; 1189 int work_limit = np->dirty_rx + RX_RING_SIZE - np->cur_rx;
1186 1190
1187 if (debug > 4) { 1191 if (debug > 4) {
1188 printk(KERN_DEBUG " In netdev_rx(), entry %d status %4.4x.\n", 1192 printk(KERN_DEBUG " In netdev_rx(), entry %d status %04x\n",
1189 entry, np->rx_ring[entry].status); 1193 entry, np->rx_ring[entry].status);
1190 } 1194 }
1191 1195
1192 /* If EOP is set on the next entry, it's a new packet. Send it up. */ 1196 /* If EOP is set on the next entry, it's a new packet. Send it up. */
@@ -1195,24 +1199,24 @@ static int netdev_rx(struct net_device *dev)
1195 s32 status = desc->status; 1199 s32 status = desc->status;
1196 1200
1197 if (debug > 4) 1201 if (debug > 4)
1198 printk(KERN_DEBUG " netdev_rx() status was %8.8x.\n", 1202 printk(KERN_DEBUG " netdev_rx() status was %08x\n",
1199 status); 1203 status);
1200 if (status < 0) 1204 if (status < 0)
1201 break; 1205 break;
1202 if ((status & 0x38008300) != 0x0300) { 1206 if ((status & 0x38008300) != 0x0300) {
1203 if ((status & 0x38000300) != 0x0300) { 1207 if ((status & 0x38000300) != 0x0300) {
1204 /* Ingore earlier buffers. */ 1208 /* Ingore earlier buffers. */
1205 if ((status & 0xffff) != 0x7fff) { 1209 if ((status & 0xffff) != 0x7fff) {
1206 printk(KERN_WARNING "%s: Oversized Ethernet frame spanned " 1210 dev_warn(&dev->dev,
1207 "multiple buffers, entry %#x status %4.4x!\n", 1211 "Oversized Ethernet frame spanned multiple buffers, entry %#x status %04x!\n",
1208 dev->name, np->cur_rx, status); 1212 np->cur_rx, status);
1209 np->stats.rx_length_errors++; 1213 np->stats.rx_length_errors++;
1210 } 1214 }
1211 } else if (status & 0x8000) { 1215 } else if (status & 0x8000) {
1212 /* There was a fatal error. */ 1216 /* There was a fatal error. */
1213 if (debug > 2) 1217 if (debug > 2)
1214 printk(KERN_DEBUG "%s: Receive error, Rx status %8.8x.\n", 1218 printk(KERN_DEBUG "%s: Receive error, Rx status %08x\n",
1215 dev->name, status); 1219 dev->name, status);
1216 np->stats.rx_errors++; /* end of a packet.*/ 1220 np->stats.rx_errors++; /* end of a packet.*/
1217 if (status & 0x0890) np->stats.rx_length_errors++; 1221 if (status & 0x0890) np->stats.rx_length_errors++;
1218 if (status & 0x004C) np->stats.rx_frame_errors++; 1222 if (status & 0x004C) np->stats.rx_frame_errors++;
@@ -1225,13 +1229,13 @@ static int netdev_rx(struct net_device *dev)
1225 1229
1226#ifndef final_version 1230#ifndef final_version
1227 if (debug > 4) 1231 if (debug > 4)
1228 printk(KERN_DEBUG " netdev_rx() normal Rx pkt length %d" 1232 printk(KERN_DEBUG " netdev_rx() normal Rx pkt length %d status %x\n",
1229 " status %x.\n", pkt_len, status); 1233 pkt_len, status);
1230#endif 1234#endif
1231 /* Check if the packet is long enough to accept without copying 1235 /* Check if the packet is long enough to accept without copying
1232 to a minimally-sized skbuff. */ 1236 to a minimally-sized skbuff. */
1233 if (pkt_len < rx_copybreak 1237 if (pkt_len < rx_copybreak &&
1234 && (skb = dev_alloc_skb(pkt_len + 2)) != NULL) { 1238 (skb = dev_alloc_skb(pkt_len + 2)) != NULL) {
1235 skb_reserve(skb, 2); /* 16 byte align the IP header */ 1239 skb_reserve(skb, 2); /* 16 byte align the IP header */
1236 pci_dma_sync_single_for_cpu(np->pci_dev,np->rx_addr[entry], 1240 pci_dma_sync_single_for_cpu(np->pci_dev,np->rx_addr[entry],
1237 np->rx_skbuff[entry]->len, 1241 np->rx_skbuff[entry]->len,
@@ -1251,11 +1255,10 @@ static int netdev_rx(struct net_device *dev)
1251#ifndef final_version /* Remove after testing. */ 1255#ifndef final_version /* Remove after testing. */
1252 /* You will want this info for the initial debug. */ 1256 /* You will want this info for the initial debug. */
1253 if (debug > 5) 1257 if (debug > 5)
1254 printk(KERN_DEBUG " Rx data %pM %pM" 1258 printk(KERN_DEBUG " Rx data %pM %pM %02x%02x %pI4\n",
1255 " %2.2x%2.2x %d.%d.%d.%d.\n",
1256 &skb->data[0], &skb->data[6], 1259 &skb->data[0], &skb->data[6],
1257 skb->data[12], skb->data[13], 1260 skb->data[12], skb->data[13],
1258 skb->data[14], skb->data[15], skb->data[16], skb->data[17]); 1261 &skb->data[14]);
1259#endif 1262#endif
1260 skb->protocol = eth_type_trans(skb, dev); 1263 skb->protocol = eth_type_trans(skb, dev);
1261 netif_rx(skb); 1264 netif_rx(skb);
@@ -1293,8 +1296,8 @@ static void netdev_error(struct net_device *dev, int intr_status)
1293 void __iomem *ioaddr = np->base_addr; 1296 void __iomem *ioaddr = np->base_addr;
1294 1297
1295 if (debug > 2) 1298 if (debug > 2)
1296 printk(KERN_DEBUG "%s: Abnormal event, %8.8x.\n", 1299 printk(KERN_DEBUG "%s: Abnormal event, %08x\n",
1297 dev->name, intr_status); 1300 dev->name, intr_status);
1298 if (intr_status == 0xffffffff) 1301 if (intr_status == 0xffffffff)
1299 return; 1302 return;
1300 spin_lock(&np->lock); 1303 spin_lock(&np->lock);
@@ -1314,8 +1317,8 @@ static void netdev_error(struct net_device *dev, int intr_status)
1314 new = 127; /* load full packet before starting */ 1317 new = 127; /* load full packet before starting */
1315 new = (np->csr6 & ~(0x7F << 14)) | (new<<14); 1318 new = (np->csr6 & ~(0x7F << 14)) | (new<<14);
1316#endif 1319#endif
1317 printk(KERN_DEBUG "%s: Tx underflow, new csr6 %8.8x.\n", 1320 printk(KERN_DEBUG "%s: Tx underflow, new csr6 %08x\n",
1318 dev->name, new); 1321 dev->name, new);
1319 update_csr6(dev, new); 1322 update_csr6(dev, new);
1320 } 1323 }
1321 if (intr_status & RxDied) { /* Missed a Rx frame. */ 1324 if (intr_status & RxDied) { /* Missed a Rx frame. */
@@ -1357,17 +1360,16 @@ static u32 __set_rx_mode(struct net_device *dev)
1357 memset(mc_filter, 0xff, sizeof(mc_filter)); 1360 memset(mc_filter, 0xff, sizeof(mc_filter));
1358 rx_mode = RxAcceptBroadcast | AcceptMulticast | RxAcceptAllPhys 1361 rx_mode = RxAcceptBroadcast | AcceptMulticast | RxAcceptAllPhys
1359 | AcceptMyPhys; 1362 | AcceptMyPhys;
1360 } else if ((dev->mc_count > multicast_filter_limit) 1363 } else if ((netdev_mc_count(dev) > multicast_filter_limit) ||
1361 || (dev->flags & IFF_ALLMULTI)) { 1364 (dev->flags & IFF_ALLMULTI)) {
1362 /* Too many to match, or accept all multicasts. */ 1365 /* Too many to match, or accept all multicasts. */
1363 memset(mc_filter, 0xff, sizeof(mc_filter)); 1366 memset(mc_filter, 0xff, sizeof(mc_filter));
1364 rx_mode = RxAcceptBroadcast | AcceptMulticast | AcceptMyPhys; 1367 rx_mode = RxAcceptBroadcast | AcceptMulticast | AcceptMyPhys;
1365 } else { 1368 } else {
1366 struct dev_mc_list *mclist; 1369 struct dev_mc_list *mclist;
1367 int i; 1370
1368 memset(mc_filter, 0, sizeof(mc_filter)); 1371 memset(mc_filter, 0, sizeof(mc_filter));
1369 for (i = 0, mclist = dev->mc_list; mclist && i < dev->mc_count; 1372 netdev_for_each_mc_addr(mclist, dev) {
1370 i++, mclist = mclist->next) {
1371 int filterbit = (ether_crc(ETH_ALEN, mclist->dmi_addr) >> 26) ^ 0x3F; 1373 int filterbit = (ether_crc(ETH_ALEN, mclist->dmi_addr) >> 26) ^ 0x3F;
1372 filterbit &= 0x3f; 1374 filterbit &= 0x3f;
1373 mc_filter[filterbit >> 5] |= 1 << (filterbit & 31); 1375 mc_filter[filterbit >> 5] |= 1 << (filterbit & 31);
@@ -1487,11 +1489,13 @@ static int netdev_close(struct net_device *dev)
1487 netif_stop_queue(dev); 1489 netif_stop_queue(dev);
1488 1490
1489 if (debug > 1) { 1491 if (debug > 1) {
1490 printk(KERN_DEBUG "%s: Shutting down ethercard, status was %8.8x " 1492 printk(KERN_DEBUG "%s: Shutting down ethercard, status was %08x Config %08x\n",
1491 "Config %8.8x.\n", dev->name, ioread32(ioaddr + IntrStatus), 1493 dev->name, ioread32(ioaddr + IntrStatus),
1492 ioread32(ioaddr + NetworkConfig)); 1494 ioread32(ioaddr + NetworkConfig));
1493 printk(KERN_DEBUG "%s: Queue pointers were Tx %d / %d, Rx %d / %d.\n", 1495 printk(KERN_DEBUG "%s: Queue pointers were Tx %d / %d, Rx %d / %d\n",
1494 dev->name, np->cur_tx, np->dirty_tx, np->cur_rx, np->dirty_rx); 1496 dev->name,
1497 np->cur_tx, np->dirty_tx,
1498 np->cur_rx, np->dirty_rx);
1495 } 1499 }
1496 1500
1497 /* Stop the chip's Tx and Rx processes. */ 1501 /* Stop the chip's Tx and Rx processes. */
@@ -1512,18 +1516,16 @@ static int netdev_close(struct net_device *dev)
1512 if (debug > 2) { 1516 if (debug > 2) {
1513 int i; 1517 int i;
1514 1518
1515 printk(KERN_DEBUG" Tx ring at %8.8x:\n", 1519 printk(KERN_DEBUG" Tx ring at %08x:\n", (int)np->tx_ring);
1516 (int)np->tx_ring);
1517 for (i = 0; i < TX_RING_SIZE; i++) 1520 for (i = 0; i < TX_RING_SIZE; i++)
1518 printk(KERN_DEBUG " #%d desc. %4.4x %4.4x %8.8x.\n", 1521 printk(KERN_DEBUG " #%d desc. %04x %04x %08x\n",
1519 i, np->tx_ring[i].length, 1522 i, np->tx_ring[i].length,
1520 np->tx_ring[i].status, np->tx_ring[i].buffer1); 1523 np->tx_ring[i].status, np->tx_ring[i].buffer1);
1521 printk(KERN_DEBUG " Rx ring %8.8x:\n", 1524 printk(KERN_DEBUG " Rx ring %08x:\n", (int)np->rx_ring);
1522 (int)np->rx_ring);
1523 for (i = 0; i < RX_RING_SIZE; i++) { 1525 for (i = 0; i < RX_RING_SIZE; i++) {
1524 printk(KERN_DEBUG " #%d desc. %4.4x %4.4x %8.8x\n", 1526 printk(KERN_DEBUG " #%d desc. %04x %04x %08x\n",
1525 i, np->rx_ring[i].length, 1527 i, np->rx_ring[i].length,
1526 np->rx_ring[i].status, np->rx_ring[i].buffer1); 1528 np->rx_ring[i].status, np->rx_ring[i].buffer1);
1527 } 1529 }
1528 } 1530 }
1529#endif /* __i386__ debugging only */ 1531#endif /* __i386__ debugging only */
@@ -1622,9 +1624,8 @@ static int w840_resume (struct pci_dev *pdev)
1622 goto out; /* device not suspended */ 1624 goto out; /* device not suspended */
1623 if (netif_running(dev)) { 1625 if (netif_running(dev)) {
1624 if ((retval = pci_enable_device(pdev))) { 1626 if ((retval = pci_enable_device(pdev))) {
1625 printk (KERN_ERR 1627 dev_err(&dev->dev,
1626 "%s: pci_enable_device failed in resume\n", 1628 "pci_enable_device failed in resume\n");
1627 dev->name);
1628 goto out; 1629 goto out;
1629 } 1630 }
1630 spin_lock_irq(&np->lock); 1631 spin_lock_irq(&np->lock);
diff --git a/drivers/net/tulip/xircom_cb.c b/drivers/net/tulip/xircom_cb.c
index 0f2ca5980c3c..acfeeb980562 100644
--- a/drivers/net/tulip/xircom_cb.c
+++ b/drivers/net/tulip/xircom_cb.c
@@ -14,6 +14,8 @@
14 * $Id: xircom_cb.c,v 1.33 2001/03/19 14:02:07 arjanv Exp $ 14 * $Id: xircom_cb.c,v 1.33 2001/03/19 14:02:07 arjanv Exp $
15 */ 15 */
16 16
17#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
18
17#include <linux/module.h> 19#include <linux/module.h>
18#include <linux/kernel.h> 20#include <linux/kernel.h>
19#include <linux/string.h> 21#include <linux/string.h>
@@ -144,7 +146,7 @@ static int link_status(struct xircom_private *card);
144 146
145 147
146 148
147static struct pci_device_id xircom_pci_table[] = { 149static DEFINE_PCI_DEVICE_TABLE(xircom_pci_table) = {
148 {0x115D, 0x0003, PCI_ANY_ID, PCI_ANY_ID,}, 150 {0x115D, 0x0003, PCI_ANY_ID, PCI_ANY_ID,},
149 {0,}, 151 {0,},
150}; 152};
@@ -234,7 +236,7 @@ static int __devinit xircom_probe(struct pci_dev *pdev, const struct pci_device_
234 pci_write_config_word (pdev, PCI_STATUS,tmp16); 236 pci_write_config_word (pdev, PCI_STATUS,tmp16);
235 237
236 if (!request_region(pci_resource_start(pdev, 0), 128, "xircom_cb")) { 238 if (!request_region(pci_resource_start(pdev, 0), 128, "xircom_cb")) {
237 printk(KERN_ERR "xircom_probe: failed to allocate io-region\n"); 239 pr_err("%s: failed to allocate io-region\n", __func__);
238 return -ENODEV; 240 return -ENODEV;
239 } 241 }
240 242
@@ -245,7 +247,7 @@ static int __devinit xircom_probe(struct pci_dev *pdev, const struct pci_device_
245 */ 247 */
246 dev = alloc_etherdev(sizeof(struct xircom_private)); 248 dev = alloc_etherdev(sizeof(struct xircom_private));
247 if (!dev) { 249 if (!dev) {
248 printk(KERN_ERR "xircom_probe: failed to allocate etherdev\n"); 250 pr_err("%s: failed to allocate etherdev\n", __func__);
249 goto device_fail; 251 goto device_fail;
250 } 252 }
251 private = netdev_priv(dev); 253 private = netdev_priv(dev);
@@ -253,12 +255,12 @@ static int __devinit xircom_probe(struct pci_dev *pdev, const struct pci_device_
253 /* Allocate the send/receive buffers */ 255 /* Allocate the send/receive buffers */
254 private->rx_buffer = pci_alloc_consistent(pdev,8192,&private->rx_dma_handle); 256 private->rx_buffer = pci_alloc_consistent(pdev,8192,&private->rx_dma_handle);
255 if (private->rx_buffer == NULL) { 257 if (private->rx_buffer == NULL) {
256 printk(KERN_ERR "xircom_probe: no memory for rx buffer \n"); 258 pr_err("%s: no memory for rx buffer\n", __func__);
257 goto rx_buf_fail; 259 goto rx_buf_fail;
258 } 260 }
259 private->tx_buffer = pci_alloc_consistent(pdev,8192,&private->tx_dma_handle); 261 private->tx_buffer = pci_alloc_consistent(pdev,8192,&private->tx_dma_handle);
260 if (private->tx_buffer == NULL) { 262 if (private->tx_buffer == NULL) {
261 printk(KERN_ERR "xircom_probe: no memory for tx buffer \n"); 263 pr_err("%s: no memory for tx buffer\n", __func__);
262 goto tx_buf_fail; 264 goto tx_buf_fail;
263 } 265 }
264 266
@@ -281,11 +283,12 @@ static int __devinit xircom_probe(struct pci_dev *pdev, const struct pci_device_
281 pci_set_drvdata(pdev, dev); 283 pci_set_drvdata(pdev, dev);
282 284
283 if (register_netdev(dev)) { 285 if (register_netdev(dev)) {
284 printk(KERN_ERR "xircom_probe: netdevice registration failed.\n"); 286 pr_err("%s: netdevice registration failed\n", __func__);
285 goto reg_fail; 287 goto reg_fail;
286 } 288 }
287 289
288 printk(KERN_INFO "%s: Xircom cardbus revision %i at irq %i \n", dev->name, pdev->revision, pdev->irq); 290 dev_info(&dev->dev, "Xircom cardbus revision %i at irq %i\n",
291 pdev->revision, pdev->irq);
289 /* start the transmitter to get a heartbeat */ 292 /* start the transmitter to get a heartbeat */
290 /* TODO: send 2 dummy packets here */ 293 /* TODO: send 2 dummy packets here */
291 transceiver_voodoo(private); 294 transceiver_voodoo(private);
@@ -347,8 +350,10 @@ static irqreturn_t xircom_interrupt(int irq, void *dev_instance)
347 350
348#ifdef DEBUG 351#ifdef DEBUG
349 print_binary(status); 352 print_binary(status);
350 printk("tx status 0x%08x 0x%08x \n",card->tx_buffer[0],card->tx_buffer[4]); 353 printk("tx status 0x%08x 0x%08x \n",
351 printk("rx status 0x%08x 0x%08x \n",card->rx_buffer[0],card->rx_buffer[4]); 354 card->tx_buffer[0], card->tx_buffer[4]);
355 printk("rx status 0x%08x 0x%08x \n",
356 card->rx_buffer[0], card->rx_buffer[4]);
352#endif 357#endif
353 /* Handle shared irq and hotplug */ 358 /* Handle shared irq and hotplug */
354 if (status == 0 || status == 0xffffffff) { 359 if (status == 0 || status == 0xffffffff) {
@@ -358,9 +363,9 @@ static irqreturn_t xircom_interrupt(int irq, void *dev_instance)
358 363
359 if (link_status_changed(card)) { 364 if (link_status_changed(card)) {
360 int newlink; 365 int newlink;
361 printk(KERN_DEBUG "xircom_cb: Link status has changed \n"); 366 printk(KERN_DEBUG "xircom_cb: Link status has changed\n");
362 newlink = link_status(card); 367 newlink = link_status(card);
363 printk(KERN_INFO "xircom_cb: Link is %i mbit \n",newlink); 368 dev_info(&dev->dev, "Link is %i mbit\n", newlink);
364 if (newlink) 369 if (newlink)
365 netif_carrier_on(dev); 370 netif_carrier_on(dev);
366 else 371 else
@@ -457,8 +462,9 @@ static int xircom_open(struct net_device *dev)
457 struct xircom_private *xp = netdev_priv(dev); 462 struct xircom_private *xp = netdev_priv(dev);
458 int retval; 463 int retval;
459 enter("xircom_open"); 464 enter("xircom_open");
460 printk(KERN_INFO "xircom cardbus adaptor found, registering as %s, using irq %i \n",dev->name,dev->irq); 465 pr_info("xircom cardbus adaptor found, registering as %s, using irq %i \n",
461 retval = request_irq(dev->irq, &xircom_interrupt, IRQF_SHARED, dev->name, dev); 466 dev->name, dev->irq);
467 retval = request_irq(dev->irq, xircom_interrupt, IRQF_SHARED, dev->name, dev);
462 if (retval) { 468 if (retval) {
463 leave("xircom_open - No IRQ"); 469 leave("xircom_open - No IRQ");
464 return retval; 470 return retval;
@@ -770,7 +776,7 @@ static void activate_receiver(struct xircom_private *card)
770 udelay(50); 776 udelay(50);
771 counter--; 777 counter--;
772 if (counter <= 0) 778 if (counter <= 0)
773 printk(KERN_ERR "xircom_cb: Receiver failed to deactivate\n"); 779 pr_err("Receiver failed to deactivate\n");
774 } 780 }
775 781
776 /* enable the receiver */ 782 /* enable the receiver */
@@ -787,7 +793,7 @@ static void activate_receiver(struct xircom_private *card)
787 udelay(50); 793 udelay(50);
788 counter--; 794 counter--;
789 if (counter <= 0) 795 if (counter <= 0)
790 printk(KERN_ERR "xircom_cb: Receiver failed to re-activate\n"); 796 pr_err("Receiver failed to re-activate\n");
791 } 797 }
792 798
793 leave("activate_receiver"); 799 leave("activate_receiver");
@@ -818,7 +824,7 @@ static void deactivate_receiver(struct xircom_private *card)
818 udelay(50); 824 udelay(50);
819 counter--; 825 counter--;
820 if (counter <= 0) 826 if (counter <= 0)
821 printk(KERN_ERR "xircom_cb: Receiver failed to deactivate\n"); 827 pr_err("Receiver failed to deactivate\n");
822 } 828 }
823 829
824 830
@@ -861,7 +867,7 @@ static void activate_transmitter(struct xircom_private *card)
861 udelay(50); 867 udelay(50);
862 counter--; 868 counter--;
863 if (counter <= 0) 869 if (counter <= 0)
864 printk(KERN_ERR "xircom_cb: Transmitter failed to deactivate\n"); 870 pr_err("Transmitter failed to deactivate\n");
865 } 871 }
866 872
867 /* enable the transmitter */ 873 /* enable the transmitter */
@@ -878,7 +884,7 @@ static void activate_transmitter(struct xircom_private *card)
878 udelay(50); 884 udelay(50);
879 counter--; 885 counter--;
880 if (counter <= 0) 886 if (counter <= 0)
881 printk(KERN_ERR "xircom_cb: Transmitter failed to re-activate\n"); 887 pr_err("Transmitter failed to re-activate\n");
882 } 888 }
883 889
884 leave("activate_transmitter"); 890 leave("activate_transmitter");
@@ -909,7 +915,7 @@ static void deactivate_transmitter(struct xircom_private *card)
909 udelay(50); 915 udelay(50);
910 counter--; 916 counter--;
911 if (counter <= 0) 917 if (counter <= 0)
912 printk(KERN_ERR "xircom_cb: Transmitter failed to deactivate\n"); 918 pr_err("Transmitter failed to deactivate\n");
913 } 919 }
914 920
915 921
@@ -1184,7 +1190,7 @@ static void investigate_read_descriptor(struct net_device *dev,struct xircom_pri
1184 struct sk_buff *skb; 1190 struct sk_buff *skb;
1185 1191
1186 if (pkt_len > 1518) { 1192 if (pkt_len > 1518) {
1187 printk(KERN_ERR "xircom_cb: Packet length %i is bogus \n",pkt_len); 1193 pr_err("Packet length %i is bogus\n", pkt_len);
1188 pkt_len = 1518; 1194 pkt_len = 1518;
1189 } 1195 }
1190 1196
@@ -1222,7 +1228,7 @@ static void investigate_write_descriptor(struct net_device *dev, struct xircom_p
1222 status = le32_to_cpu(card->tx_buffer[4*descnr]); 1228 status = le32_to_cpu(card->tx_buffer[4*descnr]);
1223#if 0 1229#if 0
1224 if (status & 0x8000) { /* Major error */ 1230 if (status & 0x8000) { /* Major error */
1225 printk(KERN_ERR "Major transmit error status %x \n", status); 1231 pr_err("Major transmit error status %x\n", status);
1226 card->tx_buffer[4*descnr] = 0; 1232 card->tx_buffer[4*descnr] = 0;
1227 netif_wake_queue (dev); 1233 netif_wake_queue (dev);
1228 } 1234 }