aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pcmcia/3c574_cs.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-10-23 14:47:02 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-10-23 14:47:02 -0400
commit5f05647dd81c11a6a165ccc8f0c1370b16f3bcb0 (patch)
tree7851ef1c93aa1aba7ef327ca4b75fd35e6d10f29 /drivers/net/pcmcia/3c574_cs.c
parent02f36038c568111ad4fc433f6fa760ff5e38fab4 (diff)
parentec37a48d1d16c30b655ac5280209edf52a6775d4 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6: (1699 commits) bnx2/bnx2x: Unsupported Ethtool operations should return -EINVAL. vlan: Calling vlan_hwaccel_do_receive() is always valid. tproxy: use the interface primary IP address as a default value for --on-ip tproxy: added IPv6 support to the socket match cxgb3: function namespace cleanup tproxy: added IPv6 support to the TPROXY target tproxy: added IPv6 socket lookup function to nf_tproxy_core be2net: Changes to use only priority codes allowed by f/w tproxy: allow non-local binds of IPv6 sockets if IP_TRANSPARENT is enabled tproxy: added tproxy sockopt interface in the IPV6 layer tproxy: added udp6_lib_lookup function tproxy: added const specifiers to udp lookup functions tproxy: split off ipv6 defragmentation to a separate module l2tp: small cleanup nf_nat: restrict ICMP translation for embedded header can: mcp251x: fix generation of error frames can: mcp251x: fix endless loop in interrupt handler if CANINTF_MERRF is set can-raw: add msg_flags to distinguish local traffic 9p: client code cleanup rds: make local functions/variables static ... Fix up conflicts in net/core/dev.c, drivers/net/pcmcia/smc91c92_cs.c and drivers/net/wireless/ath/ath9k/debug.c as per David
Diffstat (limited to 'drivers/net/pcmcia/3c574_cs.c')
-rw-r--r--drivers/net/pcmcia/3c574_cs.c88
1 files changed, 36 insertions, 52 deletions
diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c
index ff824e11f0b6..2807a0fcadc4 100644
--- a/drivers/net/pcmcia/3c574_cs.c
+++ b/drivers/net/pcmcia/3c574_cs.c
@@ -69,6 +69,8 @@ earlier 3Com products.
69 69
70*/ 70*/
71 71
72#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
73
72#include <linux/module.h> 74#include <linux/module.h>
73#include <linux/kernel.h> 75#include <linux/kernel.h>
74#include <linux/init.h> 76#include <linux/init.h>
@@ -83,7 +85,6 @@ earlier 3Com products.
83#include <linux/skbuff.h> 85#include <linux/skbuff.h>
84#include <linux/if_arp.h> 86#include <linux/if_arp.h>
85#include <linux/ioport.h> 87#include <linux/ioport.h>
86#include <linux/ethtool.h>
87#include <linux/bitops.h> 88#include <linux/bitops.h>
88#include <linux/mii.h> 89#include <linux/mii.h>
89 90
@@ -237,7 +238,6 @@ static int el3_rx(struct net_device *dev, int worklimit);
237static int el3_close(struct net_device *dev); 238static int el3_close(struct net_device *dev);
238static void el3_tx_timeout(struct net_device *dev); 239static void el3_tx_timeout(struct net_device *dev);
239static int el3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); 240static int el3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
240static const struct ethtool_ops netdev_ethtool_ops;
241static void set_rx_mode(struct net_device *dev); 241static void set_rx_mode(struct net_device *dev);
242static void set_multicast_list(struct net_device *dev); 242static void set_multicast_list(struct net_device *dev);
243 243
@@ -283,7 +283,6 @@ static int tc574_probe(struct pcmcia_device *link)
283 link->config_index = 1; 283 link->config_index = 1;
284 284
285 dev->netdev_ops = &el3_netdev_ops; 285 dev->netdev_ops = &el3_netdev_ops;
286 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
287 dev->watchdog_timeo = TX_TIMEOUT; 286 dev->watchdog_timeo = TX_TIMEOUT;
288 287
289 return tc574_config(link); 288 return tc574_config(link);
@@ -359,8 +358,8 @@ static int tc574_config(struct pcmcia_device *link)
359 for (i = 0; i < 3; i++) 358 for (i = 0; i < 3; i++)
360 phys_addr[i] = htons(read_eeprom(ioaddr, i + 10)); 359 phys_addr[i] = htons(read_eeprom(ioaddr, i + 10));
361 if (phys_addr[0] == htons(0x6060)) { 360 if (phys_addr[0] == htons(0x6060)) {
362 printk(KERN_NOTICE "3c574_cs: IO port conflict at 0x%03lx" 361 pr_notice("IO port conflict at 0x%03lx-0x%03lx\n",
363 "-0x%03lx\n", dev->base_addr, dev->base_addr+15); 362 dev->base_addr, dev->base_addr+15);
364 goto failed; 363 goto failed;
365 } 364 }
366 } 365 }
@@ -374,7 +373,7 @@ static int tc574_config(struct pcmcia_device *link)
374 outw(2<<11, ioaddr + RunnerRdCtrl); 373 outw(2<<11, ioaddr + RunnerRdCtrl);
375 mcr = inb(ioaddr + 2); 374 mcr = inb(ioaddr + 2);
376 outw(0<<11, ioaddr + RunnerRdCtrl); 375 outw(0<<11, ioaddr + RunnerRdCtrl);
377 printk(KERN_INFO " ASIC rev %d,", mcr>>3); 376 pr_info(" ASIC rev %d,", mcr>>3);
378 EL3WINDOW(3); 377 EL3WINDOW(3);
379 config = inl(ioaddr + Wn3_Config); 378 config = inl(ioaddr + Wn3_Config);
380 lp->default_media = (config & Xcvr) >> Xcvr_shift; 379 lp->default_media = (config & Xcvr) >> Xcvr_shift;
@@ -411,7 +410,7 @@ static int tc574_config(struct pcmcia_device *link)
411 } 410 }
412 } 411 }
413 if (phy > 32) { 412 if (phy > 32) {
414 printk(KERN_NOTICE " No MII transceivers found!\n"); 413 pr_notice(" No MII transceivers found!\n");
415 goto failed; 414 goto failed;
416 } 415 }
417 i = mdio_read(ioaddr, lp->phys, 16) | 0x40; 416 i = mdio_read(ioaddr, lp->phys, 16) | 0x40;
@@ -427,18 +426,16 @@ static int tc574_config(struct pcmcia_device *link)
427 SET_NETDEV_DEV(dev, &link->dev); 426 SET_NETDEV_DEV(dev, &link->dev);
428 427
429 if (register_netdev(dev) != 0) { 428 if (register_netdev(dev) != 0) {
430 printk(KERN_NOTICE "3c574_cs: register_netdev() failed\n"); 429 pr_notice("register_netdev() failed\n");
431 goto failed; 430 goto failed;
432 } 431 }
433 432
434 printk(KERN_INFO "%s: %s at io %#3lx, irq %d, " 433 netdev_info(dev, "%s at io %#3lx, irq %d, hw_addr %pM\n",
435 "hw_addr %pM.\n", 434 cardname, dev->base_addr, dev->irq, dev->dev_addr);
436 dev->name, cardname, dev->base_addr, dev->irq, 435 netdev_info(dev, " %dK FIFO split %s Rx:Tx, %sMII interface.\n",
437 dev->dev_addr); 436 8 << config & Ram_size,
438 printk(" %dK FIFO split %s Rx:Tx, %sMII interface.\n", 437 ram_split[(config & Ram_split) >> Ram_split_shift],
439 8 << config & Ram_size, 438 config & Autoselect ? "autoselect " : "");
440 ram_split[(config & Ram_split) >> Ram_split_shift],
441 config & Autoselect ? "autoselect " : "");
442 439
443 return 0; 440 return 0;
444 441
@@ -479,14 +476,14 @@ static void dump_status(struct net_device *dev)
479{ 476{
480 unsigned int ioaddr = dev->base_addr; 477 unsigned int ioaddr = dev->base_addr;
481 EL3WINDOW(1); 478 EL3WINDOW(1);
482 printk(KERN_INFO " irq status %04x, rx status %04x, tx status " 479 netdev_info(dev, " irq status %04x, rx status %04x, tx status %02x, tx free %04x\n",
483 "%02x, tx free %04x\n", inw(ioaddr+EL3_STATUS), 480 inw(ioaddr+EL3_STATUS),
484 inw(ioaddr+RxStatus), inb(ioaddr+TxStatus), 481 inw(ioaddr+RxStatus), inb(ioaddr+TxStatus),
485 inw(ioaddr+TxFree)); 482 inw(ioaddr+TxFree));
486 EL3WINDOW(4); 483 EL3WINDOW(4);
487 printk(KERN_INFO " diagnostics: fifo %04x net %04x ethernet %04x" 484 netdev_info(dev, " diagnostics: fifo %04x net %04x ethernet %04x media %04x\n",
488 " media %04x\n", inw(ioaddr+0x04), inw(ioaddr+0x06), 485 inw(ioaddr+0x04), inw(ioaddr+0x06),
489 inw(ioaddr+0x08), inw(ioaddr+0x0a)); 486 inw(ioaddr+0x08), inw(ioaddr+0x0a));
490 EL3WINDOW(1); 487 EL3WINDOW(1);
491} 488}
492 489
@@ -500,7 +497,7 @@ static void tc574_wait_for_completion(struct net_device *dev, int cmd)
500 while (--i > 0) 497 while (--i > 0)
501 if (!(inw(dev->base_addr + EL3_STATUS) & 0x1000)) break; 498 if (!(inw(dev->base_addr + EL3_STATUS) & 0x1000)) break;
502 if (i == 0) 499 if (i == 0)
503 printk(KERN_NOTICE "%s: command 0x%04x did not complete!\n", dev->name, cmd); 500 netdev_notice(dev, "command 0x%04x did not complete!\n", cmd);
504} 501}
505 502
506/* Read a word from the EEPROM using the regular EEPROM access register. 503/* Read a word from the EEPROM using the regular EEPROM access register.
@@ -687,7 +684,7 @@ static int el3_open(struct net_device *dev)
687 netif_start_queue(dev); 684 netif_start_queue(dev);
688 685
689 tc574_reset(dev); 686 tc574_reset(dev);
690 lp->media.function = &media_check; 687 lp->media.function = media_check;
691 lp->media.data = (unsigned long) dev; 688 lp->media.data = (unsigned long) dev;
692 lp->media.expires = jiffies + HZ; 689 lp->media.expires = jiffies + HZ;
693 add_timer(&lp->media); 690 add_timer(&lp->media);
@@ -702,7 +699,7 @@ static void el3_tx_timeout(struct net_device *dev)
702{ 699{
703 unsigned int ioaddr = dev->base_addr; 700 unsigned int ioaddr = dev->base_addr;
704 701
705 printk(KERN_NOTICE "%s: Transmit timed out!\n", dev->name); 702 netdev_notice(dev, "Transmit timed out!\n");
706 dump_status(dev); 703 dump_status(dev);
707 dev->stats.tx_errors++; 704 dev->stats.tx_errors++;
708 dev->trans_start = jiffies; /* prevent tx timeout */ 705 dev->trans_start = jiffies; /* prevent tx timeout */
@@ -825,8 +822,8 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id)
825 EL3WINDOW(4); 822 EL3WINDOW(4);
826 fifo_diag = inw(ioaddr + Wn4_FIFODiag); 823 fifo_diag = inw(ioaddr + Wn4_FIFODiag);
827 EL3WINDOW(1); 824 EL3WINDOW(1);
828 printk(KERN_NOTICE "%s: adapter failure, FIFO diagnostic" 825 netdev_notice(dev, "adapter failure, FIFO diagnostic register %04x\n",
829 " register %04x.\n", dev->name, fifo_diag); 826 fifo_diag);
830 if (fifo_diag & 0x0400) { 827 if (fifo_diag & 0x0400) {
831 /* Tx overrun */ 828 /* Tx overrun */
832 tc574_wait_for_completion(dev, TxReset); 829 tc574_wait_for_completion(dev, TxReset);
@@ -880,7 +877,7 @@ static void media_check(unsigned long arg)
880 this, we can limp along even if the interrupt is blocked */ 877 this, we can limp along even if the interrupt is blocked */
881 if ((inw(ioaddr + EL3_STATUS) & IntLatch) && (inb(ioaddr + Timer) == 0xff)) { 878 if ((inw(ioaddr + EL3_STATUS) & IntLatch) && (inb(ioaddr + Timer) == 0xff)) {
882 if (!lp->fast_poll) 879 if (!lp->fast_poll)
883 printk(KERN_INFO "%s: interrupt(s) dropped!\n", dev->name); 880 netdev_info(dev, "interrupt(s) dropped!\n");
884 881
885 local_irq_save(flags); 882 local_irq_save(flags);
886 el3_interrupt(dev->irq, dev); 883 el3_interrupt(dev->irq, dev);
@@ -903,23 +900,21 @@ static void media_check(unsigned long arg)
903 900
904 if (media != lp->media_status) { 901 if (media != lp->media_status) {
905 if ((media ^ lp->media_status) & 0x0004) 902 if ((media ^ lp->media_status) & 0x0004)
906 printk(KERN_INFO "%s: %s link beat\n", dev->name, 903 netdev_info(dev, "%s link beat\n",
907 (lp->media_status & 0x0004) ? "lost" : "found"); 904 (lp->media_status & 0x0004) ? "lost" : "found");
908 if ((media ^ lp->media_status) & 0x0020) { 905 if ((media ^ lp->media_status) & 0x0020) {
909 lp->partner = 0; 906 lp->partner = 0;
910 if (lp->media_status & 0x0020) { 907 if (lp->media_status & 0x0020) {
911 printk(KERN_INFO "%s: autonegotiation restarted\n", 908 netdev_info(dev, "autonegotiation restarted\n");
912 dev->name);
913 } else if (partner) { 909 } else if (partner) {
914 partner &= lp->advertising; 910 partner &= lp->advertising;
915 lp->partner = partner; 911 lp->partner = partner;
916 printk(KERN_INFO "%s: autonegotiation complete: " 912 netdev_info(dev, "autonegotiation complete: "
917 "%sbaseT-%cD selected\n", dev->name, 913 "%dbaseT-%cD selected\n",
918 ((partner & 0x0180) ? "100" : "10"), 914 (partner & 0x0180) ? 100 : 10,
919 ((partner & 0x0140) ? 'F' : 'H')); 915 (partner & 0x0140) ? 'F' : 'H');
920 } else { 916 } else {
921 printk(KERN_INFO "%s: link partner did not autonegotiate\n", 917 netdev_info(dev, "link partner did not autonegotiate\n");
922 dev->name);
923 } 918 }
924 919
925 EL3WINDOW(3); 920 EL3WINDOW(3);
@@ -929,10 +924,9 @@ static void media_check(unsigned long arg)
929 924
930 } 925 }
931 if (media & 0x0010) 926 if (media & 0x0010)
932 printk(KERN_INFO "%s: remote fault detected\n", 927 netdev_info(dev, "remote fault detected\n");
933 dev->name);
934 if (media & 0x0002) 928 if (media & 0x0002)
935 printk(KERN_INFO "%s: jabber detected\n", dev->name); 929 netdev_info(dev, "jabber detected\n");
936 lp->media_status = media; 930 lp->media_status = media;
937 } 931 }
938 spin_unlock_irqrestore(&lp->window_lock, flags); 932 spin_unlock_irqrestore(&lp->window_lock, flags);
@@ -1042,16 +1036,6 @@ static int el3_rx(struct net_device *dev, int worklimit)
1042 return worklimit; 1036 return worklimit;
1043} 1037}
1044 1038
1045static void netdev_get_drvinfo(struct net_device *dev,
1046 struct ethtool_drvinfo *info)
1047{
1048 strcpy(info->driver, "3c574_cs");
1049}
1050
1051static const struct ethtool_ops netdev_ethtool_ops = {
1052 .get_drvinfo = netdev_get_drvinfo,
1053};
1054
1055/* Provide ioctl() calls to examine the MII xcvr state. */ 1039/* Provide ioctl() calls to examine the MII xcvr state. */
1056static int el3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) 1040static int el3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
1057{ 1041{