diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
commit | c71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch) | |
tree | ecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /drivers/net/tulip/uli526x.c | |
parent | ea53c912f8a86a8567697115b6a0d8152beee5c8 (diff) | |
parent | 6a00f206debf8a5c8899055726ad127dbeeed098 (diff) |
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts:
litmus/sched_cedf.c
Diffstat (limited to 'drivers/net/tulip/uli526x.c')
-rw-r--r-- | drivers/net/tulip/uli526x.c | 75 |
1 files changed, 27 insertions, 48 deletions
diff --git a/drivers/net/tulip/uli526x.c b/drivers/net/tulip/uli526x.c index 96de5829b940..9e63f406f72d 100644 --- a/drivers/net/tulip/uli526x.c +++ b/drivers/net/tulip/uli526x.c | |||
@@ -209,8 +209,7 @@ enum uli526x_CR6_bits { | |||
209 | /* Global variable declaration ----------------------------- */ | 209 | /* Global variable declaration ----------------------------- */ |
210 | static int __devinitdata printed_version; | 210 | static int __devinitdata printed_version; |
211 | static const char version[] __devinitconst = | 211 | static const char version[] __devinitconst = |
212 | KERN_INFO DRV_NAME ": ULi M5261/M5263 net driver, version " | 212 | "ULi M5261/M5263 net driver, version " DRV_VERSION " (" DRV_RELDATE ")"; |
213 | DRV_VERSION " (" DRV_RELDATE ")\n"; | ||
214 | 213 | ||
215 | static int uli526x_debug; | 214 | static int uli526x_debug; |
216 | static unsigned char uli526x_media_mode = ULI526X_AUTO; | 215 | static unsigned char uli526x_media_mode = ULI526X_AUTO; |
@@ -283,7 +282,7 @@ static int __devinit uli526x_init_one (struct pci_dev *pdev, | |||
283 | ULI526X_DBUG(0, "uli526x_init_one()", 0); | 282 | ULI526X_DBUG(0, "uli526x_init_one()", 0); |
284 | 283 | ||
285 | if (!printed_version++) | 284 | if (!printed_version++) |
286 | printk(version); | 285 | pr_info("%s\n", version); |
287 | 286 | ||
288 | /* Init network device */ | 287 | /* Init network device */ |
289 | dev = alloc_etherdev(sizeof(*db)); | 288 | dev = alloc_etherdev(sizeof(*db)); |
@@ -292,7 +291,7 @@ static int __devinit uli526x_init_one (struct pci_dev *pdev, | |||
292 | SET_NETDEV_DEV(dev, &pdev->dev); | 291 | SET_NETDEV_DEV(dev, &pdev->dev); |
293 | 292 | ||
294 | if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { | 293 | if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { |
295 | pr_warning("32-bit PCI DMA not available\n"); | 294 | pr_warn("32-bit PCI DMA not available\n"); |
296 | err = -ENODEV; | 295 | err = -ENODEV; |
297 | goto err_out_free; | 296 | goto err_out_free; |
298 | } | 297 | } |
@@ -390,9 +389,9 @@ static int __devinit uli526x_init_one (struct pci_dev *pdev, | |||
390 | if (err) | 389 | if (err) |
391 | goto err_out_res; | 390 | goto err_out_res; |
392 | 391 | ||
393 | dev_info(&dev->dev, "ULi M%04lx at pci%s, %pM, irq %d\n", | 392 | netdev_info(dev, "ULi M%04lx at pci%s, %pM, irq %d\n", |
394 | ent->driver_data >> 16, pci_name(pdev), | 393 | ent->driver_data >> 16, pci_name(pdev), |
395 | dev->dev_addr, dev->irq); | 394 | dev->dev_addr, dev->irq); |
396 | 395 | ||
397 | pci_set_master(pdev); | 396 | pci_set_master(pdev); |
398 | 397 | ||
@@ -480,7 +479,7 @@ static int uli526x_open(struct net_device *dev) | |||
480 | init_timer(&db->timer); | 479 | init_timer(&db->timer); |
481 | db->timer.expires = ULI526X_TIMER_WUT + HZ * 2; | 480 | db->timer.expires = ULI526X_TIMER_WUT + HZ * 2; |
482 | db->timer.data = (unsigned long)dev; | 481 | db->timer.data = (unsigned long)dev; |
483 | db->timer.function = &uli526x_timer; | 482 | db->timer.function = uli526x_timer; |
484 | add_timer(&db->timer); | 483 | add_timer(&db->timer); |
485 | 484 | ||
486 | return 0; | 485 | return 0; |
@@ -524,7 +523,7 @@ static void uli526x_init(struct net_device *dev) | |||
524 | } | 523 | } |
525 | } | 524 | } |
526 | if(phy_tmp == 32) | 525 | if(phy_tmp == 32) |
527 | pr_warning("Can not find the phy address!!!"); | 526 | pr_warn("Can not find the phy address!!!\n"); |
528 | /* Parser SROM and media mode */ | 527 | /* Parser SROM and media mode */ |
529 | db->media_mode = uli526x_media_mode; | 528 | db->media_mode = uli526x_media_mode; |
530 | 529 | ||
@@ -590,7 +589,7 @@ static netdev_tx_t uli526x_start_xmit(struct sk_buff *skb, | |||
590 | 589 | ||
591 | /* Too large packet check */ | 590 | /* Too large packet check */ |
592 | if (skb->len > MAX_PACKET_SIZE) { | 591 | if (skb->len > MAX_PACKET_SIZE) { |
593 | pr_err("big packet = %d\n", (u16)skb->len); | 592 | netdev_err(dev, "big packet = %d\n", (u16)skb->len); |
594 | dev_kfree_skb(skb); | 593 | dev_kfree_skb(skb); |
595 | return NETDEV_TX_OK; | 594 | return NETDEV_TX_OK; |
596 | } | 595 | } |
@@ -600,7 +599,7 @@ static netdev_tx_t uli526x_start_xmit(struct sk_buff *skb, | |||
600 | /* No Tx resource check, it never happen nromally */ | 599 | /* No Tx resource check, it never happen nromally */ |
601 | if (db->tx_packet_cnt >= TX_FREE_DESC_CNT) { | 600 | if (db->tx_packet_cnt >= TX_FREE_DESC_CNT) { |
602 | spin_unlock_irqrestore(&db->lock, flags); | 601 | spin_unlock_irqrestore(&db->lock, flags); |
603 | pr_err("No Tx resource %ld\n", db->tx_packet_cnt); | 602 | netdev_err(dev, "No Tx resource %ld\n", db->tx_packet_cnt); |
604 | return NETDEV_TX_BUSY; | 603 | return NETDEV_TX_BUSY; |
605 | } | 604 | } |
606 | 605 | ||
@@ -667,15 +666,6 @@ static int uli526x_stop(struct net_device *dev) | |||
667 | /* free allocated rx buffer */ | 666 | /* free allocated rx buffer */ |
668 | uli526x_free_rxbuffer(db); | 667 | uli526x_free_rxbuffer(db); |
669 | 668 | ||
670 | #if 0 | ||
671 | /* show statistic counter */ | ||
672 | printk(DRV_NAME ": FU:%lx EC:%lx LC:%lx NC:%lx LOC:%lx TXJT:%lx RESET:%lx RCR8:%lx FAL:%lx TT:%lx\n", | ||
673 | db->tx_fifo_underrun, db->tx_excessive_collision, | ||
674 | db->tx_late_collision, db->tx_no_carrier, db->tx_loss_carrier, | ||
675 | db->tx_jabber_timeout, db->reset_count, db->reset_cr8, | ||
676 | db->reset_fatal, db->reset_TXtimeout); | ||
677 | #endif | ||
678 | |||
679 | return 0; | 669 | return 0; |
680 | } | 670 | } |
681 | 671 | ||
@@ -755,7 +745,6 @@ static void uli526x_free_tx_pkt(struct net_device *dev, | |||
755 | txptr = db->tx_remove_ptr; | 745 | txptr = db->tx_remove_ptr; |
756 | while(db->tx_packet_cnt) { | 746 | while(db->tx_packet_cnt) { |
757 | tdes0 = le32_to_cpu(txptr->tdes0); | 747 | tdes0 = le32_to_cpu(txptr->tdes0); |
758 | /* printk(DRV_NAME ": tdes0=%x\n", tdes0); */ | ||
759 | if (tdes0 & 0x80000000) | 748 | if (tdes0 & 0x80000000) |
760 | break; | 749 | break; |
761 | 750 | ||
@@ -765,7 +754,6 @@ static void uli526x_free_tx_pkt(struct net_device *dev, | |||
765 | 754 | ||
766 | /* Transmit statistic counter */ | 755 | /* Transmit statistic counter */ |
767 | if ( tdes0 != 0x7fffffff ) { | 756 | if ( tdes0 != 0x7fffffff ) { |
768 | /* printk(DRV_NAME ": tdes0=%x\n", tdes0); */ | ||
769 | dev->stats.collisions += (tdes0 >> 3) & 0xf; | 757 | dev->stats.collisions += (tdes0 >> 3) & 0xf; |
770 | dev->stats.tx_bytes += le32_to_cpu(txptr->tdes1) & 0x7ff; | 758 | dev->stats.tx_bytes += le32_to_cpu(txptr->tdes1) & 0x7ff; |
771 | if (tdes0 & TDES0_ERR_MASK) { | 759 | if (tdes0 & TDES0_ERR_MASK) { |
@@ -838,7 +826,6 @@ static void uli526x_rx_packet(struct net_device *dev, struct uli526x_board_info | |||
838 | /* error summary bit check */ | 826 | /* error summary bit check */ |
839 | if (rdes0 & 0x8000) { | 827 | if (rdes0 & 0x8000) { |
840 | /* This is a error packet */ | 828 | /* This is a error packet */ |
841 | //printk(DRV_NAME ": rdes0: %lx\n", rdes0); | ||
842 | dev->stats.rx_errors++; | 829 | dev->stats.rx_errors++; |
843 | if (rdes0 & 1) | 830 | if (rdes0 & 1) |
844 | dev->stats.rx_fifo_errors++; | 831 | dev->stats.rx_fifo_errors++; |
@@ -945,12 +932,12 @@ ULi_ethtool_gset(struct uli526x_board_info *db, struct ethtool_cmd *ecmd) | |||
945 | 932 | ||
946 | ecmd->transceiver = XCVR_EXTERNAL; | 933 | ecmd->transceiver = XCVR_EXTERNAL; |
947 | 934 | ||
948 | ecmd->speed = 10; | 935 | ethtool_cmd_speed_set(ecmd, SPEED_10); |
949 | ecmd->duplex = DUPLEX_HALF; | 936 | ecmd->duplex = DUPLEX_HALF; |
950 | 937 | ||
951 | if(db->op_mode==ULI526X_100MHF || db->op_mode==ULI526X_100MFD) | 938 | if(db->op_mode==ULI526X_100MHF || db->op_mode==ULI526X_100MFD) |
952 | { | 939 | { |
953 | ecmd->speed = 100; | 940 | ethtool_cmd_speed_set(ecmd, SPEED_100); |
954 | } | 941 | } |
955 | if(db->op_mode==ULI526X_10MFD || db->op_mode==ULI526X_100MFD) | 942 | if(db->op_mode==ULI526X_10MFD || db->op_mode==ULI526X_100MFD) |
956 | { | 943 | { |
@@ -958,7 +945,7 @@ ULi_ethtool_gset(struct uli526x_board_info *db, struct ethtool_cmd *ecmd) | |||
958 | } | 945 | } |
959 | if(db->link_failed) | 946 | if(db->link_failed) |
960 | { | 947 | { |
961 | ecmd->speed = -1; | 948 | ethtool_cmd_speed_set(ecmd, -1); |
962 | ecmd->duplex = -1; | 949 | ecmd->duplex = -1; |
963 | } | 950 | } |
964 | 951 | ||
@@ -1024,7 +1011,6 @@ static void uli526x_timer(unsigned long data) | |||
1024 | struct net_device *dev = (struct net_device *) data; | 1011 | struct net_device *dev = (struct net_device *) data; |
1025 | struct uli526x_board_info *db = netdev_priv(dev); | 1012 | struct uli526x_board_info *db = netdev_priv(dev); |
1026 | unsigned long flags; | 1013 | unsigned long flags; |
1027 | u8 TmpSpeed=10; | ||
1028 | 1014 | ||
1029 | //ULI526X_DBUG(0, "uli526x_timer()", 0); | 1015 | //ULI526X_DBUG(0, "uli526x_timer()", 0); |
1030 | spin_lock_irqsave(&db->lock, flags); | 1016 | spin_lock_irqsave(&db->lock, flags); |
@@ -1047,8 +1033,7 @@ static void uli526x_timer(unsigned long data) | |||
1047 | if ( time_after(jiffies, dev_trans_start(dev) + ULI526X_TX_TIMEOUT) ) { | 1033 | if ( time_after(jiffies, dev_trans_start(dev) + ULI526X_TX_TIMEOUT) ) { |
1048 | db->reset_TXtimeout++; | 1034 | db->reset_TXtimeout++; |
1049 | db->wait_reset = 1; | 1035 | db->wait_reset = 1; |
1050 | printk( "%s: Tx timeout - resetting\n", | 1036 | netdev_err(dev, " Tx timeout - resetting\n"); |
1051 | dev->name); | ||
1052 | } | 1037 | } |
1053 | } | 1038 | } |
1054 | 1039 | ||
@@ -1070,7 +1055,7 @@ static void uli526x_timer(unsigned long data) | |||
1070 | /* Link Failed */ | 1055 | /* Link Failed */ |
1071 | ULI526X_DBUG(0, "Link Failed", tmp_cr12); | 1056 | ULI526X_DBUG(0, "Link Failed", tmp_cr12); |
1072 | netif_carrier_off(dev); | 1057 | netif_carrier_off(dev); |
1073 | pr_info("%s NIC Link is Down\n",dev->name); | 1058 | netdev_info(dev, "NIC Link is Down\n"); |
1074 | db->link_failed = 1; | 1059 | db->link_failed = 1; |
1075 | 1060 | ||
1076 | /* For Force 10/100M Half/Full mode: Enable Auto-Nego mode */ | 1061 | /* For Force 10/100M Half/Full mode: Enable Auto-Nego mode */ |
@@ -1096,18 +1081,13 @@ static void uli526x_timer(unsigned long data) | |||
1096 | 1081 | ||
1097 | if(db->link_failed==0) | 1082 | if(db->link_failed==0) |
1098 | { | 1083 | { |
1099 | if(db->op_mode==ULI526X_100MHF || db->op_mode==ULI526X_100MFD) | 1084 | netdev_info(dev, "NIC Link is Up %d Mbps %s duplex\n", |
1100 | { | 1085 | (db->op_mode == ULI526X_100MHF || |
1101 | TmpSpeed = 100; | 1086 | db->op_mode == ULI526X_100MFD) |
1102 | } | 1087 | ? 100 : 10, |
1103 | if(db->op_mode==ULI526X_10MFD || db->op_mode==ULI526X_100MFD) | 1088 | (db->op_mode == ULI526X_10MFD || |
1104 | { | 1089 | db->op_mode == ULI526X_100MFD) |
1105 | pr_info("%s NIC Link is Up %d Mbps Full duplex\n",dev->name,TmpSpeed); | 1090 | ? "Full" : "Half"); |
1106 | } | ||
1107 | else | ||
1108 | { | ||
1109 | pr_info("%s NIC Link is Up %d Mbps Half duplex\n",dev->name,TmpSpeed); | ||
1110 | } | ||
1111 | netif_carrier_on(dev); | 1091 | netif_carrier_on(dev); |
1112 | } | 1092 | } |
1113 | /* SHOW_MEDIA_TYPE(db->op_mode); */ | 1093 | /* SHOW_MEDIA_TYPE(db->op_mode); */ |
@@ -1116,7 +1096,7 @@ static void uli526x_timer(unsigned long data) | |||
1116 | { | 1096 | { |
1117 | if(db->init==1) | 1097 | if(db->init==1) |
1118 | { | 1098 | { |
1119 | pr_info("%s NIC Link is Down\n",dev->name); | 1099 | netdev_info(dev, "NIC Link is Down\n"); |
1120 | netif_carrier_off(dev); | 1100 | netif_carrier_off(dev); |
1121 | } | 1101 | } |
1122 | } | 1102 | } |
@@ -1242,7 +1222,7 @@ static int uli526x_resume(struct pci_dev *pdev) | |||
1242 | 1222 | ||
1243 | err = pci_set_power_state(pdev, PCI_D0); | 1223 | err = pci_set_power_state(pdev, PCI_D0); |
1244 | if (err) { | 1224 | if (err) { |
1245 | dev_warn(&dev->dev, "Could not put device into D0\n"); | 1225 | netdev_warn(dev, "Could not put device into D0\n"); |
1246 | return err; | 1226 | return err; |
1247 | } | 1227 | } |
1248 | 1228 | ||
@@ -1443,7 +1423,7 @@ static void send_filter_frame(struct net_device *dev, int mc_cnt) | |||
1443 | update_cr6(db->cr6_data, dev->base_addr); | 1423 | update_cr6(db->cr6_data, dev->base_addr); |
1444 | dev->trans_start = jiffies; | 1424 | dev->trans_start = jiffies; |
1445 | } else | 1425 | } else |
1446 | pr_err("No Tx resource - Send_filter_frame!\n"); | 1426 | netdev_err(dev, "No Tx resource - Send_filter_frame!\n"); |
1447 | } | 1427 | } |
1448 | 1428 | ||
1449 | 1429 | ||
@@ -1540,7 +1520,6 @@ static u8 uli526x_sense_speed(struct uli526x_board_info * db) | |||
1540 | else | 1520 | else |
1541 | phy_mode = 0x1000; | 1521 | phy_mode = 0x1000; |
1542 | 1522 | ||
1543 | /* printk(DRV_NAME ": Phy_mode %x ",phy_mode); */ | ||
1544 | switch (phy_mode) { | 1523 | switch (phy_mode) { |
1545 | case 0x1000: db->op_mode = ULI526X_10MHF; break; | 1524 | case 0x1000: db->op_mode = ULI526X_10MHF; break; |
1546 | case 0x2000: db->op_mode = ULI526X_10MFD; break; | 1525 | case 0x2000: db->op_mode = ULI526X_10MFD; break; |
@@ -1747,7 +1726,7 @@ static u16 phy_readby_cr10(unsigned long iobase, u8 phy_addr, u8 offset) | |||
1747 | if(cr10_value&0x10000000) | 1726 | if(cr10_value&0x10000000) |
1748 | break; | 1727 | break; |
1749 | } | 1728 | } |
1750 | return (cr10_value&0x0ffff); | 1729 | return cr10_value & 0x0ffff; |
1751 | } | 1730 | } |
1752 | 1731 | ||
1753 | static void phy_writeby_cr10(unsigned long iobase, u8 phy_addr, u8 offset, u16 phy_data) | 1732 | static void phy_writeby_cr10(unsigned long iobase, u8 phy_addr, u8 offset, u16 phy_data) |
@@ -1829,7 +1808,7 @@ MODULE_PARM_DESC(mode, "ULi M5261/M5263: Bit 0: 10/100Mbps, bit 2: duplex, bit 8 | |||
1829 | static int __init uli526x_init_module(void) | 1808 | static int __init uli526x_init_module(void) |
1830 | { | 1809 | { |
1831 | 1810 | ||
1832 | printk(version); | 1811 | pr_info("%s\n", version); |
1833 | printed_version = 1; | 1812 | printed_version = 1; |
1834 | 1813 | ||
1835 | ULI526X_DBUG(0, "init_module() ", debug); | 1814 | ULI526X_DBUG(0, "init_module() ", debug); |