Lines Matching refs:dev
103 extern int ni5010_probe(struct net_device *dev);
104 static int ni5010_probe1(struct net_device *dev, int ioaddr);
105 static int ni5010_open(struct net_device *dev);
106 static int ni5010_send_packet(struct sk_buff *skb, struct net_device *dev);
108 static void ni5010_rx(struct net_device *dev);
109 static void ni5010_timeout(struct net_device *dev);
110 static int ni5010_close(struct net_device *dev);
111 static struct net_device_stats *ni5010_get_stats(struct net_device *dev);
112 static void ni5010_set_multicast_list(struct net_device *dev);
113 static void reset_receiver(struct net_device *dev);
115 static int process_xmt_interrupt(struct net_device *dev);
116 #define tx_done(dev) 1 argument
117 static void hardware_send_packet(struct net_device *dev, char *buf, int length, int pad);
118 static void chipset_init(struct net_device *dev, int startp);
120 static void ni5010_show_registers(struct net_device *dev);
123 int __init ni5010_probe(struct net_device *dev) in ni5010_probe() argument
126 int base_addr = dev->base_addr; in ni5010_probe()
128 PRINTK2((KERN_DEBUG "%s: Entering ni5010_probe\n", dev->name)); in ni5010_probe()
130 SET_MODULE_OWNER(dev); in ni5010_probe()
133 return ni5010_probe1(dev, base_addr); in ni5010_probe()
141 if (ni5010_probe1(dev, ioaddr) == 0) in ni5010_probe()
149 if (ni5010_probe1(dev, ioaddr) == 0) in ni5010_probe()
187 static int __init ni5010_probe1(struct net_device *dev, int ioaddr) in ni5010_probe1() argument
209 dev->name, ioaddr)); in ni5010_probe1()
219 PRINTK2((KERN_DEBUG "%s: I/O #1 passed!\n", dev->name)); in ni5010_probe1()
225 PRINTK2((KERN_DEBUG "%s: I/O #2 passed!\n", dev->name)); in ni5010_probe1()
237 PRINTK2((KERN_DEBUG "%s: I/O #3 passed!\n", dev->name)); in ni5010_probe1()
244 dev->base_addr = ioaddr; in ni5010_probe1()
248 printk("%2.2x ", dev->dev_addr[i] = inb(IE_SAPROM)); in ni5010_probe1()
251 PRINTK2((KERN_DEBUG "%s: I/O #4 passed!\n", dev->name)); in ni5010_probe1()
254 if (dev->irq == 0xff) in ni5010_probe1()
256 else if (dev->irq < 2) { in ni5010_probe1()
257 PRINTK2((KERN_DEBUG "%s: I/O #5 passed!\n", dev->name)); in ni5010_probe1()
261 dev->irq = autoirq_report(2); in ni5010_probe1()
263 PRINTK2((KERN_DEBUG "%s: I/O #6 passed!\n", dev->name)); in ni5010_probe1()
265 if (dev->irq == 0) { in ni5010_probe1()
266 printk(KERN_WARNING "%s: no IRQ found!\n", dev->name); in ni5010_probe1()
269 PRINTK2((KERN_DEBUG "%s: I/O #7 passed!\n", dev->name)); in ni5010_probe1()
270 } else if (dev->irq == 2) { in ni5010_probe1()
271 dev->irq = 9; in ni5010_probe1()
274 PRINTK2((KERN_DEBUG "%s: I/O #9 passed!\n", dev->name)); in ni5010_probe1()
278 if (dev->priv == NULL) { in ni5010_probe1()
279 dev->priv = kmalloc(sizeof(struct ni5010_local), GFP_KERNEL|GFP_DMA); in ni5010_probe1()
280 if (dev->priv == NULL) { in ni5010_probe1()
281 printk(KERN_WARNING "%s: Failed to allocate private memory\n", dev->name); in ni5010_probe1()
286 PRINTK2((KERN_DEBUG "%s: I/O #10 passed!\n", dev->name)); in ni5010_probe1()
308 memset(dev->priv, 0, sizeof(struct ni5010_local)); in ni5010_probe1()
313 dev->open = ni5010_open; in ni5010_probe1()
314 dev->stop = ni5010_close; in ni5010_probe1()
315 dev->hard_start_xmit = ni5010_send_packet; in ni5010_probe1()
316 dev->get_stats = ni5010_get_stats; in ni5010_probe1()
317 dev->set_multicast_list = ni5010_set_multicast_list; in ni5010_probe1()
318 dev->tx_timeout = ni5010_timeout; in ni5010_probe1()
319 dev->watchdog_timeo = HZ/20; in ni5010_probe1()
322 ether_setup(dev); in ni5010_probe1()
324 dev->flags &= ~IFF_MULTICAST; /* Multicast doesn't work */ in ni5010_probe1()
332 printk(KERN_INFO "%s: NI5010 found at 0x%x, using IRQ %d", dev->name, ioaddr, dev->irq); in ni5010_probe1()
333 if (dev->dma) printk(" & DMA %d", dev->dma); in ni5010_probe1()
350 static int ni5010_open(struct net_device *dev) in ni5010_open() argument
352 int ioaddr = dev->base_addr; in ni5010_open()
355 PRINTK2((KERN_DEBUG "%s: entering ni5010_open()\n", dev->name)); in ni5010_open()
357 if (request_irq(dev->irq, &ni5010_interrupt, 0, boardname, dev)) { in ni5010_open()
358 printk(KERN_WARNING "%s: Cannot get irq %#2x\n", dev->name, dev->irq); in ni5010_open()
361 PRINTK3((KERN_DEBUG "%s: passed open() #1\n", dev->name)); in ni5010_open()
367 if (request_dma(dev->dma, cardname)) { in ni5010_open()
368 printk(KERN_WARNING "%s: Cannot get dma %#2x\n", dev->name, dev->dma); in ni5010_open()
369 free_irq(dev->irq, NULL); in ni5010_open()
374 PRINTK3((KERN_DEBUG "%s: passed open() #2\n", dev->name)); in ni5010_open()
381 PRINTK3((KERN_DEBUG "%s: passed open() #3\n", dev->name)); in ni5010_open()
384 outb(dev->dev_addr[i], EDLC_ADDR + i); in ni5010_open()
387 PRINTK3((KERN_DEBUG "%s: Initialising ni5010\n", dev->name)); in ni5010_open()
394 reset_receiver(dev); /* Ready ni5010 for receiving packets */ in ni5010_open()
398 netif_start_queue(dev); in ni5010_open()
400 if (NI5010_DEBUG) ni5010_show_registers(dev); in ni5010_open()
402 PRINTK((KERN_DEBUG "%s: open successful\n", dev->name)); in ni5010_open()
406 static void reset_receiver(struct net_device *dev) in reset_receiver() argument
408 int ioaddr = dev->base_addr; in reset_receiver()
410 PRINTK3((KERN_DEBUG "%s: resetting receiver\n", dev->name)); in reset_receiver()
418 static void ni5010_timeout(struct net_device *dev) in ni5010_timeout() argument
420 printk(KERN_WARNING "%s: transmit timed out, %s?\n", dev->name, in ni5010_timeout()
421 tx_done(dev) ? "IRQ conflict" : "network cable problem"); in ni5010_timeout()
424 chipset_init(dev, 1); in ni5010_timeout()
425 dev->trans_start = jiffies; in ni5010_timeout()
426 netif_wake_queue(dev); in ni5010_timeout()
429 static int ni5010_send_packet(struct sk_buff *skb, struct net_device *dev) in ni5010_send_packet() argument
433 PRINTK2((KERN_DEBUG "%s: entering ni5010_send_packet\n", dev->name)); in ni5010_send_packet()
439 netif_stop_queue(dev); in ni5010_send_packet()
440 hardware_send_packet(dev, (unsigned char *)skb->data, skb->len, length-skb->len); in ni5010_send_packet()
441 dev->trans_start = jiffies; in ni5010_send_packet()
452 struct net_device *dev = dev_id; in ni5010_interrupt() local
457 PRINTK2((KERN_DEBUG "%s: entering ni5010_interrupt\n", dev->name)); in ni5010_interrupt()
459 ioaddr = dev->base_addr; in ni5010_interrupt()
460 lp = (struct ni5010_local *)dev->priv; in ni5010_interrupt()
463 PRINTK3((KERN_DEBUG "%s: IE_ISTAT = %#02x\n", dev->name, status)); in ni5010_interrupt()
465 if ((status & IS_R_INT) == 0) ni5010_rx(dev); in ni5010_interrupt()
468 xmit_was_error = process_xmt_interrupt(dev); in ni5010_interrupt()
472 PRINTK((KERN_DEBUG "%s: DMA complete (?)\n", dev->name)); in ni5010_interrupt()
477 reset_receiver(dev); in ni5010_interrupt()
499 static void ni5010_rx(struct net_device *dev) in ni5010_rx() argument
501 struct ni5010_local *lp = (struct ni5010_local *)dev->priv; in ni5010_rx()
502 int ioaddr = dev->base_addr; in ni5010_rx()
506 PRINTK2((KERN_DEBUG "%s: entering ni5010_rx()\n", dev->name)); in ni5010_rx()
509 PRINTK3((KERN_DEBUG "%s: EDLC_RSTAT = %#2x\n", dev->name, rcv_stat)); in ni5010_rx()
512 PRINTK((KERN_INFO "%s: receive error.\n", dev->name)); in ni5010_rx()
527 dev->name, lp->i_pkt_size)); in ni5010_rx()
536 printk(KERN_WARNING "%s: Memory squeeze, dropping packet.\n", dev->name); in ni5010_rx()
541 skb->dev = dev; in ni5010_rx()
552 skb->protocol = eth_type_trans(skb,dev); in ni5010_rx()
554 dev->last_rx = jiffies; in ni5010_rx()
559 dev->name, lp->i_pkt_size)); in ni5010_rx()
563 static int process_xmt_interrupt(struct net_device *dev) in process_xmt_interrupt() argument
565 struct ni5010_local *lp = (struct ni5010_local *)dev->priv; in process_xmt_interrupt()
566 int ioaddr = dev->base_addr; in process_xmt_interrupt()
569 PRINTK2((KERN_DEBUG "%s: entering process_xmt_interrupt\n", dev->name)); in process_xmt_interrupt()
572 PRINTK3((KERN_DEBUG "%s: EDLC_XSTAT = %2.2x\n", dev->name, xmit_stat)); in process_xmt_interrupt()
579 dev->name)); in process_xmt_interrupt()
592 netif_wake_queue(dev); in process_xmt_interrupt()
595 dev->name, lp->o_pkt_size)); in process_xmt_interrupt()
601 static int ni5010_close(struct net_device *dev) in ni5010_close() argument
603 int ioaddr = dev->base_addr; in ni5010_close()
605 PRINTK2((KERN_DEBUG "%s: entering ni5010_close\n", dev->name)); in ni5010_close()
607 free_irq(dev->irq, NULL); in ni5010_close()
613 netif_stop_queue(dev); in ni5010_close()
615 PRINTK((KERN_DEBUG "%s: %s closed down\n", dev->name, boardname)); in ni5010_close()
622 static struct net_device_stats *ni5010_get_stats(struct net_device *dev) in ni5010_get_stats() argument
624 struct ni5010_local *lp = (struct ni5010_local *)dev->priv; in ni5010_get_stats()
626 PRINTK2((KERN_DEBUG "%s: entering ni5010_get_stats\n", dev->name)); in ni5010_get_stats()
628 if (NI5010_DEBUG) ni5010_show_registers(dev); in ni5010_get_stats()
644 static void ni5010_set_multicast_list(struct net_device *dev) in ni5010_set_multicast_list() argument
646 short ioaddr = dev->base_addr; in ni5010_set_multicast_list()
648 PRINTK2((KERN_DEBUG "%s: entering set_multicast_list\n", dev->name)); in ni5010_set_multicast_list()
650 if (dev->flags&IFF_PROMISC || dev->flags&IFF_ALLMULTI) { in ni5010_set_multicast_list()
651 dev->flags |= IFF_PROMISC; in ni5010_set_multicast_list()
653 PRINTK((KERN_DEBUG "%s: Entering promiscuous mode\n", dev->name)); in ni5010_set_multicast_list()
654 } else if (dev->mc_list) { in ni5010_set_multicast_list()
656 PRINTK((KERN_DEBUG "%s: No multicast, entering broadcast mode\n", dev->name)); in ni5010_set_multicast_list()
659 PRINTK((KERN_DEBUG "%s: Entering broadcast mode\n", dev->name)); in ni5010_set_multicast_list()
664 static void hardware_send_packet(struct net_device *dev, char *buf, int length, int pad) in hardware_send_packet() argument
666 struct ni5010_local *lp = (struct ni5010_local *)dev->priv; in hardware_send_packet()
667 int ioaddr = dev->base_addr; in hardware_send_packet()
671 PRINTK2((KERN_DEBUG "%s: entering hardware_send_packet\n", dev->name)); in hardware_send_packet()
675 dev->name)); in hardware_send_packet()
679 if (NI5010_DEBUG) ni5010_show_registers(dev); in hardware_send_packet()
683 dev->name)); in hardware_send_packet()
713 netif_wake_queue(dev); in hardware_send_packet()
715 if (NI5010_DEBUG) ni5010_show_registers(dev); in hardware_send_packet()
718 static void chipset_init(struct net_device *dev, int startp) in chipset_init() argument
721 PRINTK3((KERN_DEBUG "%s: doing NOTHING in chipset_init\n", dev->name)); in chipset_init()
724 static void ni5010_show_registers(struct net_device *dev) in ni5010_show_registers() argument
726 int ioaddr = dev->base_addr; in ni5010_show_registers()
728 PRINTK3((KERN_DEBUG "%s: XSTAT %#2.2x\n", dev->name, inb(EDLC_XSTAT))); in ni5010_show_registers()
729 PRINTK3((KERN_DEBUG "%s: XMASK %#2.2x\n", dev->name, inb(EDLC_XMASK))); in ni5010_show_registers()
730 PRINTK3((KERN_DEBUG "%s: RSTAT %#2.2x\n", dev->name, inb(EDLC_RSTAT))); in ni5010_show_registers()
731 PRINTK3((KERN_DEBUG "%s: RMASK %#2.2x\n", dev->name, inb(EDLC_RMASK))); in ni5010_show_registers()
732 PRINTK3((KERN_DEBUG "%s: RMODE %#2.2x\n", dev->name, inb(EDLC_RMODE))); in ni5010_show_registers()
733 PRINTK3((KERN_DEBUG "%s: XMODE %#2.2x\n", dev->name, inb(EDLC_XMODE))); in ni5010_show_registers()
734 PRINTK3((KERN_DEBUG "%s: ISTAT %#2.2x\n", dev->name, inb(IE_ISTAT))); in ni5010_show_registers()