diff options
Diffstat (limited to 'drivers/net/tulip/de2104x.c')
-rw-r--r-- | drivers/net/tulip/de2104x.c | 201 |
1 files changed, 93 insertions, 108 deletions
diff --git a/drivers/net/tulip/de2104x.c b/drivers/net/tulip/de2104x.c index 6888e3d41462..e2f692351180 100644 --- a/drivers/net/tulip/de2104x.c +++ b/drivers/net/tulip/de2104x.c | |||
@@ -27,6 +27,8 @@ | |||
27 | 27 | ||
28 | */ | 28 | */ |
29 | 29 | ||
30 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
31 | |||
30 | #define DRV_NAME "de2104x" | 32 | #define DRV_NAME "de2104x" |
31 | #define DRV_VERSION "0.7" | 33 | #define DRV_VERSION "0.7" |
32 | #define DRV_RELDATE "Mar 17, 2004" | 34 | #define DRV_RELDATE "Mar 17, 2004" |
@@ -51,7 +53,7 @@ | |||
51 | 53 | ||
52 | /* These identify the driver base version and may not be removed. */ | 54 | /* These identify the driver base version and may not be removed. */ |
53 | static char version[] = | 55 | static char version[] = |
54 | KERN_INFO DRV_NAME " PCI Ethernet driver v" DRV_VERSION " (" DRV_RELDATE ")\n"; | 56 | "PCI Ethernet driver v" DRV_VERSION " (" DRV_RELDATE ")"; |
55 | 57 | ||
56 | MODULE_AUTHOR("Jeff Garzik <jgarzik@pobox.com>"); | 58 | MODULE_AUTHOR("Jeff Garzik <jgarzik@pobox.com>"); |
57 | MODULE_DESCRIPTION("Intel/Digital 21040/1 series PCI Ethernet driver"); | 59 | MODULE_DESCRIPTION("Intel/Digital 21040/1 series PCI Ethernet driver"); |
@@ -73,8 +75,6 @@ static int rx_copybreak = 100; | |||
73 | module_param (rx_copybreak, int, 0); | 75 | module_param (rx_copybreak, int, 0); |
74 | MODULE_PARM_DESC (rx_copybreak, "de2104x Breakpoint at which Rx packets are copied"); | 76 | MODULE_PARM_DESC (rx_copybreak, "de2104x Breakpoint at which Rx packets are copied"); |
75 | 77 | ||
76 | #define PFX DRV_NAME ": " | ||
77 | |||
78 | #define DE_DEF_MSG_ENABLE (NETIF_MSG_DRV | \ | 78 | #define DE_DEF_MSG_ENABLE (NETIF_MSG_DRV | \ |
79 | NETIF_MSG_PROBE | \ | 79 | NETIF_MSG_PROBE | \ |
80 | NETIF_MSG_LINK | \ | 80 | NETIF_MSG_LINK | \ |
@@ -377,18 +377,16 @@ static u16 t21041_csr15[] = { 0x0008, 0x0006, 0x000E, 0x0008, 0x0008, }; | |||
377 | static void de_rx_err_acct (struct de_private *de, unsigned rx_tail, | 377 | static void de_rx_err_acct (struct de_private *de, unsigned rx_tail, |
378 | u32 status, u32 len) | 378 | u32 status, u32 len) |
379 | { | 379 | { |
380 | if (netif_msg_rx_err (de)) | 380 | netif_dbg(de, rx_err, de->dev, |
381 | printk (KERN_DEBUG | 381 | "rx err, slot %d status 0x%x len %d\n", |
382 | "%s: rx err, slot %d status 0x%x len %d\n", | 382 | rx_tail, status, len); |
383 | de->dev->name, rx_tail, status, len); | ||
384 | 383 | ||
385 | if ((status & 0x38000300) != 0x0300) { | 384 | if ((status & 0x38000300) != 0x0300) { |
386 | /* Ingore earlier buffers. */ | 385 | /* Ingore earlier buffers. */ |
387 | if ((status & 0xffff) != 0x7fff) { | 386 | if ((status & 0xffff) != 0x7fff) { |
388 | if (netif_msg_rx_err(de)) | 387 | netif_warn(de, rx_err, de->dev, |
389 | dev_warn(&de->dev->dev, | 388 | "Oversized Ethernet frame spanned multiple buffers, status %08x!\n", |
390 | "Oversized Ethernet frame spanned multiple buffers, status %08x!\n", | 389 | status); |
391 | status); | ||
392 | de->net_stats.rx_length_errors++; | 390 | de->net_stats.rx_length_errors++; |
393 | } | 391 | } |
394 | } else if (status & RxError) { | 392 | } else if (status & RxError) { |
@@ -435,10 +433,9 @@ static void de_rx (struct de_private *de) | |||
435 | 433 | ||
436 | copying_skb = (len <= rx_copybreak); | 434 | copying_skb = (len <= rx_copybreak); |
437 | 435 | ||
438 | if (unlikely(netif_msg_rx_status(de))) | 436 | netif_dbg(de, rx_status, de->dev, |
439 | printk(KERN_DEBUG "%s: rx slot %d status 0x%x len %d copying? %d\n", | 437 | "rx slot %d status 0x%x len %d copying? %d\n", |
440 | de->dev->name, rx_tail, status, len, | 438 | rx_tail, status, len, copying_skb); |
441 | copying_skb); | ||
442 | 439 | ||
443 | buflen = copying_skb ? (len + RX_OFFSET) : de->rx_buf_sz; | 440 | buflen = copying_skb ? (len + RX_OFFSET) : de->rx_buf_sz; |
444 | copy_skb = dev_alloc_skb (buflen); | 441 | copy_skb = dev_alloc_skb (buflen); |
@@ -491,7 +488,7 @@ rx_next: | |||
491 | } | 488 | } |
492 | 489 | ||
493 | if (!rx_work) | 490 | if (!rx_work) |
494 | dev_warn(&de->dev->dev, "rx work limit reached\n"); | 491 | netdev_warn(de->dev, "rx work limit reached\n"); |
495 | 492 | ||
496 | de->rx_tail = rx_tail; | 493 | de->rx_tail = rx_tail; |
497 | } | 494 | } |
@@ -506,10 +503,9 @@ static irqreturn_t de_interrupt (int irq, void *dev_instance) | |||
506 | if ((!(status & (IntrOK|IntrErr))) || (status == 0xFFFF)) | 503 | if ((!(status & (IntrOK|IntrErr))) || (status == 0xFFFF)) |
507 | return IRQ_NONE; | 504 | return IRQ_NONE; |
508 | 505 | ||
509 | if (netif_msg_intr(de)) | 506 | netif_dbg(de, intr, dev, "intr, status %08x mode %08x desc %u/%u/%u\n", |
510 | printk(KERN_DEBUG "%s: intr, status %08x mode %08x desc %u/%u/%u\n", | 507 | status, dr32(MacMode), |
511 | dev->name, status, dr32(MacMode), | 508 | de->rx_tail, de->tx_head, de->tx_tail); |
512 | de->rx_tail, de->tx_head, de->tx_tail); | ||
513 | 509 | ||
514 | dw32(MacStatus, status); | 510 | dw32(MacStatus, status); |
515 | 511 | ||
@@ -534,9 +530,9 @@ static irqreturn_t de_interrupt (int irq, void *dev_instance) | |||
534 | 530 | ||
535 | pci_read_config_word(de->pdev, PCI_STATUS, &pci_status); | 531 | pci_read_config_word(de->pdev, PCI_STATUS, &pci_status); |
536 | pci_write_config_word(de->pdev, PCI_STATUS, pci_status); | 532 | pci_write_config_word(de->pdev, PCI_STATUS, pci_status); |
537 | dev_err(&de->dev->dev, | 533 | netdev_err(de->dev, |
538 | "PCI bus error, status=%08x, PCI status=%04x\n", | 534 | "PCI bus error, status=%08x, PCI status=%04x\n", |
539 | status, pci_status); | 535 | status, pci_status); |
540 | } | 536 | } |
541 | 537 | ||
542 | return IRQ_HANDLED; | 538 | return IRQ_HANDLED; |
@@ -572,9 +568,9 @@ static void de_tx (struct de_private *de) | |||
572 | 568 | ||
573 | if (status & LastFrag) { | 569 | if (status & LastFrag) { |
574 | if (status & TxError) { | 570 | if (status & TxError) { |
575 | if (netif_msg_tx_err(de)) | 571 | netif_dbg(de, tx_err, de->dev, |
576 | printk(KERN_DEBUG "%s: tx err, status 0x%x\n", | 572 | "tx err, status 0x%x\n", |
577 | de->dev->name, status); | 573 | status); |
578 | de->net_stats.tx_errors++; | 574 | de->net_stats.tx_errors++; |
579 | if (status & TxOWC) | 575 | if (status & TxOWC) |
580 | de->net_stats.tx_window_errors++; | 576 | de->net_stats.tx_window_errors++; |
@@ -587,9 +583,8 @@ static void de_tx (struct de_private *de) | |||
587 | } else { | 583 | } else { |
588 | de->net_stats.tx_packets++; | 584 | de->net_stats.tx_packets++; |
589 | de->net_stats.tx_bytes += skb->len; | 585 | de->net_stats.tx_bytes += skb->len; |
590 | if (netif_msg_tx_done(de)) | 586 | netif_dbg(de, tx_done, de->dev, |
591 | printk(KERN_DEBUG "%s: tx done, slot %d\n", | 587 | "tx done, slot %d\n", tx_tail); |
592 | de->dev->name, tx_tail); | ||
593 | } | 588 | } |
594 | dev_kfree_skb_irq(skb); | 589 | dev_kfree_skb_irq(skb); |
595 | } | 590 | } |
@@ -646,9 +641,8 @@ static netdev_tx_t de_start_xmit (struct sk_buff *skb, | |||
646 | wmb(); | 641 | wmb(); |
647 | 642 | ||
648 | de->tx_head = NEXT_TX(entry); | 643 | de->tx_head = NEXT_TX(entry); |
649 | if (netif_msg_tx_queued(de)) | 644 | netif_dbg(de, tx_queued, dev, "tx queued, slot %d, skblen %d\n", |
650 | printk(KERN_DEBUG "%s: tx queued, slot %d, skblen %d\n", | 645 | entry, skb->len); |
651 | dev->name, entry, skb->len); | ||
652 | 646 | ||
653 | if (tx_free == 0) | 647 | if (tx_free == 0) |
654 | netif_stop_queue(dev); | 648 | netif_stop_queue(dev); |
@@ -873,7 +867,7 @@ static void de_stop_rxtx (struct de_private *de) | |||
873 | udelay(100); | 867 | udelay(100); |
874 | } | 868 | } |
875 | 869 | ||
876 | dev_warn(&de->dev->dev, "timeout expired stopping DMA\n"); | 870 | netdev_warn(de->dev, "timeout expired, stopping DMA\n"); |
877 | } | 871 | } |
878 | 872 | ||
879 | static inline void de_start_rxtx (struct de_private *de) | 873 | static inline void de_start_rxtx (struct de_private *de) |
@@ -907,9 +901,8 @@ static void de_link_up(struct de_private *de) | |||
907 | { | 901 | { |
908 | if (!netif_carrier_ok(de->dev)) { | 902 | if (!netif_carrier_ok(de->dev)) { |
909 | netif_carrier_on(de->dev); | 903 | netif_carrier_on(de->dev); |
910 | if (netif_msg_link(de)) | 904 | netif_info(de, link, de->dev, "link up, media %s\n", |
911 | dev_info(&de->dev->dev, "link up, media %s\n", | 905 | media_name[de->media_type]); |
912 | media_name[de->media_type]); | ||
913 | } | 906 | } |
914 | } | 907 | } |
915 | 908 | ||
@@ -917,8 +910,7 @@ static void de_link_down(struct de_private *de) | |||
917 | { | 910 | { |
918 | if (netif_carrier_ok(de->dev)) { | 911 | if (netif_carrier_ok(de->dev)) { |
919 | netif_carrier_off(de->dev); | 912 | netif_carrier_off(de->dev); |
920 | if (netif_msg_link(de)) | 913 | netif_info(de, link, de->dev, "link down\n"); |
921 | dev_info(&de->dev->dev, "link down\n"); | ||
922 | } | 914 | } |
923 | } | 915 | } |
924 | 916 | ||
@@ -928,8 +920,7 @@ static void de_set_media (struct de_private *de) | |||
928 | u32 macmode = dr32(MacMode); | 920 | u32 macmode = dr32(MacMode); |
929 | 921 | ||
930 | if (de_is_running(de)) | 922 | if (de_is_running(de)) |
931 | dev_warn(&de->dev->dev, | 923 | netdev_warn(de->dev, "chip is running while changing media!\n"); |
932 | "chip is running while changing media!\n"); | ||
933 | 924 | ||
934 | if (de->de21040) | 925 | if (de->de21040) |
935 | dw32(CSR11, FULL_DUPLEX_MAGIC); | 926 | dw32(CSR11, FULL_DUPLEX_MAGIC); |
@@ -948,22 +939,18 @@ static void de_set_media (struct de_private *de) | |||
948 | else | 939 | else |
949 | macmode &= ~FullDuplex; | 940 | macmode &= ~FullDuplex; |
950 | 941 | ||
951 | if (netif_msg_link(de)) { | 942 | netif_info(de, link, de->dev, "set link %s\n", media_name[media]); |
952 | dev_info(&de->dev->dev, "set link %s\n", media_name[media]); | 943 | netif_info(de, hw, de->dev, "mode 0x%x, sia 0x%x,0x%x,0x%x,0x%x\n", |
953 | dev_info(&de->dev->dev, "mode 0x%x, sia 0x%x,0x%x,0x%x,0x%x\n", | 944 | dr32(MacMode), dr32(SIAStatus), |
954 | dr32(MacMode), dr32(SIAStatus), | 945 | dr32(CSR13), dr32(CSR14), dr32(CSR15)); |
955 | dr32(CSR13), dr32(CSR14), dr32(CSR15)); | 946 | netif_info(de, hw, de->dev, "set mode 0x%x, set sia 0x%x,0x%x,0x%x\n", |
956 | 947 | macmode, de->media[media].csr13, | |
957 | dev_info(&de->dev->dev, | 948 | de->media[media].csr14, de->media[media].csr15); |
958 | "set mode 0x%x, set sia 0x%x,0x%x,0x%x\n", | ||
959 | macmode, de->media[media].csr13, | ||
960 | de->media[media].csr14, de->media[media].csr15); | ||
961 | } | ||
962 | if (macmode != dr32(MacMode)) | 949 | if (macmode != dr32(MacMode)) |
963 | dw32(MacMode, macmode); | 950 | dw32(MacMode, macmode); |
964 | } | 951 | } |
965 | 952 | ||
966 | static void de_next_media (struct de_private *de, u32 *media, | 953 | static void de_next_media (struct de_private *de, const u32 *media, |
967 | unsigned int n_media) | 954 | unsigned int n_media) |
968 | { | 955 | { |
969 | unsigned int i; | 956 | unsigned int i; |
@@ -995,9 +982,8 @@ static void de21040_media_timer (unsigned long data) | |||
995 | if (!netif_carrier_ok(dev)) | 982 | if (!netif_carrier_ok(dev)) |
996 | de_link_up(de); | 983 | de_link_up(de); |
997 | else | 984 | else |
998 | if (netif_msg_timer(de)) | 985 | netif_info(de, timer, dev, "%s link ok, status %x\n", |
999 | dev_info(&dev->dev, "%s link ok, status %x\n", | 986 | media_name[de->media_type], status); |
1000 | media_name[de->media_type], status); | ||
1001 | return; | 987 | return; |
1002 | } | 988 | } |
1003 | 989 | ||
@@ -1007,10 +993,10 @@ static void de21040_media_timer (unsigned long data) | |||
1007 | return; | 993 | return; |
1008 | 994 | ||
1009 | if (de->media_type == DE_MEDIA_AUI) { | 995 | if (de->media_type == DE_MEDIA_AUI) { |
1010 | u32 next_state = DE_MEDIA_TP; | 996 | static const u32 next_state = DE_MEDIA_TP; |
1011 | de_next_media(de, &next_state, 1); | 997 | de_next_media(de, &next_state, 1); |
1012 | } else { | 998 | } else { |
1013 | u32 next_state = DE_MEDIA_AUI; | 999 | static const u32 next_state = DE_MEDIA_AUI; |
1014 | de_next_media(de, &next_state, 1); | 1000 | de_next_media(de, &next_state, 1); |
1015 | } | 1001 | } |
1016 | 1002 | ||
@@ -1024,9 +1010,8 @@ no_link_yet: | |||
1024 | de->media_timer.expires = jiffies + DE_TIMER_NO_LINK; | 1010 | de->media_timer.expires = jiffies + DE_TIMER_NO_LINK; |
1025 | add_timer(&de->media_timer); | 1011 | add_timer(&de->media_timer); |
1026 | 1012 | ||
1027 | if (netif_msg_timer(de)) | 1013 | netif_info(de, timer, dev, "no link, trying media %s, status %x\n", |
1028 | dev_info(&dev->dev, "no link, trying media %s, status %x\n", | 1014 | media_name[de->media_type], status); |
1029 | media_name[de->media_type], status); | ||
1030 | } | 1015 | } |
1031 | 1016 | ||
1032 | static unsigned int de_ok_to_advertise (struct de_private *de, u32 new_media) | 1017 | static unsigned int de_ok_to_advertise (struct de_private *de, u32 new_media) |
@@ -1084,11 +1069,10 @@ static void de21041_media_timer (unsigned long data) | |||
1084 | if (!netif_carrier_ok(dev)) | 1069 | if (!netif_carrier_ok(dev)) |
1085 | de_link_up(de); | 1070 | de_link_up(de); |
1086 | else | 1071 | else |
1087 | if (netif_msg_timer(de)) | 1072 | netif_info(de, timer, dev, |
1088 | dev_info(&dev->dev, | 1073 | "%s link ok, mode %x status %x\n", |
1089 | "%s link ok, mode %x status %x\n", | 1074 | media_name[de->media_type], |
1090 | media_name[de->media_type], | 1075 | dr32(MacMode), status); |
1091 | dr32(MacMode), status); | ||
1092 | return; | 1076 | return; |
1093 | } | 1077 | } |
1094 | 1078 | ||
@@ -1135,13 +1119,19 @@ static void de21041_media_timer (unsigned long data) | |||
1135 | * simply resets the PHY and reloads the current media settings. | 1119 | * simply resets the PHY and reloads the current media settings. |
1136 | */ | 1120 | */ |
1137 | if (de->media_type == DE_MEDIA_AUI) { | 1121 | if (de->media_type == DE_MEDIA_AUI) { |
1138 | u32 next_states[] = { DE_MEDIA_BNC, DE_MEDIA_TP_AUTO }; | 1122 | static const u32 next_states[] = { |
1123 | DE_MEDIA_BNC, DE_MEDIA_TP_AUTO | ||
1124 | }; | ||
1139 | de_next_media(de, next_states, ARRAY_SIZE(next_states)); | 1125 | de_next_media(de, next_states, ARRAY_SIZE(next_states)); |
1140 | } else if (de->media_type == DE_MEDIA_BNC) { | 1126 | } else if (de->media_type == DE_MEDIA_BNC) { |
1141 | u32 next_states[] = { DE_MEDIA_TP_AUTO, DE_MEDIA_AUI }; | 1127 | static const u32 next_states[] = { |
1128 | DE_MEDIA_TP_AUTO, DE_MEDIA_AUI | ||
1129 | }; | ||
1142 | de_next_media(de, next_states, ARRAY_SIZE(next_states)); | 1130 | de_next_media(de, next_states, ARRAY_SIZE(next_states)); |
1143 | } else { | 1131 | } else { |
1144 | u32 next_states[] = { DE_MEDIA_AUI, DE_MEDIA_BNC, DE_MEDIA_TP_AUTO }; | 1132 | static const u32 next_states[] = { |
1133 | DE_MEDIA_AUI, DE_MEDIA_BNC, DE_MEDIA_TP_AUTO | ||
1134 | }; | ||
1145 | de_next_media(de, next_states, ARRAY_SIZE(next_states)); | 1135 | de_next_media(de, next_states, ARRAY_SIZE(next_states)); |
1146 | } | 1136 | } |
1147 | 1137 | ||
@@ -1156,9 +1146,8 @@ no_link_yet: | |||
1156 | de->media_timer.expires = jiffies + DE_TIMER_NO_LINK; | 1146 | de->media_timer.expires = jiffies + DE_TIMER_NO_LINK; |
1157 | add_timer(&de->media_timer); | 1147 | add_timer(&de->media_timer); |
1158 | 1148 | ||
1159 | if (netif_msg_timer(de)) | 1149 | netif_info(de, timer, dev, "no link, trying media %s, status %x\n", |
1160 | dev_info(&dev->dev, "no link, trying media %s, status %x\n", | 1150 | media_name[de->media_type], status); |
1161 | media_name[de->media_type], status); | ||
1162 | } | 1151 | } |
1163 | 1152 | ||
1164 | static void de_media_interrupt (struct de_private *de, u32 status) | 1153 | static void de_media_interrupt (struct de_private *de, u32 status) |
@@ -1394,14 +1383,13 @@ static int de_open (struct net_device *dev) | |||
1394 | struct de_private *de = netdev_priv(dev); | 1383 | struct de_private *de = netdev_priv(dev); |
1395 | int rc; | 1384 | int rc; |
1396 | 1385 | ||
1397 | if (netif_msg_ifup(de)) | 1386 | netif_dbg(de, ifup, dev, "enabling interface\n"); |
1398 | printk(KERN_DEBUG "%s: enabling interface\n", dev->name); | ||
1399 | 1387 | ||
1400 | de->rx_buf_sz = (dev->mtu <= 1500 ? PKT_BUF_SZ : dev->mtu + 32); | 1388 | de->rx_buf_sz = (dev->mtu <= 1500 ? PKT_BUF_SZ : dev->mtu + 32); |
1401 | 1389 | ||
1402 | rc = de_alloc_rings(de); | 1390 | rc = de_alloc_rings(de); |
1403 | if (rc) { | 1391 | if (rc) { |
1404 | dev_err(&dev->dev, "ring allocation failure, err=%d\n", rc); | 1392 | netdev_err(dev, "ring allocation failure, err=%d\n", rc); |
1405 | return rc; | 1393 | return rc; |
1406 | } | 1394 | } |
1407 | 1395 | ||
@@ -1409,14 +1397,14 @@ static int de_open (struct net_device *dev) | |||
1409 | 1397 | ||
1410 | rc = request_irq(dev->irq, de_interrupt, IRQF_SHARED, dev->name, dev); | 1398 | rc = request_irq(dev->irq, de_interrupt, IRQF_SHARED, dev->name, dev); |
1411 | if (rc) { | 1399 | if (rc) { |
1412 | dev_err(&dev->dev, "IRQ %d request failure, err=%d\n", | 1400 | netdev_err(dev, "IRQ %d request failure, err=%d\n", |
1413 | dev->irq, rc); | 1401 | dev->irq, rc); |
1414 | goto err_out_free; | 1402 | goto err_out_free; |
1415 | } | 1403 | } |
1416 | 1404 | ||
1417 | rc = de_init_hw(de); | 1405 | rc = de_init_hw(de); |
1418 | if (rc) { | 1406 | if (rc) { |
1419 | dev_err(&dev->dev, "h/w init failure, err=%d\n", rc); | 1407 | netdev_err(dev, "h/w init failure, err=%d\n", rc); |
1420 | goto err_out_free_irq; | 1408 | goto err_out_free_irq; |
1421 | } | 1409 | } |
1422 | 1410 | ||
@@ -1437,8 +1425,7 @@ static int de_close (struct net_device *dev) | |||
1437 | struct de_private *de = netdev_priv(dev); | 1425 | struct de_private *de = netdev_priv(dev); |
1438 | unsigned long flags; | 1426 | unsigned long flags; |
1439 | 1427 | ||
1440 | if (netif_msg_ifdown(de)) | 1428 | netif_dbg(de, ifdown, dev, "disabling interface\n"); |
1441 | printk(KERN_DEBUG "%s: disabling interface\n", dev->name); | ||
1442 | 1429 | ||
1443 | del_timer_sync(&de->media_timer); | 1430 | del_timer_sync(&de->media_timer); |
1444 | 1431 | ||
@@ -1459,9 +1446,9 @@ static void de_tx_timeout (struct net_device *dev) | |||
1459 | { | 1446 | { |
1460 | struct de_private *de = netdev_priv(dev); | 1447 | struct de_private *de = netdev_priv(dev); |
1461 | 1448 | ||
1462 | printk(KERN_DEBUG "%s: NIC status %08x mode %08x sia %08x desc %u/%u/%u\n", | 1449 | netdev_dbg(dev, "NIC status %08x mode %08x sia %08x desc %u/%u/%u\n", |
1463 | dev->name, dr32(MacStatus), dr32(MacMode), dr32(SIAStatus), | 1450 | dr32(MacStatus), dr32(MacMode), dr32(SIAStatus), |
1464 | de->rx_tail, de->tx_head, de->tx_tail); | 1451 | de->rx_tail, de->tx_head, de->tx_tail); |
1465 | 1452 | ||
1466 | del_timer_sync(&de->media_timer); | 1453 | del_timer_sync(&de->media_timer); |
1467 | 1454 | ||
@@ -1511,18 +1498,17 @@ static int __de_get_settings(struct de_private *de, struct ethtool_cmd *ecmd) | |||
1511 | switch (de->media_type) { | 1498 | switch (de->media_type) { |
1512 | case DE_MEDIA_AUI: | 1499 | case DE_MEDIA_AUI: |
1513 | ecmd->port = PORT_AUI; | 1500 | ecmd->port = PORT_AUI; |
1514 | ecmd->speed = 5; | ||
1515 | break; | 1501 | break; |
1516 | case DE_MEDIA_BNC: | 1502 | case DE_MEDIA_BNC: |
1517 | ecmd->port = PORT_BNC; | 1503 | ecmd->port = PORT_BNC; |
1518 | ecmd->speed = 2; | ||
1519 | break; | 1504 | break; |
1520 | default: | 1505 | default: |
1521 | ecmd->port = PORT_TP; | 1506 | ecmd->port = PORT_TP; |
1522 | ecmd->speed = SPEED_10; | ||
1523 | break; | 1507 | break; |
1524 | } | 1508 | } |
1525 | 1509 | ||
1510 | ethtool_cmd_speed_set(ecmd, 10); | ||
1511 | |||
1526 | if (dr32(MacMode) & FullDuplex) | 1512 | if (dr32(MacMode) & FullDuplex) |
1527 | ecmd->duplex = DUPLEX_FULL; | 1513 | ecmd->duplex = DUPLEX_FULL; |
1528 | else | 1514 | else |
@@ -1543,9 +1529,7 @@ static int __de_set_settings(struct de_private *de, struct ethtool_cmd *ecmd) | |||
1543 | u32 new_media; | 1529 | u32 new_media; |
1544 | unsigned int media_lock; | 1530 | unsigned int media_lock; |
1545 | 1531 | ||
1546 | if (ecmd->speed != SPEED_10 && ecmd->speed != 5 && ecmd->speed != 2) | 1532 | if (ethtool_cmd_speed(ecmd) != 10) |
1547 | return -EINVAL; | ||
1548 | if (de->de21040 && ecmd->speed == 2) | ||
1549 | return -EINVAL; | 1533 | return -EINVAL; |
1550 | if (ecmd->duplex != DUPLEX_HALF && ecmd->duplex != DUPLEX_FULL) | 1534 | if (ecmd->duplex != DUPLEX_HALF && ecmd->duplex != DUPLEX_FULL) |
1551 | return -EINVAL; | 1535 | return -EINVAL; |
@@ -1689,9 +1673,8 @@ static int de_nway_reset(struct net_device *dev) | |||
1689 | 1673 | ||
1690 | status = dr32(SIAStatus); | 1674 | status = dr32(SIAStatus); |
1691 | dw32(SIAStatus, (status & ~NWayState) | NWayRestart); | 1675 | dw32(SIAStatus, (status & ~NWayState) | NWayRestart); |
1692 | if (netif_msg_link(de)) | 1676 | netif_info(de, link, dev, "link nway restart, status %x,%x\n", |
1693 | dev_info(&de->dev->dev, "link nway restart, status %x,%x\n", | 1677 | status, dr32(SIAStatus)); |
1694 | status, dr32(SIAStatus)); | ||
1695 | return 0; | 1678 | return 0; |
1696 | } | 1679 | } |
1697 | 1680 | ||
@@ -1736,7 +1719,8 @@ static void __devinit de21040_get_mac_address (struct de_private *de) | |||
1736 | de->dev->dev_addr[i] = value; | 1719 | de->dev->dev_addr[i] = value; |
1737 | udelay(1); | 1720 | udelay(1); |
1738 | if (boguscnt <= 0) | 1721 | if (boguscnt <= 0) |
1739 | pr_warning(PFX "timeout reading 21040 MAC address byte %u\n", i); | 1722 | pr_warn("timeout reading 21040 MAC address byte %u\n", |
1723 | i); | ||
1740 | } | 1724 | } |
1741 | } | 1725 | } |
1742 | 1726 | ||
@@ -1922,8 +1906,10 @@ static void __devinit de21041_get_srom_info (struct de_private *de) | |||
1922 | de->media[idx].csr14, | 1906 | de->media[idx].csr14, |
1923 | de->media[idx].csr15); | 1907 | de->media[idx].csr15); |
1924 | 1908 | ||
1925 | } else if (netif_msg_probe(de)) | 1909 | } else { |
1926 | pr_cont("\n"); | 1910 | if (netif_msg_probe(de)) |
1911 | pr_cont("\n"); | ||
1912 | } | ||
1927 | 1913 | ||
1928 | if (bufp > ((void *)&ee_data[DE_EEPROM_SIZE - 3])) | 1914 | if (bufp > ((void *)&ee_data[DE_EEPROM_SIZE - 3])) |
1929 | break; | 1915 | break; |
@@ -1992,7 +1978,7 @@ static int __devinit de_init_one (struct pci_dev *pdev, | |||
1992 | 1978 | ||
1993 | #ifndef MODULE | 1979 | #ifndef MODULE |
1994 | if (board_idx == 0) | 1980 | if (board_idx == 0) |
1995 | printk("%s", version); | 1981 | pr_info("%s\n", version); |
1996 | #endif | 1982 | #endif |
1997 | 1983 | ||
1998 | /* allocate a new ethernet device structure, and fill in defaults */ | 1984 | /* allocate a new ethernet device structure, and fill in defaults */ |
@@ -2020,7 +2006,6 @@ static int __devinit de_init_one (struct pci_dev *pdev, | |||
2020 | de->media_timer.data = (unsigned long) de; | 2006 | de->media_timer.data = (unsigned long) de; |
2021 | 2007 | ||
2022 | netif_carrier_off(dev); | 2008 | netif_carrier_off(dev); |
2023 | netif_stop_queue(dev); | ||
2024 | 2009 | ||
2025 | /* wake up device, assign resources */ | 2010 | /* wake up device, assign resources */ |
2026 | rc = pci_enable_device(pdev); | 2011 | rc = pci_enable_device(pdev); |
@@ -2035,7 +2020,7 @@ static int __devinit de_init_one (struct pci_dev *pdev, | |||
2035 | /* check for invalid IRQ value */ | 2020 | /* check for invalid IRQ value */ |
2036 | if (pdev->irq < 2) { | 2021 | if (pdev->irq < 2) { |
2037 | rc = -EIO; | 2022 | rc = -EIO; |
2038 | pr_err(PFX "invalid irq (%d) for pci dev %s\n", | 2023 | pr_err("invalid irq (%d) for pci dev %s\n", |
2039 | pdev->irq, pci_name(pdev)); | 2024 | pdev->irq, pci_name(pdev)); |
2040 | goto err_out_res; | 2025 | goto err_out_res; |
2041 | } | 2026 | } |
@@ -2046,12 +2031,12 @@ static int __devinit de_init_one (struct pci_dev *pdev, | |||
2046 | pciaddr = pci_resource_start(pdev, 1); | 2031 | pciaddr = pci_resource_start(pdev, 1); |
2047 | if (!pciaddr) { | 2032 | if (!pciaddr) { |
2048 | rc = -EIO; | 2033 | rc = -EIO; |
2049 | pr_err(PFX "no MMIO resource for pci dev %s\n", pci_name(pdev)); | 2034 | pr_err("no MMIO resource for pci dev %s\n", pci_name(pdev)); |
2050 | goto err_out_res; | 2035 | goto err_out_res; |
2051 | } | 2036 | } |
2052 | if (pci_resource_len(pdev, 1) < DE_REGS_SIZE) { | 2037 | if (pci_resource_len(pdev, 1) < DE_REGS_SIZE) { |
2053 | rc = -EIO; | 2038 | rc = -EIO; |
2054 | pr_err(PFX "MMIO resource (%llx) too small on pci dev %s\n", | 2039 | pr_err("MMIO resource (%llx) too small on pci dev %s\n", |
2055 | (unsigned long long)pci_resource_len(pdev, 1), | 2040 | (unsigned long long)pci_resource_len(pdev, 1), |
2056 | pci_name(pdev)); | 2041 | pci_name(pdev)); |
2057 | goto err_out_res; | 2042 | goto err_out_res; |
@@ -2061,7 +2046,7 @@ static int __devinit de_init_one (struct pci_dev *pdev, | |||
2061 | regs = ioremap_nocache(pciaddr, DE_REGS_SIZE); | 2046 | regs = ioremap_nocache(pciaddr, DE_REGS_SIZE); |
2062 | if (!regs) { | 2047 | if (!regs) { |
2063 | rc = -EIO; | 2048 | rc = -EIO; |
2064 | pr_err(PFX "Cannot map PCI MMIO (%llx@%lx) on pci dev %s\n", | 2049 | pr_err("Cannot map PCI MMIO (%llx@%lx) on pci dev %s\n", |
2065 | (unsigned long long)pci_resource_len(pdev, 1), | 2050 | (unsigned long long)pci_resource_len(pdev, 1), |
2066 | pciaddr, pci_name(pdev)); | 2051 | pciaddr, pci_name(pdev)); |
2067 | goto err_out_res; | 2052 | goto err_out_res; |
@@ -2074,7 +2059,7 @@ static int __devinit de_init_one (struct pci_dev *pdev, | |||
2074 | /* make sure hardware is not running */ | 2059 | /* make sure hardware is not running */ |
2075 | rc = de_reset_mac(de); | 2060 | rc = de_reset_mac(de); |
2076 | if (rc) { | 2061 | if (rc) { |
2077 | pr_err(PFX "Cannot reset MAC, pci dev %s\n", pci_name(pdev)); | 2062 | pr_err("Cannot reset MAC, pci dev %s\n", pci_name(pdev)); |
2078 | goto err_out_iomap; | 2063 | goto err_out_iomap; |
2079 | } | 2064 | } |
2080 | 2065 | ||
@@ -2094,11 +2079,11 @@ static int __devinit de_init_one (struct pci_dev *pdev, | |||
2094 | goto err_out_iomap; | 2079 | goto err_out_iomap; |
2095 | 2080 | ||
2096 | /* print info about board and interface just registered */ | 2081 | /* print info about board and interface just registered */ |
2097 | dev_info(&dev->dev, "%s at 0x%lx, %pM, IRQ %d\n", | 2082 | netdev_info(dev, "%s at 0x%lx, %pM, IRQ %d\n", |
2098 | de->de21040 ? "21040" : "21041", | 2083 | de->de21040 ? "21040" : "21041", |
2099 | dev->base_addr, | 2084 | dev->base_addr, |
2100 | dev->dev_addr, | 2085 | dev->dev_addr, |
2101 | dev->irq); | 2086 | dev->irq); |
2102 | 2087 | ||
2103 | pci_set_drvdata(pdev, dev); | 2088 | pci_set_drvdata(pdev, dev); |
2104 | 2089 | ||
@@ -2186,7 +2171,7 @@ static int de_resume (struct pci_dev *pdev) | |||
2186 | if (!netif_running(dev)) | 2171 | if (!netif_running(dev)) |
2187 | goto out_attach; | 2172 | goto out_attach; |
2188 | if ((retval = pci_enable_device(pdev))) { | 2173 | if ((retval = pci_enable_device(pdev))) { |
2189 | dev_err(&dev->dev, "pci_enable_device failed in resume\n"); | 2174 | netdev_err(dev, "pci_enable_device failed in resume\n"); |
2190 | goto out; | 2175 | goto out; |
2191 | } | 2176 | } |
2192 | pci_set_master(pdev); | 2177 | pci_set_master(pdev); |
@@ -2215,7 +2200,7 @@ static struct pci_driver de_driver = { | |||
2215 | static int __init de_init (void) | 2200 | static int __init de_init (void) |
2216 | { | 2201 | { |
2217 | #ifdef MODULE | 2202 | #ifdef MODULE |
2218 | printk("%s", version); | 2203 | pr_info("%s\n", version); |
2219 | #endif | 2204 | #endif |
2220 | return pci_register_driver(&de_driver); | 2205 | return pci_register_driver(&de_driver); |
2221 | } | 2206 | } |