aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sungem.c
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /drivers/net/sungem.c
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'drivers/net/sungem.c')
-rw-r--r--drivers/net/sungem.c303
1 files changed, 128 insertions, 175 deletions
diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c
index 434f9d735333..ab5930099267 100644
--- a/drivers/net/sungem.c
+++ b/drivers/net/sungem.c
@@ -31,6 +31,8 @@
31 * about when we can start taking interrupts or get xmit() called... 31 * about when we can start taking interrupts or get xmit() called...
32 */ 32 */
33 33
34#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
35
34#include <linux/module.h> 36#include <linux/module.h>
35#include <linux/kernel.h> 37#include <linux/kernel.h>
36#include <linux/types.h> 38#include <linux/types.h>
@@ -105,7 +107,6 @@ MODULE_DESCRIPTION("Sun GEM Gbit ethernet driver");
105MODULE_LICENSE("GPL"); 107MODULE_LICENSE("GPL");
106 108
107#define GEM_MODULE_NAME "gem" 109#define GEM_MODULE_NAME "gem"
108#define PFX GEM_MODULE_NAME ": "
109 110
110static DEFINE_PCI_DEVICE_TABLE(gem_pci_tbl) = { 111static DEFINE_PCI_DEVICE_TABLE(gem_pci_tbl) = {
111 { PCI_VENDOR_ID_SUN, PCI_DEVICE_ID_SUN_GEM, 112 { PCI_VENDOR_ID_SUN, PCI_DEVICE_ID_SUN_GEM,
@@ -262,8 +263,7 @@ static int gem_pcs_interrupt(struct net_device *dev, struct gem *gp, u32 gem_sta
262 gp->dev->name, pcs_istat); 263 gp->dev->name, pcs_istat);
263 264
264 if (!(pcs_istat & PCS_ISTAT_LSC)) { 265 if (!(pcs_istat & PCS_ISTAT_LSC)) {
265 printk(KERN_ERR "%s: PCS irq but no link status change???\n", 266 netdev_err(dev, "PCS irq but no link status change???\n");
266 dev->name);
267 return 0; 267 return 0;
268 } 268 }
269 269
@@ -282,20 +282,16 @@ static int gem_pcs_interrupt(struct net_device *dev, struct gem *gp, u32 gem_sta
282 * when autoneg has completed. 282 * when autoneg has completed.
283 */ 283 */
284 if (pcs_miistat & PCS_MIISTAT_RF) 284 if (pcs_miistat & PCS_MIISTAT_RF)
285 printk(KERN_INFO "%s: PCS AutoNEG complete, " 285 netdev_info(dev, "PCS AutoNEG complete, RemoteFault\n");
286 "RemoteFault\n", dev->name);
287 else 286 else
288 printk(KERN_INFO "%s: PCS AutoNEG complete.\n", 287 netdev_info(dev, "PCS AutoNEG complete\n");
289 dev->name);
290 } 288 }
291 289
292 if (pcs_miistat & PCS_MIISTAT_LS) { 290 if (pcs_miistat & PCS_MIISTAT_LS) {
293 printk(KERN_INFO "%s: PCS link is now up.\n", 291 netdev_info(dev, "PCS link is now up\n");
294 dev->name);
295 netif_carrier_on(gp->dev); 292 netif_carrier_on(gp->dev);
296 } else { 293 } else {
297 printk(KERN_INFO "%s: PCS link is now down.\n", 294 netdev_info(dev, "PCS link is now down\n");
298 dev->name);
299 netif_carrier_off(gp->dev); 295 netif_carrier_off(gp->dev);
300 /* If this happens and the link timer is not running, 296 /* If this happens and the link timer is not running,
301 * reset so we re-negotiate. 297 * reset so we re-negotiate.
@@ -323,31 +319,29 @@ static int gem_txmac_interrupt(struct net_device *dev, struct gem *gp, u32 gem_s
323 return 0; 319 return 0;
324 320
325 if (txmac_stat & MAC_TXSTAT_URUN) { 321 if (txmac_stat & MAC_TXSTAT_URUN) {
326 printk(KERN_ERR "%s: TX MAC xmit underrun.\n", 322 netdev_err(dev, "TX MAC xmit underrun\n");
327 dev->name); 323 dev->stats.tx_fifo_errors++;
328 gp->net_stats.tx_fifo_errors++;
329 } 324 }
330 325
331 if (txmac_stat & MAC_TXSTAT_MPE) { 326 if (txmac_stat & MAC_TXSTAT_MPE) {
332 printk(KERN_ERR "%s: TX MAC max packet size error.\n", 327 netdev_err(dev, "TX MAC max packet size error\n");
333 dev->name); 328 dev->stats.tx_errors++;
334 gp->net_stats.tx_errors++;
335 } 329 }
336 330
337 /* The rest are all cases of one of the 16-bit TX 331 /* The rest are all cases of one of the 16-bit TX
338 * counters expiring. 332 * counters expiring.
339 */ 333 */
340 if (txmac_stat & MAC_TXSTAT_NCE) 334 if (txmac_stat & MAC_TXSTAT_NCE)
341 gp->net_stats.collisions += 0x10000; 335 dev->stats.collisions += 0x10000;
342 336
343 if (txmac_stat & MAC_TXSTAT_ECE) { 337 if (txmac_stat & MAC_TXSTAT_ECE) {
344 gp->net_stats.tx_aborted_errors += 0x10000; 338 dev->stats.tx_aborted_errors += 0x10000;
345 gp->net_stats.collisions += 0x10000; 339 dev->stats.collisions += 0x10000;
346 } 340 }
347 341
348 if (txmac_stat & MAC_TXSTAT_LCE) { 342 if (txmac_stat & MAC_TXSTAT_LCE) {
349 gp->net_stats.tx_aborted_errors += 0x10000; 343 dev->stats.tx_aborted_errors += 0x10000;
350 gp->net_stats.collisions += 0x10000; 344 dev->stats.collisions += 0x10000;
351 } 345 }
352 346
353 /* We do not keep track of MAC_TXSTAT_FCE and 347 /* We do not keep track of MAC_TXSTAT_FCE and
@@ -377,8 +371,7 @@ static int gem_rxmac_reset(struct gem *gp)
377 udelay(10); 371 udelay(10);
378 } 372 }
379 if (limit == 5000) { 373 if (limit == 5000) {
380 printk(KERN_ERR "%s: RX MAC will not reset, resetting whole " 374 netdev_err(dev, "RX MAC will not reset, resetting whole chip\n");
381 "chip.\n", dev->name);
382 return 1; 375 return 1;
383 } 376 }
384 377
@@ -390,8 +383,7 @@ static int gem_rxmac_reset(struct gem *gp)
390 udelay(10); 383 udelay(10);
391 } 384 }
392 if (limit == 5000) { 385 if (limit == 5000) {
393 printk(KERN_ERR "%s: RX MAC will not disable, resetting whole " 386 netdev_err(dev, "RX MAC will not disable, resetting whole chip\n");
394 "chip.\n", dev->name);
395 return 1; 387 return 1;
396 } 388 }
397 389
@@ -403,8 +395,7 @@ static int gem_rxmac_reset(struct gem *gp)
403 udelay(10); 395 udelay(10);
404 } 396 }
405 if (limit == 5000) { 397 if (limit == 5000) {
406 printk(KERN_ERR "%s: RX DMA will not disable, resetting whole " 398 netdev_err(dev, "RX DMA will not disable, resetting whole chip\n");
407 "chip.\n", dev->name);
408 return 1; 399 return 1;
409 } 400 }
410 401
@@ -419,8 +410,7 @@ static int gem_rxmac_reset(struct gem *gp)
419 udelay(10); 410 udelay(10);
420 } 411 }
421 if (limit == 5000) { 412 if (limit == 5000) {
422 printk(KERN_ERR "%s: RX reset command will not execute, resetting " 413 netdev_err(dev, "RX reset command will not execute, resetting whole chip\n");
423 "whole chip.\n", dev->name);
424 return 1; 414 return 1;
425 } 415 }
426 416
@@ -429,8 +419,7 @@ static int gem_rxmac_reset(struct gem *gp)
429 struct gem_rxd *rxd = &gp->init_block->rxd[i]; 419 struct gem_rxd *rxd = &gp->init_block->rxd[i];
430 420
431 if (gp->rx_skbs[i] == NULL) { 421 if (gp->rx_skbs[i] == NULL) {
432 printk(KERN_ERR "%s: Parts of RX ring empty, resetting " 422 netdev_err(dev, "Parts of RX ring empty, resetting whole chip\n");
433 "whole chip.\n", dev->name);
434 return 1; 423 return 1;
435 } 424 }
436 425
@@ -479,22 +468,21 @@ static int gem_rxmac_interrupt(struct net_device *dev, struct gem *gp, u32 gem_s
479 if (rxmac_stat & MAC_RXSTAT_OFLW) { 468 if (rxmac_stat & MAC_RXSTAT_OFLW) {
480 u32 smac = readl(gp->regs + MAC_SMACHINE); 469 u32 smac = readl(gp->regs + MAC_SMACHINE);
481 470
482 printk(KERN_ERR "%s: RX MAC fifo overflow smac[%08x].\n", 471 netdev_err(dev, "RX MAC fifo overflow smac[%08x]\n", smac);
483 dev->name, smac); 472 dev->stats.rx_over_errors++;
484 gp->net_stats.rx_over_errors++; 473 dev->stats.rx_fifo_errors++;
485 gp->net_stats.rx_fifo_errors++;
486 474
487 ret = gem_rxmac_reset(gp); 475 ret = gem_rxmac_reset(gp);
488 } 476 }
489 477
490 if (rxmac_stat & MAC_RXSTAT_ACE) 478 if (rxmac_stat & MAC_RXSTAT_ACE)
491 gp->net_stats.rx_frame_errors += 0x10000; 479 dev->stats.rx_frame_errors += 0x10000;
492 480
493 if (rxmac_stat & MAC_RXSTAT_CCE) 481 if (rxmac_stat & MAC_RXSTAT_CCE)
494 gp->net_stats.rx_crc_errors += 0x10000; 482 dev->stats.rx_crc_errors += 0x10000;
495 483
496 if (rxmac_stat & MAC_RXSTAT_LCE) 484 if (rxmac_stat & MAC_RXSTAT_LCE)
497 gp->net_stats.rx_length_errors += 0x10000; 485 dev->stats.rx_length_errors += 0x10000;
498 486
499 /* We do not track MAC_RXSTAT_FCE and MAC_RXSTAT_VCE 487 /* We do not track MAC_RXSTAT_FCE and MAC_RXSTAT_VCE
500 * events. 488 * events.
@@ -542,19 +530,18 @@ static int gem_pci_interrupt(struct net_device *dev, struct gem *gp, u32 gem_sta
542 530
543 if (gp->pdev->vendor == PCI_VENDOR_ID_SUN && 531 if (gp->pdev->vendor == PCI_VENDOR_ID_SUN &&
544 gp->pdev->device == PCI_DEVICE_ID_SUN_GEM) { 532 gp->pdev->device == PCI_DEVICE_ID_SUN_GEM) {
545 printk(KERN_ERR "%s: PCI error [%04x] ", 533 netdev_err(dev, "PCI error [%04x]", pci_estat);
546 dev->name, pci_estat);
547 534
548 if (pci_estat & GREG_PCIESTAT_BADACK) 535 if (pci_estat & GREG_PCIESTAT_BADACK)
549 printk("<No ACK64# during ABS64 cycle> "); 536 pr_cont(" <No ACK64# during ABS64 cycle>");
550 if (pci_estat & GREG_PCIESTAT_DTRTO) 537 if (pci_estat & GREG_PCIESTAT_DTRTO)
551 printk("<Delayed transaction timeout> "); 538 pr_cont(" <Delayed transaction timeout>");
552 if (pci_estat & GREG_PCIESTAT_OTHER) 539 if (pci_estat & GREG_PCIESTAT_OTHER)
553 printk("<other>"); 540 pr_cont(" <other>");
554 printk("\n"); 541 pr_cont("\n");
555 } else { 542 } else {
556 pci_estat |= GREG_PCIESTAT_OTHER; 543 pci_estat |= GREG_PCIESTAT_OTHER;
557 printk(KERN_ERR "%s: PCI error\n", dev->name); 544 netdev_err(dev, "PCI error\n");
558 } 545 }
559 546
560 if (pci_estat & GREG_PCIESTAT_OTHER) { 547 if (pci_estat & GREG_PCIESTAT_OTHER) {
@@ -565,26 +552,20 @@ static int gem_pci_interrupt(struct net_device *dev, struct gem *gp, u32 gem_sta
565 */ 552 */
566 pci_read_config_word(gp->pdev, PCI_STATUS, 553 pci_read_config_word(gp->pdev, PCI_STATUS,
567 &pci_cfg_stat); 554 &pci_cfg_stat);
568 printk(KERN_ERR "%s: Read PCI cfg space status [%04x]\n", 555 netdev_err(dev, "Read PCI cfg space status [%04x]\n",
569 dev->name, pci_cfg_stat); 556 pci_cfg_stat);
570 if (pci_cfg_stat & PCI_STATUS_PARITY) 557 if (pci_cfg_stat & PCI_STATUS_PARITY)
571 printk(KERN_ERR "%s: PCI parity error detected.\n", 558 netdev_err(dev, "PCI parity error detected\n");
572 dev->name);
573 if (pci_cfg_stat & PCI_STATUS_SIG_TARGET_ABORT) 559 if (pci_cfg_stat & PCI_STATUS_SIG_TARGET_ABORT)
574 printk(KERN_ERR "%s: PCI target abort.\n", 560 netdev_err(dev, "PCI target abort\n");
575 dev->name);
576 if (pci_cfg_stat & PCI_STATUS_REC_TARGET_ABORT) 561 if (pci_cfg_stat & PCI_STATUS_REC_TARGET_ABORT)
577 printk(KERN_ERR "%s: PCI master acks target abort.\n", 562 netdev_err(dev, "PCI master acks target abort\n");
578 dev->name);
579 if (pci_cfg_stat & PCI_STATUS_REC_MASTER_ABORT) 563 if (pci_cfg_stat & PCI_STATUS_REC_MASTER_ABORT)
580 printk(KERN_ERR "%s: PCI master abort.\n", 564 netdev_err(dev, "PCI master abort\n");
581 dev->name);
582 if (pci_cfg_stat & PCI_STATUS_SIG_SYSTEM_ERROR) 565 if (pci_cfg_stat & PCI_STATUS_SIG_SYSTEM_ERROR)
583 printk(KERN_ERR "%s: PCI system error SERR#.\n", 566 netdev_err(dev, "PCI system error SERR#\n");
584 dev->name);
585 if (pci_cfg_stat & PCI_STATUS_DETECTED_PARITY) 567 if (pci_cfg_stat & PCI_STATUS_DETECTED_PARITY)
586 printk(KERN_ERR "%s: PCI parity error.\n", 568 netdev_err(dev, "PCI parity error\n");
587 dev->name);
588 569
589 /* Write the error bits back to clear them. */ 570 /* Write the error bits back to clear them. */
590 pci_cfg_stat &= (PCI_STATUS_PARITY | 571 pci_cfg_stat &= (PCI_STATUS_PARITY |
@@ -613,7 +594,7 @@ static int gem_abnormal_irq(struct net_device *dev, struct gem *gp, u32 gem_stat
613 if (netif_msg_rx_err(gp)) 594 if (netif_msg_rx_err(gp))
614 printk(KERN_DEBUG "%s: no buffer for rx frame\n", 595 printk(KERN_DEBUG "%s: no buffer for rx frame\n",
615 gp->dev->name); 596 gp->dev->name);
616 gp->net_stats.rx_dropped++; 597 dev->stats.rx_dropped++;
617 } 598 }
618 599
619 if (gem_status & GREG_STAT_RXTAGERR) { 600 if (gem_status & GREG_STAT_RXTAGERR) {
@@ -621,7 +602,7 @@ static int gem_abnormal_irq(struct net_device *dev, struct gem *gp, u32 gem_stat
621 if (netif_msg_rx_err(gp)) 602 if (netif_msg_rx_err(gp))
622 printk(KERN_DEBUG "%s: corrupt rx tag framing\n", 603 printk(KERN_DEBUG "%s: corrupt rx tag framing\n",
623 gp->dev->name); 604 gp->dev->name);
624 gp->net_stats.rx_errors++; 605 dev->stats.rx_errors++;
625 606
626 goto do_reset; 607 goto do_reset;
627 } 608 }
@@ -703,7 +684,7 @@ static __inline__ void gem_tx(struct net_device *dev, struct gem *gp, u32 gem_st
703 break; 684 break;
704 } 685 }
705 gp->tx_skbs[entry] = NULL; 686 gp->tx_skbs[entry] = NULL;
706 gp->net_stats.tx_bytes += skb->len; 687 dev->stats.tx_bytes += skb->len;
707 688
708 for (frag = 0; frag <= skb_shinfo(skb)->nr_frags; frag++) { 689 for (frag = 0; frag <= skb_shinfo(skb)->nr_frags; frag++) {
709 txd = &gp->init_block->txd[entry]; 690 txd = &gp->init_block->txd[entry];
@@ -715,7 +696,7 @@ static __inline__ void gem_tx(struct net_device *dev, struct gem *gp, u32 gem_st
715 entry = NEXT_TX(entry); 696 entry = NEXT_TX(entry);
716 } 697 }
717 698
718 gp->net_stats.tx_packets++; 699 dev->stats.tx_packets++;
719 dev_kfree_skb_irq(skb); 700 dev_kfree_skb_irq(skb);
720 } 701 }
721 gp->tx_old = entry; 702 gp->tx_old = entry;
@@ -757,6 +738,7 @@ static __inline__ void gem_post_rxds(struct gem *gp, int limit)
757 738
758static int gem_rx(struct gem *gp, int work_to_do) 739static int gem_rx(struct gem *gp, int work_to_do)
759{ 740{
741 struct net_device *dev = gp->dev;
760 int entry, drops, work_done = 0; 742 int entry, drops, work_done = 0;
761 u32 done; 743 u32 done;
762 __sum16 csum; 744 __sum16 csum;
@@ -801,15 +783,15 @@ static int gem_rx(struct gem *gp, int work_to_do)
801 783
802 len = (status & RXDCTRL_BUFSZ) >> 16; 784 len = (status & RXDCTRL_BUFSZ) >> 16;
803 if ((len < ETH_ZLEN) || (status & RXDCTRL_BAD)) { 785 if ((len < ETH_ZLEN) || (status & RXDCTRL_BAD)) {
804 gp->net_stats.rx_errors++; 786 dev->stats.rx_errors++;
805 if (len < ETH_ZLEN) 787 if (len < ETH_ZLEN)
806 gp->net_stats.rx_length_errors++; 788 dev->stats.rx_length_errors++;
807 if (len & RXDCTRL_BAD) 789 if (len & RXDCTRL_BAD)
808 gp->net_stats.rx_crc_errors++; 790 dev->stats.rx_crc_errors++;
809 791
810 /* We'll just return it to GEM. */ 792 /* We'll just return it to GEM. */
811 drop_it: 793 drop_it:
812 gp->net_stats.rx_dropped++; 794 dev->stats.rx_dropped++;
813 goto next; 795 goto next;
814 } 796 }
815 797
@@ -862,8 +844,8 @@ static int gem_rx(struct gem *gp, int work_to_do)
862 844
863 netif_receive_skb(skb); 845 netif_receive_skb(skb);
864 846
865 gp->net_stats.rx_packets++; 847 dev->stats.rx_packets++;
866 gp->net_stats.rx_bytes += len; 848 dev->stats.rx_bytes += len;
867 849
868 next: 850 next:
869 entry = NEXT_RX(entry); 851 entry = NEXT_RX(entry);
@@ -874,8 +856,7 @@ static int gem_rx(struct gem *gp, int work_to_do)
874 gp->rx_new = entry; 856 gp->rx_new = entry;
875 857
876 if (drops) 858 if (drops)
877 printk(KERN_INFO "%s: Memory squeeze, deferring packet.\n", 859 netdev_info(gp->dev, "Memory squeeze, deferring packet\n");
878 gp->dev->name);
879 860
880 return work_done; 861 return work_done;
881} 862}
@@ -981,21 +962,19 @@ static void gem_tx_timeout(struct net_device *dev)
981{ 962{
982 struct gem *gp = netdev_priv(dev); 963 struct gem *gp = netdev_priv(dev);
983 964
984 printk(KERN_ERR "%s: transmit timed out, resetting\n", dev->name); 965 netdev_err(dev, "transmit timed out, resetting\n");
985 if (!gp->running) { 966 if (!gp->running) {
986 printk("%s: hrm.. hw not running !\n", dev->name); 967 netdev_err(dev, "hrm.. hw not running !\n");
987 return; 968 return;
988 } 969 }
989 printk(KERN_ERR "%s: TX_STATE[%08x:%08x:%08x]\n", 970 netdev_err(dev, "TX_STATE[%08x:%08x:%08x]\n",
990 dev->name, 971 readl(gp->regs + TXDMA_CFG),
991 readl(gp->regs + TXDMA_CFG), 972 readl(gp->regs + MAC_TXSTAT),
992 readl(gp->regs + MAC_TXSTAT), 973 readl(gp->regs + MAC_TXCFG));
993 readl(gp->regs + MAC_TXCFG)); 974 netdev_err(dev, "RX_STATE[%08x:%08x:%08x]\n",
994 printk(KERN_ERR "%s: RX_STATE[%08x:%08x:%08x]\n", 975 readl(gp->regs + RXDMA_CFG),
995 dev->name, 976 readl(gp->regs + MAC_RXSTAT),
996 readl(gp->regs + RXDMA_CFG), 977 readl(gp->regs + MAC_RXCFG));
997 readl(gp->regs + MAC_RXSTAT),
998 readl(gp->regs + MAC_RXCFG));
999 978
1000 spin_lock_irq(&gp->lock); 979 spin_lock_irq(&gp->lock);
1001 spin_lock(&gp->tx_lock); 980 spin_lock(&gp->tx_lock);
@@ -1026,7 +1005,7 @@ static netdev_tx_t gem_start_xmit(struct sk_buff *skb,
1026 1005
1027 ctrl = 0; 1006 ctrl = 0;
1028 if (skb->ip_summed == CHECKSUM_PARTIAL) { 1007 if (skb->ip_summed == CHECKSUM_PARTIAL) {
1029 const u64 csum_start_off = skb_transport_offset(skb); 1008 const u64 csum_start_off = skb_checksum_start_offset(skb);
1030 const u64 csum_stuff_off = csum_start_off + skb->csum_offset; 1009 const u64 csum_stuff_off = csum_start_off + skb->csum_offset;
1031 1010
1032 ctrl = (TXDCTRL_CENAB | 1011 ctrl = (TXDCTRL_CENAB |
@@ -1048,8 +1027,7 @@ static netdev_tx_t gem_start_xmit(struct sk_buff *skb,
1048 if (TX_BUFFS_AVAIL(gp) <= (skb_shinfo(skb)->nr_frags + 1)) { 1027 if (TX_BUFFS_AVAIL(gp) <= (skb_shinfo(skb)->nr_frags + 1)) {
1049 netif_stop_queue(dev); 1028 netif_stop_queue(dev);
1050 spin_unlock_irqrestore(&gp->tx_lock, flags); 1029 spin_unlock_irqrestore(&gp->tx_lock, flags);
1051 printk(KERN_ERR PFX "%s: BUG! Tx Ring full when queue awake!\n", 1030 netdev_err(dev, "BUG! Tx Ring full when queue awake!\n");
1052 dev->name);
1053 return NETDEV_TX_BUSY; 1031 return NETDEV_TX_BUSY;
1054 } 1032 }
1055 1033
@@ -1158,8 +1136,7 @@ static void gem_pcs_reset(struct gem *gp)
1158 break; 1136 break;
1159 } 1137 }
1160 if (limit < 0) 1138 if (limit < 0)
1161 printk(KERN_WARNING "%s: PCS reset bit would not clear.\n", 1139 netdev_warn(gp->dev, "PCS reset bit would not clear\n");
1162 gp->dev->name);
1163} 1140}
1164 1141
1165static void gem_pcs_reinit_adv(struct gem *gp) 1142static void gem_pcs_reinit_adv(struct gem *gp)
@@ -1173,7 +1150,7 @@ static void gem_pcs_reinit_adv(struct gem *gp)
1173 val &= ~(PCS_CFG_ENABLE | PCS_CFG_TO); 1150 val &= ~(PCS_CFG_ENABLE | PCS_CFG_TO);
1174 writel(val, gp->regs + PCS_CFG); 1151 writel(val, gp->regs + PCS_CFG);
1175 1152
1176 /* Advertise all capabilities except assymetric 1153 /* Advertise all capabilities except asymmetric
1177 * pause. 1154 * pause.
1178 */ 1155 */
1179 val = readl(gp->regs + PCS_MIIADV); 1156 val = readl(gp->regs + PCS_MIIADV);
@@ -1230,7 +1207,7 @@ static void gem_reset(struct gem *gp)
1230 } while (val & (GREG_SWRST_TXRST | GREG_SWRST_RXRST)); 1207 } while (val & (GREG_SWRST_TXRST | GREG_SWRST_RXRST));
1231 1208
1232 if (limit < 0) 1209 if (limit < 0)
1233 printk(KERN_ERR "%s: SW reset is ghetto.\n", gp->dev->name); 1210 netdev_err(gp->dev, "SW reset is ghetto\n");
1234 1211
1235 if (gp->phy_type == phy_serialink || gp->phy_type == phy_serdes) 1212 if (gp->phy_type == phy_serialink || gp->phy_type == phy_serdes)
1236 gem_pcs_reinit_adv(gp); 1213 gem_pcs_reinit_adv(gp);
@@ -1317,7 +1294,7 @@ static void gem_begin_auto_negotiation(struct gem *gp, struct ethtool_cmd *ep)
1317 autoneg = 1; 1294 autoneg = 1;
1318 } else { 1295 } else {
1319 autoneg = 0; 1296 autoneg = 0;
1320 speed = ep->speed; 1297 speed = ethtool_cmd_speed(ep);
1321 duplex = ep->duplex; 1298 duplex = ep->duplex;
1322 } 1299 }
1323 1300
@@ -1395,9 +1372,8 @@ static int gem_set_link_modes(struct gem *gp)
1395 speed = SPEED_1000; 1372 speed = SPEED_1000;
1396 } 1373 }
1397 1374
1398 if (netif_msg_link(gp)) 1375 netif_info(gp, link, gp->dev, "Link is up at %d Mbps, %s-duplex\n",
1399 printk(KERN_INFO "%s: Link is up at %d Mbps, %s-duplex.\n", 1376 speed, (full_duplex ? "full" : "half"));
1400 gp->dev->name, speed, (full_duplex ? "full" : "half"));
1401 1377
1402 if (!gp->running) 1378 if (!gp->running)
1403 return 0; 1379 return 0;
@@ -1451,15 +1427,13 @@ static int gem_set_link_modes(struct gem *gp)
1451 1427
1452 if (netif_msg_link(gp)) { 1428 if (netif_msg_link(gp)) {
1453 if (pause) { 1429 if (pause) {
1454 printk(KERN_INFO "%s: Pause is enabled " 1430 netdev_info(gp->dev,
1455 "(rxfifo: %d off: %d on: %d)\n", 1431 "Pause is enabled (rxfifo: %d off: %d on: %d)\n",
1456 gp->dev->name, 1432 gp->rx_fifo_sz,
1457 gp->rx_fifo_sz, 1433 gp->rx_pause_off,
1458 gp->rx_pause_off, 1434 gp->rx_pause_on);
1459 gp->rx_pause_on);
1460 } else { 1435 } else {
1461 printk(KERN_INFO "%s: Pause is disabled\n", 1436 netdev_info(gp->dev, "Pause is disabled\n");
1462 gp->dev->name);
1463 } 1437 }
1464 } 1438 }
1465 1439
@@ -1484,9 +1458,8 @@ static int gem_mdio_link_not_up(struct gem *gp)
1484{ 1458{
1485 switch (gp->lstate) { 1459 switch (gp->lstate) {
1486 case link_force_ret: 1460 case link_force_ret:
1487 if (netif_msg_link(gp)) 1461 netif_info(gp, link, gp->dev,
1488 printk(KERN_INFO "%s: Autoneg failed again, keeping" 1462 "Autoneg failed again, keeping forced mode\n");
1489 " forced mode\n", gp->dev->name);
1490 gp->phy_mii.def->ops->setup_forced(&gp->phy_mii, 1463 gp->phy_mii.def->ops->setup_forced(&gp->phy_mii,
1491 gp->last_forced_speed, DUPLEX_HALF); 1464 gp->last_forced_speed, DUPLEX_HALF);
1492 gp->timer_ticks = 5; 1465 gp->timer_ticks = 5;
@@ -1499,9 +1472,7 @@ static int gem_mdio_link_not_up(struct gem *gp)
1499 */ 1472 */
1500 if (gp->phy_mii.def->magic_aneg) 1473 if (gp->phy_mii.def->magic_aneg)
1501 return 1; 1474 return 1;
1502 if (netif_msg_link(gp)) 1475 netif_info(gp, link, gp->dev, "switching to forced 100bt\n");
1503 printk(KERN_INFO "%s: switching to forced 100bt\n",
1504 gp->dev->name);
1505 /* Try forced modes. */ 1476 /* Try forced modes. */
1506 gp->phy_mii.def->ops->setup_forced(&gp->phy_mii, SPEED_100, 1477 gp->phy_mii.def->ops->setup_forced(&gp->phy_mii, SPEED_100,
1507 DUPLEX_HALF); 1478 DUPLEX_HALF);
@@ -1517,9 +1488,8 @@ static int gem_mdio_link_not_up(struct gem *gp)
1517 gp->phy_mii.def->ops->setup_forced(&gp->phy_mii, SPEED_10, 1488 gp->phy_mii.def->ops->setup_forced(&gp->phy_mii, SPEED_10,
1518 DUPLEX_HALF); 1489 DUPLEX_HALF);
1519 gp->timer_ticks = 5; 1490 gp->timer_ticks = 5;
1520 if (netif_msg_link(gp)) 1491 netif_info(gp, link, gp->dev,
1521 printk(KERN_INFO "%s: switching to forced 10bt\n", 1492 "switching to forced 10bt\n");
1522 gp->dev->name);
1523 return 0; 1493 return 0;
1524 } else 1494 } else
1525 return 1; 1495 return 1;
@@ -1574,8 +1544,8 @@ static void gem_link_timer(unsigned long data)
1574 gp->last_forced_speed = gp->phy_mii.speed; 1544 gp->last_forced_speed = gp->phy_mii.speed;
1575 gp->timer_ticks = 5; 1545 gp->timer_ticks = 5;
1576 if (netif_msg_link(gp)) 1546 if (netif_msg_link(gp))
1577 printk(KERN_INFO "%s: Got link after fallback, retrying" 1547 netdev_info(gp->dev,
1578 " autoneg once...\n", gp->dev->name); 1548 "Got link after fallback, retrying autoneg once...\n");
1579 gp->phy_mii.def->ops->setup_aneg(&gp->phy_mii, gp->phy_mii.advertising); 1549 gp->phy_mii.def->ops->setup_aneg(&gp->phy_mii, gp->phy_mii.advertising);
1580 } else if (gp->lstate != link_up) { 1550 } else if (gp->lstate != link_up) {
1581 gp->lstate = link_up; 1551 gp->lstate = link_up;
@@ -1589,9 +1559,7 @@ static void gem_link_timer(unsigned long data)
1589 */ 1559 */
1590 if (gp->lstate == link_up) { 1560 if (gp->lstate == link_up) {
1591 gp->lstate = link_down; 1561 gp->lstate = link_down;
1592 if (netif_msg_link(gp)) 1562 netif_info(gp, link, gp->dev, "Link down\n");
1593 printk(KERN_INFO "%s: Link down\n",
1594 gp->dev->name);
1595 netif_carrier_off(gp->dev); 1563 netif_carrier_off(gp->dev);
1596 gp->reset_task_pending = 1; 1564 gp->reset_task_pending = 1;
1597 schedule_work(&gp->reset_task); 1565 schedule_work(&gp->reset_task);
@@ -1746,8 +1714,7 @@ static void gem_init_phy(struct gem *gp)
1746 if (phy_read(gp, MII_BMCR) != 0xffff) 1714 if (phy_read(gp, MII_BMCR) != 0xffff)
1747 break; 1715 break;
1748 if (i == 2) 1716 if (i == 2)
1749 printk(KERN_WARNING "%s: GMAC PHY not responding !\n", 1717 netdev_warn(gp->dev, "GMAC PHY not responding !\n");
1750 gp->dev->name);
1751 } 1718 }
1752 } 1719 }
1753 1720
@@ -2038,7 +2005,7 @@ static int gem_check_invariants(struct gem *gp)
2038 * as this chip has no gigabit PHY. 2005 * as this chip has no gigabit PHY.
2039 */ 2006 */
2040 if ((mif_cfg & (MIF_CFG_MDI0 | MIF_CFG_MDI1)) == 0) { 2007 if ((mif_cfg & (MIF_CFG_MDI0 | MIF_CFG_MDI1)) == 0) {
2041 printk(KERN_ERR PFX "RIO GEM lacks MII phy, mif_cfg[%08x]\n", 2008 pr_err("RIO GEM lacks MII phy, mif_cfg[%08x]\n",
2042 mif_cfg); 2009 mif_cfg);
2043 return -1; 2010 return -1;
2044 } 2011 }
@@ -2078,7 +2045,7 @@ static int gem_check_invariants(struct gem *gp)
2078 } 2045 }
2079 if (i == 32) { 2046 if (i == 32) {
2080 if (pdev->device != PCI_DEVICE_ID_SUN_GEM) { 2047 if (pdev->device != PCI_DEVICE_ID_SUN_GEM) {
2081 printk(KERN_ERR PFX "RIO MII phy will not respond.\n"); 2048 pr_err("RIO MII phy will not respond\n");
2082 return -1; 2049 return -1;
2083 } 2050 }
2084 gp->phy_type = phy_serdes; 2051 gp->phy_type = phy_serdes;
@@ -2093,7 +2060,7 @@ static int gem_check_invariants(struct gem *gp)
2093 if (pdev->device == PCI_DEVICE_ID_SUN_GEM) { 2060 if (pdev->device == PCI_DEVICE_ID_SUN_GEM) {
2094 if (gp->tx_fifo_sz != (9 * 1024) || 2061 if (gp->tx_fifo_sz != (9 * 1024) ||
2095 gp->rx_fifo_sz != (20 * 1024)) { 2062 gp->rx_fifo_sz != (20 * 1024)) {
2096 printk(KERN_ERR PFX "GEM has bogus fifo sizes tx(%d) rx(%d)\n", 2063 pr_err("GEM has bogus fifo sizes tx(%d) rx(%d)\n",
2097 gp->tx_fifo_sz, gp->rx_fifo_sz); 2064 gp->tx_fifo_sz, gp->rx_fifo_sz);
2098 return -1; 2065 return -1;
2099 } 2066 }
@@ -2101,7 +2068,7 @@ static int gem_check_invariants(struct gem *gp)
2101 } else { 2068 } else {
2102 if (gp->tx_fifo_sz != (2 * 1024) || 2069 if (gp->tx_fifo_sz != (2 * 1024) ||
2103 gp->rx_fifo_sz != (2 * 1024)) { 2070 gp->rx_fifo_sz != (2 * 1024)) {
2104 printk(KERN_ERR PFX "RIO GEM has bogus fifo sizes tx(%d) rx(%d)\n", 2071 pr_err("RIO GEM has bogus fifo sizes tx(%d) rx(%d)\n",
2105 gp->tx_fifo_sz, gp->rx_fifo_sz); 2072 gp->tx_fifo_sz, gp->rx_fifo_sz);
2106 return -1; 2073 return -1;
2107 } 2074 }
@@ -2239,7 +2206,7 @@ static int gem_do_start(struct net_device *dev)
2239 2206
2240 if (request_irq(gp->pdev->irq, gem_interrupt, 2207 if (request_irq(gp->pdev->irq, gem_interrupt,
2241 IRQF_SHARED, dev->name, (void *)dev)) { 2208 IRQF_SHARED, dev->name, (void *)dev)) {
2242 printk(KERN_ERR "%s: failed to request irq !\n", gp->dev->name); 2209 netdev_err(dev, "failed to request irq !\n");
2243 2210
2244 spin_lock_irqsave(&gp->lock, flags); 2211 spin_lock_irqsave(&gp->lock, flags);
2245 spin_lock(&gp->tx_lock); 2212 spin_lock(&gp->tx_lock);
@@ -2378,9 +2345,8 @@ static int gem_suspend(struct pci_dev *pdev, pm_message_t state)
2378 2345
2379 mutex_lock(&gp->pm_mutex); 2346 mutex_lock(&gp->pm_mutex);
2380 2347
2381 printk(KERN_INFO "%s: suspending, WakeOnLan %s\n", 2348 netdev_info(dev, "suspending, WakeOnLan %s\n",
2382 dev->name, 2349 (gp->wake_on_lan && gp->opened) ? "enabled" : "disabled");
2383 (gp->wake_on_lan && gp->opened) ? "enabled" : "disabled");
2384 2350
2385 /* Keep the cell enabled during the entire operation */ 2351 /* Keep the cell enabled during the entire operation */
2386 spin_lock_irqsave(&gp->lock, flags); 2352 spin_lock_irqsave(&gp->lock, flags);
@@ -2415,10 +2381,8 @@ static int gem_suspend(struct pci_dev *pdev, pm_message_t state)
2415 */ 2381 */
2416 mutex_unlock(&gp->pm_mutex); 2382 mutex_unlock(&gp->pm_mutex);
2417 2383
2418 /* Wait for a pending reset task to complete */ 2384 /* Wait for the pending reset task to complete */
2419 while (gp->reset_task_pending) 2385 flush_work_sync(&gp->reset_task);
2420 yield();
2421 flush_scheduled_work();
2422 2386
2423 /* Shut the PHY down eventually and setup WOL */ 2387 /* Shut the PHY down eventually and setup WOL */
2424 gem_stop_phy(gp, gp->asleep_wol); 2388 gem_stop_phy(gp, gp->asleep_wol);
@@ -2440,7 +2404,7 @@ static int gem_resume(struct pci_dev *pdev)
2440 struct gem *gp = netdev_priv(dev); 2404 struct gem *gp = netdev_priv(dev);
2441 unsigned long flags; 2405 unsigned long flags;
2442 2406
2443 printk(KERN_INFO "%s: resuming\n", dev->name); 2407 netdev_info(dev, "resuming\n");
2444 2408
2445 mutex_lock(&gp->pm_mutex); 2409 mutex_lock(&gp->pm_mutex);
2446 2410
@@ -2452,8 +2416,7 @@ static int gem_resume(struct pci_dev *pdev)
2452 2416
2453 /* Make sure PCI access and bus master are enabled */ 2417 /* Make sure PCI access and bus master are enabled */
2454 if (pci_enable_device(gp->pdev)) { 2418 if (pci_enable_device(gp->pdev)) {
2455 printk(KERN_ERR "%s: Can't re-enable chip !\n", 2419 netdev_err(dev, "Can't re-enable chip !\n");
2456 dev->name);
2457 /* Put cell and forget it for now, it will be considered as 2420 /* Put cell and forget it for now, it will be considered as
2458 * still asleep, a new sleep cycle may bring it back 2421 * still asleep, a new sleep cycle may bring it back
2459 */ 2422 */
@@ -2510,7 +2473,6 @@ static int gem_resume(struct pci_dev *pdev)
2510static struct net_device_stats *gem_get_stats(struct net_device *dev) 2473static struct net_device_stats *gem_get_stats(struct net_device *dev)
2511{ 2474{
2512 struct gem *gp = netdev_priv(dev); 2475 struct gem *gp = netdev_priv(dev);
2513 struct net_device_stats *stats = &gp->net_stats;
2514 2476
2515 spin_lock_irq(&gp->lock); 2477 spin_lock_irq(&gp->lock);
2516 spin_lock(&gp->tx_lock); 2478 spin_lock(&gp->tx_lock);
@@ -2519,17 +2481,17 @@ static struct net_device_stats *gem_get_stats(struct net_device *dev)
2519 * so we shield against this 2481 * so we shield against this
2520 */ 2482 */
2521 if (gp->running) { 2483 if (gp->running) {
2522 stats->rx_crc_errors += readl(gp->regs + MAC_FCSERR); 2484 dev->stats.rx_crc_errors += readl(gp->regs + MAC_FCSERR);
2523 writel(0, gp->regs + MAC_FCSERR); 2485 writel(0, gp->regs + MAC_FCSERR);
2524 2486
2525 stats->rx_frame_errors += readl(gp->regs + MAC_AERR); 2487 dev->stats.rx_frame_errors += readl(gp->regs + MAC_AERR);
2526 writel(0, gp->regs + MAC_AERR); 2488 writel(0, gp->regs + MAC_AERR);
2527 2489
2528 stats->rx_length_errors += readl(gp->regs + MAC_LERR); 2490 dev->stats.rx_length_errors += readl(gp->regs + MAC_LERR);
2529 writel(0, gp->regs + MAC_LERR); 2491 writel(0, gp->regs + MAC_LERR);
2530 2492
2531 stats->tx_aborted_errors += readl(gp->regs + MAC_ECOLL); 2493 dev->stats.tx_aborted_errors += readl(gp->regs + MAC_ECOLL);
2532 stats->collisions += 2494 dev->stats.collisions +=
2533 (readl(gp->regs + MAC_ECOLL) + 2495 (readl(gp->regs + MAC_ECOLL) +
2534 readl(gp->regs + MAC_LCOLL)); 2496 readl(gp->regs + MAC_LCOLL));
2535 writel(0, gp->regs + MAC_ECOLL); 2497 writel(0, gp->regs + MAC_ECOLL);
@@ -2539,7 +2501,7 @@ static struct net_device_stats *gem_get_stats(struct net_device *dev)
2539 spin_unlock(&gp->tx_lock); 2501 spin_unlock(&gp->tx_lock);
2540 spin_unlock_irq(&gp->lock); 2502 spin_unlock_irq(&gp->lock);
2541 2503
2542 return &gp->net_stats; 2504 return &dev->stats;
2543} 2505}
2544 2506
2545static int gem_set_mac_address(struct net_device *dev, void *addr) 2507static int gem_set_mac_address(struct net_device *dev, void *addr)
@@ -2680,7 +2642,7 @@ static int gem_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
2680 /* Return current PHY settings */ 2642 /* Return current PHY settings */
2681 spin_lock_irq(&gp->lock); 2643 spin_lock_irq(&gp->lock);
2682 cmd->autoneg = gp->want_autoneg; 2644 cmd->autoneg = gp->want_autoneg;
2683 cmd->speed = gp->phy_mii.speed; 2645 ethtool_cmd_speed_set(cmd, gp->phy_mii.speed);
2684 cmd->duplex = gp->phy_mii.duplex; 2646 cmd->duplex = gp->phy_mii.duplex;
2685 cmd->advertising = gp->phy_mii.advertising; 2647 cmd->advertising = gp->phy_mii.advertising;
2686 2648
@@ -2697,7 +2659,7 @@ static int gem_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
2697 SUPPORTED_100baseT_Half | SUPPORTED_100baseT_Full | 2659 SUPPORTED_100baseT_Half | SUPPORTED_100baseT_Full |
2698 SUPPORTED_Autoneg); 2660 SUPPORTED_Autoneg);
2699 cmd->advertising = cmd->supported; 2661 cmd->advertising = cmd->supported;
2700 cmd->speed = 0; 2662 ethtool_cmd_speed_set(cmd, 0);
2701 cmd->duplex = cmd->port = cmd->phy_address = 2663 cmd->duplex = cmd->port = cmd->phy_address =
2702 cmd->transceiver = cmd->autoneg = 0; 2664 cmd->transceiver = cmd->autoneg = 0;
2703 2665
@@ -2711,7 +2673,7 @@ static int gem_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
2711 cmd->advertising = cmd->supported; 2673 cmd->advertising = cmd->supported;
2712 cmd->transceiver = XCVR_INTERNAL; 2674 cmd->transceiver = XCVR_INTERNAL;
2713 if (gp->lstate == link_up) 2675 if (gp->lstate == link_up)
2714 cmd->speed = SPEED_1000; 2676 ethtool_cmd_speed_set(cmd, SPEED_1000);
2715 cmd->duplex = DUPLEX_FULL; 2677 cmd->duplex = DUPLEX_FULL;
2716 cmd->autoneg = 1; 2678 cmd->autoneg = 1;
2717 } 2679 }
@@ -2724,6 +2686,7 @@ static int gem_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
2724static int gem_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) 2686static int gem_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
2725{ 2687{
2726 struct gem *gp = netdev_priv(dev); 2688 struct gem *gp = netdev_priv(dev);
2689 u32 speed = ethtool_cmd_speed(cmd);
2727 2690
2728 /* Verify the settings we care about. */ 2691 /* Verify the settings we care about. */
2729 if (cmd->autoneg != AUTONEG_ENABLE && 2692 if (cmd->autoneg != AUTONEG_ENABLE &&
@@ -2735,9 +2698,9 @@ static int gem_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
2735 return -EINVAL; 2698 return -EINVAL;
2736 2699
2737 if (cmd->autoneg == AUTONEG_DISABLE && 2700 if (cmd->autoneg == AUTONEG_DISABLE &&
2738 ((cmd->speed != SPEED_1000 && 2701 ((speed != SPEED_1000 &&
2739 cmd->speed != SPEED_100 && 2702 speed != SPEED_100 &&
2740 cmd->speed != SPEED_10) || 2703 speed != SPEED_10) ||
2741 (cmd->duplex != DUPLEX_HALF && 2704 (cmd->duplex != DUPLEX_HALF &&
2742 cmd->duplex != DUPLEX_FULL))) 2705 cmd->duplex != DUPLEX_FULL)))
2743 return -EINVAL; 2706 return -EINVAL;
@@ -2938,7 +2901,7 @@ static int __devinit gem_get_device_address(struct gem *gp)
2938 addr = idprom->id_ethaddr; 2901 addr = idprom->id_ethaddr;
2939#else 2902#else
2940 printk("\n"); 2903 printk("\n");
2941 printk(KERN_ERR "%s: can't get mac-address\n", dev->name); 2904 pr_err("%s: can't get mac-address\n", dev->name);
2942 return -1; 2905 return -1;
2943#endif 2906#endif
2944 } 2907 }
@@ -2964,10 +2927,8 @@ static void gem_remove_one(struct pci_dev *pdev)
2964 /* We shouldn't need any locking here */ 2927 /* We shouldn't need any locking here */
2965 gem_get_cell(gp); 2928 gem_get_cell(gp);
2966 2929
2967 /* Wait for a pending reset task to complete */ 2930 /* Cancel reset task */
2968 while (gp->reset_task_pending) 2931 cancel_work_sync(&gp->reset_task);
2969 yield();
2970 flush_scheduled_work();
2971 2932
2972 /* Shut the PHY down */ 2933 /* Shut the PHY down */
2973 gem_stop_phy(gp, 0); 2934 gem_stop_phy(gp, 0);
@@ -3009,14 +2970,12 @@ static const struct net_device_ops gem_netdev_ops = {
3009static int __devinit gem_init_one(struct pci_dev *pdev, 2970static int __devinit gem_init_one(struct pci_dev *pdev,
3010 const struct pci_device_id *ent) 2971 const struct pci_device_id *ent)
3011{ 2972{
3012 static int gem_version_printed = 0;
3013 unsigned long gemreg_base, gemreg_len; 2973 unsigned long gemreg_base, gemreg_len;
3014 struct net_device *dev; 2974 struct net_device *dev;
3015 struct gem *gp; 2975 struct gem *gp;
3016 int err, pci_using_dac; 2976 int err, pci_using_dac;
3017 2977
3018 if (gem_version_printed++ == 0) 2978 printk_once(KERN_INFO "%s", version);
3019 printk(KERN_INFO "%s", version);
3020 2979
3021 /* Apple gmac note: during probe, the chip is powered up by 2980 /* Apple gmac note: during probe, the chip is powered up by
3022 * the arch code to allow the code below to work (and to let 2981 * the arch code to allow the code below to work (and to let
@@ -3026,8 +2985,7 @@ static int __devinit gem_init_one(struct pci_dev *pdev,
3026 */ 2985 */
3027 err = pci_enable_device(pdev); 2986 err = pci_enable_device(pdev);
3028 if (err) { 2987 if (err) {
3029 printk(KERN_ERR PFX "Cannot enable MMIO operation, " 2988 pr_err("Cannot enable MMIO operation, aborting\n");
3030 "aborting.\n");
3031 return err; 2989 return err;
3032 } 2990 }
3033 pci_set_master(pdev); 2991 pci_set_master(pdev);
@@ -3048,8 +3006,7 @@ static int __devinit gem_init_one(struct pci_dev *pdev,
3048 } else { 3006 } else {
3049 err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); 3007 err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
3050 if (err) { 3008 if (err) {
3051 printk(KERN_ERR PFX "No usable DMA configuration, " 3009 pr_err("No usable DMA configuration, aborting\n");
3052 "aborting.\n");
3053 goto err_disable_device; 3010 goto err_disable_device;
3054 } 3011 }
3055 pci_using_dac = 0; 3012 pci_using_dac = 0;
@@ -3059,15 +3016,14 @@ static int __devinit gem_init_one(struct pci_dev *pdev,
3059 gemreg_len = pci_resource_len(pdev, 0); 3016 gemreg_len = pci_resource_len(pdev, 0);
3060 3017
3061 if ((pci_resource_flags(pdev, 0) & IORESOURCE_IO) != 0) { 3018 if ((pci_resource_flags(pdev, 0) & IORESOURCE_IO) != 0) {
3062 printk(KERN_ERR PFX "Cannot find proper PCI device " 3019 pr_err("Cannot find proper PCI device base address, aborting\n");
3063 "base address, aborting.\n");
3064 err = -ENODEV; 3020 err = -ENODEV;
3065 goto err_disable_device; 3021 goto err_disable_device;
3066 } 3022 }
3067 3023
3068 dev = alloc_etherdev(sizeof(*gp)); 3024 dev = alloc_etherdev(sizeof(*gp));
3069 if (!dev) { 3025 if (!dev) {
3070 printk(KERN_ERR PFX "Etherdev alloc failed, aborting.\n"); 3026 pr_err("Etherdev alloc failed, aborting\n");
3071 err = -ENOMEM; 3027 err = -ENOMEM;
3072 goto err_disable_device; 3028 goto err_disable_device;
3073 } 3029 }
@@ -3077,8 +3033,7 @@ static int __devinit gem_init_one(struct pci_dev *pdev,
3077 3033
3078 err = pci_request_regions(pdev, DRV_NAME); 3034 err = pci_request_regions(pdev, DRV_NAME);
3079 if (err) { 3035 if (err) {
3080 printk(KERN_ERR PFX "Cannot obtain PCI resources, " 3036 pr_err("Cannot obtain PCI resources, aborting\n");
3081 "aborting.\n");
3082 goto err_out_free_netdev; 3037 goto err_out_free_netdev;
3083 } 3038 }
3084 3039
@@ -3104,8 +3059,7 @@ static int __devinit gem_init_one(struct pci_dev *pdev,
3104 3059
3105 gp->regs = ioremap(gemreg_base, gemreg_len); 3060 gp->regs = ioremap(gemreg_base, gemreg_len);
3106 if (!gp->regs) { 3061 if (!gp->regs) {
3107 printk(KERN_ERR PFX "Cannot map device registers, " 3062 pr_err("Cannot map device registers, aborting\n");
3108 "aborting.\n");
3109 err = -EIO; 3063 err = -EIO;
3110 goto err_out_free_res; 3064 goto err_out_free_res;
3111 } 3065 }
@@ -3150,8 +3104,7 @@ static int __devinit gem_init_one(struct pci_dev *pdev,
3150 pci_alloc_consistent(pdev, sizeof(struct gem_init_block), 3104 pci_alloc_consistent(pdev, sizeof(struct gem_init_block),
3151 &gp->gblock_dvma); 3105 &gp->gblock_dvma);
3152 if (!gp->init_block) { 3106 if (!gp->init_block) {
3153 printk(KERN_ERR PFX "Cannot allocate init block, " 3107 pr_err("Cannot allocate init block, aborting\n");
3154 "aborting.\n");
3155 err = -ENOMEM; 3108 err = -ENOMEM;
3156 goto err_out_iounmap; 3109 goto err_out_iounmap;
3157 } 3110 }
@@ -3180,22 +3133,22 @@ static int __devinit gem_init_one(struct pci_dev *pdev,
3180 3133
3181 /* Register with kernel */ 3134 /* Register with kernel */
3182 if (register_netdev(dev)) { 3135 if (register_netdev(dev)) {
3183 printk(KERN_ERR PFX "Cannot register net device, " 3136 pr_err("Cannot register net device, aborting\n");
3184 "aborting.\n");
3185 err = -ENOMEM; 3137 err = -ENOMEM;
3186 goto err_out_free_consistent; 3138 goto err_out_free_consistent;
3187 } 3139 }
3188 3140
3189 printk(KERN_INFO "%s: Sun GEM (PCI) 10/100/1000BaseT Ethernet %pM\n", 3141 netdev_info(dev, "Sun GEM (PCI) 10/100/1000BaseT Ethernet %pM\n",
3190 dev->name, dev->dev_addr); 3142 dev->dev_addr);
3191 3143
3192 if (gp->phy_type == phy_mii_mdio0 || 3144 if (gp->phy_type == phy_mii_mdio0 ||
3193 gp->phy_type == phy_mii_mdio1) 3145 gp->phy_type == phy_mii_mdio1)
3194 printk(KERN_INFO "%s: Found %s PHY\n", dev->name, 3146 netdev_info(dev, "Found %s PHY\n",
3195 gp->phy_mii.def ? gp->phy_mii.def->name : "no"); 3147 gp->phy_mii.def ? gp->phy_mii.def->name : "no");
3196 3148
3197 /* GEM can do it all... */ 3149 /* GEM can do it all... */
3198 dev->features |= NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_LLTX; 3150 dev->hw_features = NETIF_F_SG | NETIF_F_HW_CSUM;
3151 dev->features |= dev->hw_features | NETIF_F_RXCSUM | NETIF_F_LLTX;
3199 if (pci_using_dac) 3152 if (pci_using_dac)
3200 dev->features |= NETIF_F_HIGHDMA; 3153 dev->features |= NETIF_F_HIGHDMA;
3201 3154