diff options
-rw-r--r-- | drivers/net/tulip/dmfe.c | 67 |
1 files changed, 31 insertions, 36 deletions
diff --git a/drivers/net/tulip/dmfe.c b/drivers/net/tulip/dmfe.c index 2d9f09c6189e..5fc61c1012e5 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" |
@@ -149,16 +151,17 @@ | |||
149 | #define DMFE_TX_TIMEOUT ((3*HZ)/2) /* tx packet time-out time 1.5 s" */ | 151 | #define DMFE_TX_TIMEOUT ((3*HZ)/2) /* tx packet time-out time 1.5 s" */ |
150 | #define DMFE_TX_KICK (HZ/2) /* tx packet Kick-out time 0.5 s" */ | 152 | #define DMFE_TX_KICK (HZ/2) /* tx packet Kick-out time 0.5 s" */ |
151 | 153 | ||
152 | #define DMFE_DBUG(dbug_now, msg, value) \ | 154 | #define DMFE_DBUG(dbug_now, msg, value) \ |
153 | do { \ | 155 | do { \ |
154 | if (dmfe_debug || (dbug_now)) \ | 156 | if (dmfe_debug || (dbug_now)) \ |
155 | printk(KERN_ERR DRV_NAME ": %s %lx\n",\ | 157 | pr_err("%s %lx\n", \ |
156 | (msg), (long) (value)); \ | 158 | (msg), (long) (value)); \ |
157 | } while (0) | 159 | } while (0) |
158 | 160 | ||
159 | #define SHOW_MEDIA_TYPE(mode) \ | 161 | #define SHOW_MEDIA_TYPE(mode) \ |
160 | printk (KERN_INFO DRV_NAME ": Change Speed to %sMhz %s duplex\n" , \ | 162 | pr_info("Change Speed to %sMhz %s duplex\n" , \ |
161 | (mode & 1) ? "100":"10", (mode & 4) ? "full":"half"); | 163 | (mode & 1) ? "100":"10", \ |
164 | (mode & 4) ? "full":"half"); | ||
162 | 165 | ||
163 | 166 | ||
164 | /* CR9 definition: SROM/MII */ | 167 | /* CR9 definition: SROM/MII */ |
@@ -391,8 +394,7 @@ static int __devinit dmfe_init_one (struct pci_dev *pdev, | |||
391 | struct device_node *dp = pci_device_to_OF_node(pdev); | 394 | struct device_node *dp = pci_device_to_OF_node(pdev); |
392 | 395 | ||
393 | if (dp && of_get_property(dp, "local-mac-address", NULL)) { | 396 | if (dp && of_get_property(dp, "local-mac-address", NULL)) { |
394 | printk(KERN_INFO DRV_NAME | 397 | pr_info("skipping on-board DM910x (use tulip)\n"); |
395 | ": skipping on-board DM910x (use tulip)\n"); | ||
396 | return -ENODEV; | 398 | return -ENODEV; |
397 | } | 399 | } |
398 | } | 400 | } |
@@ -405,8 +407,7 @@ static int __devinit dmfe_init_one (struct pci_dev *pdev, | |||
405 | SET_NETDEV_DEV(dev, &pdev->dev); | 407 | SET_NETDEV_DEV(dev, &pdev->dev); |
406 | 408 | ||
407 | if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { | 409 | if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { |
408 | printk(KERN_WARNING DRV_NAME | 410 | pr_warning("32-bit PCI DMA not available\n"); |
409 | ": 32-bit PCI DMA not available.\n"); | ||
410 | err = -ENODEV; | 411 | err = -ENODEV; |
411 | goto err_out_free; | 412 | goto err_out_free; |
412 | } | 413 | } |
@@ -417,13 +418,13 @@ static int __devinit dmfe_init_one (struct pci_dev *pdev, | |||
417 | goto err_out_free; | 418 | goto err_out_free; |
418 | 419 | ||
419 | if (!pci_resource_start(pdev, 0)) { | 420 | if (!pci_resource_start(pdev, 0)) { |
420 | printk(KERN_ERR DRV_NAME ": I/O base is zero\n"); | 421 | pr_err("I/O base is zero\n"); |
421 | err = -ENODEV; | 422 | err = -ENODEV; |
422 | goto err_out_disable; | 423 | goto err_out_disable; |
423 | } | 424 | } |
424 | 425 | ||
425 | if (pci_resource_len(pdev, 0) < (CHK_IO_SIZE(pdev)) ) { | 426 | if (pci_resource_len(pdev, 0) < (CHK_IO_SIZE(pdev)) ) { |
426 | printk(KERN_ERR DRV_NAME ": Allocated I/O size too small\n"); | 427 | pr_err("Allocated I/O size too small\n"); |
427 | err = -ENODEV; | 428 | err = -ENODEV; |
428 | goto err_out_disable; | 429 | goto err_out_disable; |
429 | } | 430 | } |
@@ -438,7 +439,7 @@ static int __devinit dmfe_init_one (struct pci_dev *pdev, | |||
438 | #endif | 439 | #endif |
439 | 440 | ||
440 | if (pci_request_regions(pdev, DRV_NAME)) { | 441 | if (pci_request_regions(pdev, DRV_NAME)) { |
441 | printk(KERN_ERR DRV_NAME ": Failed to request PCI regions\n"); | 442 | pr_err("Failed to request PCI regions\n"); |
442 | err = -ENODEV; | 443 | err = -ENODEV; |
443 | goto err_out_disable; | 444 | goto err_out_disable; |
444 | } | 445 | } |
@@ -497,12 +498,9 @@ static int __devinit dmfe_init_one (struct pci_dev *pdev, | |||
497 | if (err) | 498 | if (err) |
498 | goto err_out_free_buf; | 499 | goto err_out_free_buf; |
499 | 500 | ||
500 | printk(KERN_INFO "%s: Davicom DM%04lx at pci%s, %pM, irq %d.\n", | 501 | dev_info(&dev->dev, "Davicom DM%04lx at pci%s, %pM, irq %d\n", |
501 | dev->name, | 502 | ent->driver_data >> 16, |
502 | ent->driver_data >> 16, | 503 | pci_name(pdev), dev->dev_addr, dev->irq); |
503 | pci_name(pdev), | ||
504 | dev->dev_addr, | ||
505 | dev->irq); | ||
506 | 504 | ||
507 | pci_set_master(pdev); | 505 | pci_set_master(pdev); |
508 | 506 | ||
@@ -696,7 +694,7 @@ static netdev_tx_t dmfe_start_xmit(struct sk_buff *skb, | |||
696 | 694 | ||
697 | /* Too large packet check */ | 695 | /* Too large packet check */ |
698 | if (skb->len > MAX_PACKET_SIZE) { | 696 | if (skb->len > MAX_PACKET_SIZE) { |
699 | printk(KERN_ERR DRV_NAME ": big packet = %d\n", (u16)skb->len); | 697 | pr_err("big packet = %d\n", (u16)skb->len); |
700 | dev_kfree_skb(skb); | 698 | dev_kfree_skb(skb); |
701 | return NETDEV_TX_OK; | 699 | return NETDEV_TX_OK; |
702 | } | 700 | } |
@@ -706,8 +704,7 @@ static netdev_tx_t dmfe_start_xmit(struct sk_buff *skb, | |||
706 | /* No Tx resource check, it never happen nromally */ | 704 | /* No Tx resource check, it never happen nromally */ |
707 | if (db->tx_queue_cnt >= TX_FREE_DESC_CNT) { | 705 | if (db->tx_queue_cnt >= TX_FREE_DESC_CNT) { |
708 | spin_unlock_irqrestore(&db->lock, flags); | 706 | spin_unlock_irqrestore(&db->lock, flags); |
709 | printk(KERN_ERR DRV_NAME ": No Tx resource %ld\n", | 707 | pr_err("No Tx resource %ld\n", db->tx_queue_cnt); |
710 | db->tx_queue_cnt); | ||
711 | return NETDEV_TX_BUSY; | 708 | return NETDEV_TX_BUSY; |
712 | } | 709 | } |
713 | 710 | ||
@@ -779,12 +776,11 @@ static int dmfe_stop(struct DEVICE *dev) | |||
779 | 776 | ||
780 | #if 0 | 777 | #if 0 |
781 | /* show statistic counter */ | 778 | /* show statistic counter */ |
782 | printk(DRV_NAME ": FU:%lx EC:%lx LC:%lx NC:%lx" | 779 | printk("FU:%lx EC:%lx LC:%lx NC:%lx LOC:%lx TXJT:%lx RESET:%lx RCR8:%lx FAL:%lx TT:%lx\n", |
783 | " LOC:%lx TXJT:%lx RESET:%lx RCR8:%lx FAL:%lx TT:%lx\n", | 780 | db->tx_fifo_underrun, db->tx_excessive_collision, |
784 | db->tx_fifo_underrun, db->tx_excessive_collision, | 781 | db->tx_late_collision, db->tx_no_carrier, db->tx_loss_carrier, |
785 | db->tx_late_collision, db->tx_no_carrier, db->tx_loss_carrier, | 782 | db->tx_jabber_timeout, db->reset_count, db->reset_cr8, |
786 | db->tx_jabber_timeout, db->reset_count, db->reset_cr8, | 783 | db->reset_fatal, db->reset_TXtimeout); |
787 | db->reset_fatal, db->reset_TXtimeout); | ||
788 | #endif | 784 | #endif |
789 | 785 | ||
790 | return 0; | 786 | return 0; |
@@ -885,7 +881,7 @@ static void dmfe_free_tx_pkt(struct DEVICE *dev, struct dmfe_board_info * db) | |||
885 | txptr = db->tx_remove_ptr; | 881 | txptr = db->tx_remove_ptr; |
886 | while(db->tx_packet_cnt) { | 882 | while(db->tx_packet_cnt) { |
887 | tdes0 = le32_to_cpu(txptr->tdes0); | 883 | tdes0 = le32_to_cpu(txptr->tdes0); |
888 | /* printk(DRV_NAME ": tdes0=%x\n", tdes0); */ | 884 | pr_debug("tdes0=%x\n", tdes0); |
889 | if (tdes0 & 0x80000000) | 885 | if (tdes0 & 0x80000000) |
890 | break; | 886 | break; |
891 | 887 | ||
@@ -895,7 +891,7 @@ static void dmfe_free_tx_pkt(struct DEVICE *dev, struct dmfe_board_info * db) | |||
895 | 891 | ||
896 | /* Transmit statistic counter */ | 892 | /* Transmit statistic counter */ |
897 | if ( tdes0 != 0x7fffffff ) { | 893 | if ( tdes0 != 0x7fffffff ) { |
898 | /* printk(DRV_NAME ": tdes0=%x\n", tdes0); */ | 894 | pr_debug("tdes0=%x\n", tdes0); |
899 | dev->stats.collisions += (tdes0 >> 3) & 0xf; | 895 | dev->stats.collisions += (tdes0 >> 3) & 0xf; |
900 | dev->stats.tx_bytes += le32_to_cpu(txptr->tdes1) & 0x7ff; | 896 | dev->stats.tx_bytes += le32_to_cpu(txptr->tdes1) & 0x7ff; |
901 | if (tdes0 & TDES0_ERR_MASK) { | 897 | if (tdes0 & TDES0_ERR_MASK) { |
@@ -992,7 +988,7 @@ static void dmfe_rx_packet(struct DEVICE *dev, struct dmfe_board_info * db) | |||
992 | /* error summary bit check */ | 988 | /* error summary bit check */ |
993 | if (rdes0 & 0x8000) { | 989 | if (rdes0 & 0x8000) { |
994 | /* This is a error packet */ | 990 | /* This is a error packet */ |
995 | //printk(DRV_NAME ": rdes0: %lx\n", rdes0); | 991 | pr_debug("rdes0: %x\n", rdes0); |
996 | dev->stats.rx_errors++; | 992 | dev->stats.rx_errors++; |
997 | if (rdes0 & 1) | 993 | if (rdes0 & 1) |
998 | dev->stats.rx_fifo_errors++; | 994 | dev->stats.rx_fifo_errors++; |
@@ -1191,8 +1187,7 @@ static void dmfe_timer(unsigned long data) | |||
1191 | if ( time_after(jiffies, dev->trans_start + DMFE_TX_TIMEOUT) ) { | 1187 | if ( time_after(jiffies, dev->trans_start + DMFE_TX_TIMEOUT) ) { |
1192 | db->reset_TXtimeout++; | 1188 | db->reset_TXtimeout++; |
1193 | db->wait_reset = 1; | 1189 | db->wait_reset = 1; |
1194 | printk(KERN_WARNING "%s: Tx timeout - resetting\n", | 1190 | dev_warn(&dev->dev, "Tx timeout - resetting\n"); |
1195 | dev->name); | ||
1196 | } | 1191 | } |
1197 | } | 1192 | } |
1198 | 1193 | ||
@@ -1646,7 +1641,7 @@ static u8 dmfe_sense_speed(struct dmfe_board_info * db) | |||
1646 | else /* DM9102/DM9102A */ | 1641 | else /* DM9102/DM9102A */ |
1647 | phy_mode = phy_read(db->ioaddr, | 1642 | phy_mode = phy_read(db->ioaddr, |
1648 | db->phy_addr, 17, db->chip_id) & 0xf000; | 1643 | db->phy_addr, 17, db->chip_id) & 0xf000; |
1649 | /* printk(DRV_NAME ": Phy_mode %x ",phy_mode); */ | 1644 | pr_debug("Phy_mode %x\n", phy_mode); |
1650 | switch (phy_mode) { | 1645 | switch (phy_mode) { |
1651 | case 0x1000: db->op_mode = DMFE_10MHF; break; | 1646 | case 0x1000: db->op_mode = DMFE_10MHF; break; |
1652 | case 0x2000: db->op_mode = DMFE_10MFD; break; | 1647 | case 0x2000: db->op_mode = DMFE_10MFD; break; |