diff options
Diffstat (limited to 'drivers/net/arcnet')
| -rw-r--r-- | drivers/net/arcnet/Kconfig | 12 | ||||
| -rw-r--r-- | drivers/net/arcnet/Makefile | 1 | ||||
| -rw-r--r-- | drivers/net/arcnet/arc-rimi.c | 9 | ||||
| -rw-r--r-- | drivers/net/arcnet/arcnet.c | 2 | ||||
| -rw-r--r-- | drivers/net/arcnet/com20020-isa.c | 1 | ||||
| -rw-r--r-- | drivers/net/arcnet/com20020-pci.c | 7 | ||||
| -rw-r--r-- | drivers/net/arcnet/com20020.c | 3 | ||||
| -rw-r--r-- | drivers/net/arcnet/com20020_cs.c | 335 | ||||
| -rw-r--r-- | drivers/net/arcnet/com90io.c | 1 | ||||
| -rw-r--r-- | drivers/net/arcnet/com90xx.c | 1 | 
10 files changed, 362 insertions, 10 deletions
diff --git a/drivers/net/arcnet/Kconfig b/drivers/net/arcnet/Kconfig index 3b2f7f11546..84fb6349a59 100644 --- a/drivers/net/arcnet/Kconfig +++ b/drivers/net/arcnet/Kconfig @@ -3,7 +3,7 @@  #  menuconfig ARCNET -	depends on NETDEVICES && (ISA || PCI) +	depends on NETDEVICES && (ISA || PCI || PCMCIA)  	tristate "ARCnet support"  	---help---  	  If you have a network card of this type, say Y and check out the @@ -123,4 +123,14 @@ config ARCNET_COM20020_PCI  	tristate "Support for COM20020 on PCI"  	depends on ARCNET_COM20020 && PCI +config ARCNET_COM20020_CS +	tristate "COM20020 ARCnet PCMCIA support" +	depends on ARCNET_COM20020 && PCMCIA +	help +	  Say Y here if you intend to attach this type of ARCnet PCMCIA card +	  to your computer. + +	  To compile this driver as a module, choose M here: the module will be +	  called com20020_cs.  If unsure, say N. +  endif # ARCNET diff --git a/drivers/net/arcnet/Makefile b/drivers/net/arcnet/Makefile index 5861af543d4..5ce8ee63e43 100644 --- a/drivers/net/arcnet/Makefile +++ b/drivers/net/arcnet/Makefile @@ -12,3 +12,4 @@ obj-$(CONFIG_ARCNET_RIM_I) += arc-rimi.o  obj-$(CONFIG_ARCNET_COM20020) += com20020.o  obj-$(CONFIG_ARCNET_COM20020_ISA) += com20020-isa.o  obj-$(CONFIG_ARCNET_COM20020_PCI) += com20020-pci.o +obj-$(CONFIG_ARCNET_COM20020_CS) += com20020_cs.o diff --git a/drivers/net/arcnet/arc-rimi.c b/drivers/net/arcnet/arc-rimi.c index 9efbbbae47c..b8b4c7ba884 100644 --- a/drivers/net/arcnet/arc-rimi.c +++ b/drivers/net/arcnet/arc-rimi.c @@ -32,6 +32,7 @@  #include <linux/netdevice.h>  #include <linux/bootmem.h>  #include <linux/init.h> +#include <linux/interrupt.h>  #include <asm/io.h>  #include <linux/arcdevice.h> @@ -88,16 +89,16 @@ static int __init arcrimi_probe(struct net_device *dev)  	BUGLVL(D_NORMAL) printk(VERSION);  	BUGLVL(D_NORMAL) printk("E-mail me if you actually test the RIM I driver, please!\n"); -	BUGMSG(D_NORMAL, "Given: node %02Xh, shmem %lXh, irq %d\n", +	BUGLVL(D_NORMAL) printk("Given: node %02Xh, shmem %lXh, irq %d\n",  	       dev->dev_addr[0], dev->mem_start, dev->irq);  	if (dev->mem_start <= 0 || dev->irq <= 0) { -		BUGMSG(D_NORMAL, "No autoprobe for RIM I; you " +		BUGLVL(D_NORMAL) printk("No autoprobe for RIM I; you "  		       "must specify the shmem and irq!\n");  		return -ENODEV;  	}  	if (dev->dev_addr[0] == 0) { -		BUGMSG(D_NORMAL, "You need to specify your card's station " +		BUGLVL(D_NORMAL) printk("You need to specify your card's station "  		       "ID!\n");  		return -ENODEV;  	} @@ -108,7 +109,7 @@ static int __init arcrimi_probe(struct net_device *dev)  	 * will be taken.  	 */  	if (!request_mem_region(dev->mem_start, MIRROR_SIZE, "arcnet (90xx)")) { -		BUGMSG(D_NORMAL, "Card memory already allocated\n"); +		BUGLVL(D_NORMAL) printk("Card memory already allocated\n");  		return -ENODEV;  	}  	return arcrimi_found(dev); diff --git a/drivers/net/arcnet/arcnet.c b/drivers/net/arcnet/arcnet.c index a746ba272f0..a956053608f 100644 --- a/drivers/net/arcnet/arcnet.c +++ b/drivers/net/arcnet/arcnet.c @@ -1007,7 +1007,7 @@ static void arcnet_rx(struct net_device *dev, int bufnum)  	soft = &pkt.soft.rfc1201; -	lp->hw.copy_from_card(dev, bufnum, 0, &pkt, sizeof(ARC_HDR_SIZE)); +	lp->hw.copy_from_card(dev, bufnum, 0, &pkt, ARC_HDR_SIZE);  	if (pkt.hard.offset[0]) {  		ofs = pkt.hard.offset[0];  		length = 256 - ofs; diff --git a/drivers/net/arcnet/com20020-isa.c b/drivers/net/arcnet/com20020-isa.c index 37272827ee5..45c61a2c5fb 100644 --- a/drivers/net/arcnet/com20020-isa.c +++ b/drivers/net/arcnet/com20020-isa.c @@ -34,6 +34,7 @@  #include <linux/delay.h>  #include <linux/netdevice.h>  #include <linux/init.h> +#include <linux/interrupt.h>  #include <linux/bootmem.h>  #include <linux/arcdevice.h>  #include <linux/com20020.h> diff --git a/drivers/net/arcnet/com20020-pci.c b/drivers/net/arcnet/com20020-pci.c index 48a1dbf01e6..cbc44f53755 100644 --- a/drivers/net/arcnet/com20020-pci.c +++ b/drivers/net/arcnet/com20020-pci.c @@ -34,6 +34,7 @@  #include <linux/errno.h>  #include <linux/netdevice.h>  #include <linux/init.h> +#include <linux/interrupt.h>  #include <linux/pci.h>  #include <linux/arcdevice.h>  #include <linux/com20020.h> @@ -60,7 +61,7 @@ module_param(clockp, int, 0);  module_param(clockm, int, 0);  MODULE_LICENSE("GPL"); -static int __devinit com20020pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) +static int com20020pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)  {  	struct net_device *dev;  	struct arcnet_local *lp; @@ -134,7 +135,7 @@ out_dev:  	return err;  } -static void __devexit com20020pci_remove(struct pci_dev *pdev) +static void com20020pci_remove(struct pci_dev *pdev)  {  	struct net_device *dev = pci_get_drvdata(pdev);  	unregister_netdev(dev); @@ -177,7 +178,7 @@ static struct pci_driver com20020pci_driver = {  	.name		= "com20020",  	.id_table	= com20020pci_id_table,  	.probe		= com20020pci_probe, -	.remove		= __devexit_p(com20020pci_remove), +	.remove		= com20020pci_remove,  };  static int __init com20020pci_init(void) diff --git a/drivers/net/arcnet/com20020.c b/drivers/net/arcnet/com20020.c index c9e459400ff..7b96c5f47e8 100644 --- a/drivers/net/arcnet/com20020.c +++ b/drivers/net/arcnet/com20020.c @@ -33,6 +33,7 @@  #include <linux/delay.h>  #include <linux/netdevice.h>  #include <linux/init.h> +#include <linux/interrupt.h>  #include <linux/arcdevice.h>  #include <linux/com20020.h> @@ -153,7 +154,7 @@ const struct net_device_ops com20020_netdev_ops = {  	.ndo_stop	= arcnet_close,  	.ndo_start_xmit = arcnet_send_packet,  	.ndo_tx_timeout = arcnet_timeout, -	.ndo_set_multicast_list = com20020_set_mc_list, +	.ndo_set_rx_mode = com20020_set_mc_list,  };  /* Set up the struct net_device associated with this card.  Called after diff --git a/drivers/net/arcnet/com20020_cs.c b/drivers/net/arcnet/com20020_cs.c new file mode 100644 index 00000000000..326a612a273 --- /dev/null +++ b/drivers/net/arcnet/com20020_cs.c @@ -0,0 +1,335 @@ +/* + * Linux ARCnet driver - COM20020 PCMCIA support + *  + * Written 1994-1999 by Avery Pennarun, + *    based on an ISA version by David Woodhouse. + * Derived from ibmtr_cs.c by Steve Kipisz (pcmcia-cs 3.1.4) + *    which was derived from pcnet_cs.c by David Hinds. + * Some additional portions derived from skeleton.c by Donald Becker. + * + * Special thanks to Contemporary Controls, Inc. (www.ccontrols.com) + *  for sponsoring the further development of this driver. + * + * ********************** + * + * The original copyright of skeleton.c was as follows: + * + * skeleton.c Written 1993 by Donald Becker. + * Copyright 1993 United States Government as represented by the + * Director, National Security Agency.  This software may only be used + * and distributed according to the terms of the GNU General Public License as + * modified by SRC, incorporated herein by reference. + *  + * ********************** + * Changes: + * Arnaldo Carvalho de Melo <acme@conectiva.com.br> - 08/08/2000 + * - reorganize kmallocs in com20020_attach, checking all for failure + *   and releasing the previous allocations if one fails + * ********************** + *  + * For more details, see drivers/net/arcnet.c + * + * ********************** + */ +#include <linux/kernel.h> +#include <linux/ptrace.h> +#include <linux/slab.h> +#include <linux/string.h> +#include <linux/timer.h> +#include <linux/delay.h> +#include <linux/module.h> +#include <linux/netdevice.h> +#include <linux/arcdevice.h> +#include <linux/com20020.h> + +#include <pcmcia/cistpl.h> +#include <pcmcia/ds.h> + +#include <asm/io.h> + +#define VERSION "arcnet: COM20020 PCMCIA support loaded.\n" + + +static void regdump(struct net_device *dev) +{ +#ifdef DEBUG +    int ioaddr = dev->base_addr; +    int count; +     +    netdev_dbg(dev, "register dump:\n"); +    for (count = ioaddr; count < ioaddr + 16; count++) +    { +	if (!(count % 16)) +	    pr_cont("%04X:", count); +	pr_cont(" %02X", inb(count)); +    } +    pr_cont("\n"); +     +    netdev_dbg(dev, "buffer0 dump:\n"); +	/* set up the address register */ +        count = 0; +	outb((count >> 8) | RDDATAflag | AUTOINCflag, _ADDR_HI); +	outb(count & 0xff, _ADDR_LO); +     +    for (count = 0; count < 256+32; count++) +    { +	if (!(count % 16)) +	    pr_cont("%04X:", count); +	 +	/* copy the data */ +	pr_cont(" %02X", inb(_MEMDATA)); +    } +    pr_cont("\n"); +#endif +} + + + +/*====================================================================*/ + +/* Parameters that can be set with 'insmod' */ + +static int node; +static int timeout = 3; +static int backplane; +static int clockp; +static int clockm; + +module_param(node, int, 0); +module_param(timeout, int, 0); +module_param(backplane, int, 0); +module_param(clockp, int, 0); +module_param(clockm, int, 0); + +MODULE_LICENSE("GPL"); + +/*====================================================================*/ + +static int com20020_config(struct pcmcia_device *link); +static void com20020_release(struct pcmcia_device *link); + +static void com20020_detach(struct pcmcia_device *p_dev); + +/*====================================================================*/ + +typedef struct com20020_dev_t { +    struct net_device       *dev; +} com20020_dev_t; + +static int com20020_probe(struct pcmcia_device *p_dev) +{ +    com20020_dev_t *info; +    struct net_device *dev; +    struct arcnet_local *lp; + +    dev_dbg(&p_dev->dev, "com20020_attach()\n"); + +    /* Create new network device */ +    info = kzalloc(sizeof(struct com20020_dev_t), GFP_KERNEL); +    if (!info) +	goto fail_alloc_info; + +    dev = alloc_arcdev(""); +    if (!dev) +	goto fail_alloc_dev; + +    lp = netdev_priv(dev); +    lp->timeout = timeout; +    lp->backplane = backplane; +    lp->clockp = clockp; +    lp->clockm = clockm & 3; +    lp->hw.owner = THIS_MODULE; + +    /* fill in our module parameters as defaults */ +    dev->dev_addr[0] = node; + +    p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; +    p_dev->resource[0]->end = 16; +    p_dev->config_flags |= CONF_ENABLE_IRQ; + +    info->dev = dev; +    p_dev->priv = info; + +    return com20020_config(p_dev); + +fail_alloc_dev: +    kfree(info); +fail_alloc_info: +    return -ENOMEM; +} /* com20020_attach */ + +static void com20020_detach(struct pcmcia_device *link) +{ +    struct com20020_dev_t *info = link->priv; +    struct net_device *dev = info->dev; + +    dev_dbg(&link->dev, "detach...\n"); + +    dev_dbg(&link->dev, "com20020_detach\n"); + +    dev_dbg(&link->dev, "unregister...\n"); + +    unregister_netdev(dev); + +    /* +     * this is necessary because we register our IRQ separately +     * from card services. +     */ +    if (dev->irq) +	    free_irq(dev->irq, dev); + +    com20020_release(link); + +    /* Unlink device structure, free bits */ +    dev_dbg(&link->dev, "unlinking...\n"); +    if (link->priv) +    { +	dev = info->dev; +	if (dev) +	{ +	    dev_dbg(&link->dev, "kfree...\n"); +	    free_netdev(dev); +	} +	dev_dbg(&link->dev, "kfree2...\n"); +	kfree(info); +    } + +} /* com20020_detach */ + +static int com20020_config(struct pcmcia_device *link) +{ +    struct arcnet_local *lp; +    com20020_dev_t *info; +    struct net_device *dev; +    int i, ret; +    int ioaddr; + +    info = link->priv; +    dev = info->dev; + +    dev_dbg(&link->dev, "config...\n"); + +    dev_dbg(&link->dev, "com20020_config\n"); + +    dev_dbg(&link->dev, "baseport1 is %Xh\n", +	    (unsigned int) link->resource[0]->start); + +    i = -ENODEV; +    link->io_lines = 16; + +    if (!link->resource[0]->start) +    { +	for (ioaddr = 0x100; ioaddr < 0x400; ioaddr += 0x10) +	{ +	    link->resource[0]->start = ioaddr; +	    i = pcmcia_request_io(link); +	    if (i == 0) +		break; +	} +    } +    else +	i = pcmcia_request_io(link); +     +    if (i != 0) +    { +	dev_dbg(&link->dev, "requestIO failed totally!\n"); +	goto failed; +    } +	 +    ioaddr = dev->base_addr = link->resource[0]->start; +    dev_dbg(&link->dev, "got ioaddr %Xh\n", ioaddr); + +    dev_dbg(&link->dev, "request IRQ %d\n", +	    link->irq); +    if (!link->irq) +    { +	dev_dbg(&link->dev, "requestIRQ failed totally!\n"); +	goto failed; +    } + +    dev->irq = link->irq; + +    ret = pcmcia_enable_device(link); +    if (ret) +	    goto failed; + +    if (com20020_check(dev)) +    { +	regdump(dev); +	goto failed; +    } +     +    lp = netdev_priv(dev); +    lp->card_name = "PCMCIA COM20020"; +    lp->card_flags = ARC_CAN_10MBIT; /* pretend all of them can 10Mbit */ + +    SET_NETDEV_DEV(dev, &link->dev); + +    i = com20020_found(dev, 0);	/* calls register_netdev */ +     +    if (i != 0) { +	dev_notice(&link->dev, +		   "com20020_found() failed\n"); +	goto failed; +    } + +    netdev_dbg(dev, "port %#3lx, irq %d\n", +	       dev->base_addr, dev->irq); +    return 0; + +failed: +    dev_dbg(&link->dev, "com20020_config failed...\n"); +    com20020_release(link); +    return -ENODEV; +} /* com20020_config */ + +static void com20020_release(struct pcmcia_device *link) +{ +	dev_dbg(&link->dev, "com20020_release\n"); +	pcmcia_disable_device(link); +} + +static int com20020_suspend(struct pcmcia_device *link) +{ +	com20020_dev_t *info = link->priv; +	struct net_device *dev = info->dev; + +	if (link->open) +		netif_device_detach(dev); + +	return 0; +} + +static int com20020_resume(struct pcmcia_device *link) +{ +	com20020_dev_t *info = link->priv; +	struct net_device *dev = info->dev; + +	if (link->open) { +		int ioaddr = dev->base_addr; +		struct arcnet_local *lp = netdev_priv(dev); +		ARCRESET; +	} + +	return 0; +} + +static const struct pcmcia_device_id com20020_ids[] = { +	PCMCIA_DEVICE_PROD_ID12("Contemporary Control Systems, Inc.", +			"PCM20 Arcnet Adapter", 0x59991666, 0x95dfffaf), +	PCMCIA_DEVICE_PROD_ID12("SoHard AG", +			"SH ARC PCMCIA", 0xf8991729, 0x69dff0c7), +	PCMCIA_DEVICE_NULL +}; +MODULE_DEVICE_TABLE(pcmcia, com20020_ids); + +static struct pcmcia_driver com20020_cs_driver = { +	.owner		= THIS_MODULE, +	.name		= "com20020_cs", +	.probe		= com20020_probe, +	.remove		= com20020_detach, +	.id_table	= com20020_ids, +	.suspend	= com20020_suspend, +	.resume		= com20020_resume, +}; +module_pcmcia_driver(com20020_cs_driver); diff --git a/drivers/net/arcnet/com90io.c b/drivers/net/arcnet/com90io.c index eb27976dab3..487d780ebbd 100644 --- a/drivers/net/arcnet/com90io.c +++ b/drivers/net/arcnet/com90io.c @@ -33,6 +33,7 @@  #include <linux/netdevice.h>  #include <linux/bootmem.h>  #include <linux/init.h> +#include <linux/interrupt.h>  #include <asm/io.h>  #include <linux/arcdevice.h> diff --git a/drivers/net/arcnet/com90xx.c b/drivers/net/arcnet/com90xx.c index f3b46f71e29..b80fbe40aa0 100644 --- a/drivers/net/arcnet/com90xx.c +++ b/drivers/net/arcnet/com90xx.c @@ -27,6 +27,7 @@  #include <linux/module.h>  #include <linux/moduleparam.h>  #include <linux/init.h> +#include <linux/interrupt.h>  #include <linux/ioport.h>  #include <linux/delay.h>  #include <linux/netdevice.h>  | 
