Lines Matching refs:dev
183 static int cops_probe1 (struct net_device *dev, int ioaddr);
186 static int cops_open (struct net_device *dev);
187 static int cops_jumpstart (struct net_device *dev);
188 static void cops_reset (struct net_device *dev, int sleep);
189 static void cops_load (struct net_device *dev);
190 static int cops_nodeid (struct net_device *dev, int nodeid);
194 static void cops_timeout(struct net_device *dev, unsigned int txqueue);
195 static void cops_rx (struct net_device *dev);
197 struct net_device *dev);
198 static void set_multicast_list (struct net_device *dev);
199 static int cops_ioctl (struct net_device *dev, struct ifreq *rq, int cmd);
200 static int cops_close (struct net_device *dev);
202 static void cleanup_card(struct net_device *dev) in cleanup_card() argument
204 if (dev->irq) in cleanup_card()
205 free_irq(dev->irq, dev); in cleanup_card()
206 release_region(dev->base_addr, COPS_IO_EXTENT); in cleanup_card()
217 struct net_device *dev; in cops_probe() local
222 dev = alloc_ltalkdev(sizeof(struct cops_local)); in cops_probe()
223 if (!dev) in cops_probe()
227 sprintf(dev->name, "lt%d", unit); in cops_probe()
228 netdev_boot_setup_check(dev); in cops_probe()
229 irq = dev->irq; in cops_probe()
230 base_addr = dev->base_addr; in cops_probe()
232 base_addr = dev->base_addr = io; in cops_probe()
236 err = cops_probe1(dev, base_addr); in cops_probe()
245 for (port = ports; *port && cops_probe1(dev, *port) < 0; port++) in cops_probe()
252 err = register_netdev(dev); in cops_probe()
255 return dev; in cops_probe()
257 cleanup_card(dev); in cops_probe()
259 free_netdev(dev); in cops_probe()
277 static int __init cops_probe1(struct net_device *dev, int ioaddr) in cops_probe1() argument
288 if (!request_region(ioaddr, COPS_IO_EXTENT, dev->name)) in cops_probe1()
298 dev->irq = irq; in cops_probe1()
299 switch (dev->irq) in cops_probe1()
303 dev->irq = cops_irq(ioaddr, board); in cops_probe1()
304 if (dev->irq) in cops_probe1()
315 dev->irq = 9; in cops_probe1()
323 dev->irq = 0; in cops_probe1()
330 dev->base_addr = ioaddr; in cops_probe1()
333 if (dev->irq) { in cops_probe1()
334 retval = request_irq(dev->irq, cops_interrupt, 0, dev->name, dev); in cops_probe1()
339 lp = netdev_priv(dev); in cops_probe1()
345 dev->netdev_ops = &cops_netdev_ops; in cops_probe1()
346 dev->watchdog_timeo = HZ * 2; in cops_probe1()
352 dev->name, cardname, ioaddr, dev->irq); in cops_probe1()
354 if(dev->irq) in cops_probe1()
356 dev->name, cardname, ioaddr, dev->irq); in cops_probe1()
359 dev->name, cardname, ioaddr); in cops_probe1()
418 static int cops_open(struct net_device *dev) in cops_open() argument
420 struct cops_local *lp = netdev_priv(dev); in cops_open()
422 if(dev->irq==0) in cops_open()
430 cops_timer_dev = dev; in cops_open()
437 printk(KERN_WARNING "%s: No irq line set\n", dev->name); in cops_open()
442 cops_jumpstart(dev); /* Start the card up. */ in cops_open()
444 netif_start_queue(dev); in cops_open()
451 static int cops_jumpstart(struct net_device *dev) in cops_jumpstart() argument
453 struct cops_local *lp = netdev_priv(dev); in cops_jumpstart()
459 cops_reset(dev,1); /* Need to reset card before load firmware. */ in cops_jumpstart()
460 cops_load(dev); /* Load the firmware. */ in cops_jumpstart()
469 cops_nodeid(dev,lp->node_acquire); in cops_jumpstart()
485 static void cops_reset(struct net_device *dev, int sleep) in cops_reset() argument
487 struct cops_local *lp = netdev_priv(dev); in cops_reset()
488 int ioaddr=dev->base_addr; in cops_reset()
509 netif_wake_queue(dev); in cops_reset()
512 static void cops_load (struct net_device *dev) in cops_load() argument
516 struct cops_local *lp = netdev_priv(dev); in cops_load()
517 int ioaddr=dev->base_addr; in cops_load()
540 printk(KERN_INFO "%s; unsupported board type.\n", dev->name); in cops_load()
547 printk(KERN_WARNING "%s: Firmware is not length of FFDRV.BIN.\n", dev->name); in cops_load()
552 printk(KERN_WARNING "%s: Firmware is not length of DRVCODE.BIN.\n", dev->name); in cops_load()
585 dev->name, i, ltf->length); in cops_load()
605 static int cops_nodeid (struct net_device *dev, int nodeid) in cops_nodeid() argument
607 struct cops_local *lp = netdev_priv(dev); in cops_nodeid()
608 int ioaddr = dev->base_addr; in cops_nodeid()
617 cops_rx(dev); /* Kick any packets waiting. */ in cops_nodeid()
633 cops_rx(dev); /* Kick out packets waiting. */ in cops_nodeid()
655 cops_rx(dev); /* Grab the nodeid put in lp->node_acquire. */ in cops_nodeid()
660 cops_rx(dev); /* Grab the nodeid put in lp->node_acquire. */ in cops_nodeid()
667 dev->name, lp->node_acquire); in cops_nodeid()
682 struct net_device *dev = cops_timer_dev; in cops_poll() local
686 if(dev == NULL) in cops_poll()
689 ioaddr = dev->base_addr; in cops_poll()
693 cops_rx(dev); in cops_poll()
695 netif_wake_queue(dev); in cops_poll()
710 struct net_device *dev = dev_id; in cops_interrupt() local
715 ioaddr = dev->base_addr; in cops_interrupt()
716 lp = netdev_priv(dev); in cops_interrupt()
724 cops_rx(dev); in cops_interrupt()
725 netif_wake_queue(dev); in cops_interrupt()
733 cops_rx(dev); in cops_interrupt()
735 netif_wake_queue(dev); in cops_interrupt()
746 static void cops_rx(struct net_device *dev) in cops_rx() argument
751 struct cops_local *lp = netdev_priv(dev); in cops_rx()
752 int ioaddr = dev->base_addr; in cops_rx()
775 printk(KERN_WARNING "%s: DMA timed out.\n",dev->name); in cops_rx()
792 dev->name); in cops_rx()
793 dev->stats.rx_dropped++; in cops_rx()
799 skb->dev = dev; in cops_rx()
814 dev->name, pkt_len); in cops_rx()
815 dev->stats.tx_errors++; in cops_rx()
831 printk(KERN_WARNING "%s: Bad packet type %d.\n", dev->name, rsp_type); in cops_rx()
832 dev->stats.tx_errors++; in cops_rx()
842 dev->stats.rx_packets++; in cops_rx()
843 dev->stats.rx_bytes += skb->len; in cops_rx()
849 static void cops_timeout(struct net_device *dev, unsigned int txqueue) in cops_timeout() argument
851 struct cops_local *lp = netdev_priv(dev); in cops_timeout()
852 int ioaddr = dev->base_addr; in cops_timeout()
854 dev->stats.tx_errors++; in cops_timeout()
858 printk(KERN_WARNING "%s: No TX complete interrupt.\n", dev->name); in cops_timeout()
860 printk(KERN_WARNING "%s: Transmit timed out.\n", dev->name); in cops_timeout()
861 cops_jumpstart(dev); /* Restart the card. */ in cops_timeout()
862 netif_trans_update(dev); /* prevent tx timeout */ in cops_timeout()
863 netif_wake_queue(dev); in cops_timeout()
872 struct net_device *dev) in cops_send_packet() argument
874 struct cops_local *lp = netdev_priv(dev); in cops_send_packet()
875 int ioaddr = dev->base_addr; in cops_send_packet()
882 netif_stop_queue(dev); in cops_send_packet()
910 dev->stats.tx_packets++; in cops_send_packet()
911 dev->stats.tx_bytes += skb->len; in cops_send_packet()
920 static void set_multicast_list(struct net_device *dev) in set_multicast_list() argument
923 printk("%s: set_multicast_list executed\n", dev->name); in set_multicast_list()
930 static int cops_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) in cops_ioctl() argument
932 struct cops_local *lp = netdev_priv(dev); in cops_ioctl()
940 cops_nodeid(dev, sa->sat_addr.s_node); in cops_ioctl()
945 dev->broadcast[0] = 0xFF; in cops_ioctl()
948 dev->addr_len = 1; in cops_ioctl()
949 dev_addr_set(dev, &aa->s_node); in cops_ioctl()
966 static int cops_close(struct net_device *dev) in cops_close() argument
968 struct cops_local *lp = netdev_priv(dev); in cops_close()
972 if(lp->board==TANGENT && dev->irq==0) in cops_close()
975 netif_stop_queue(dev); in cops_close()