2 * sgiseeq.c: Seeq8003 ethernet driver for SGI machines.
4 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
9 #include <linux/kernel.h>
10 #include <linux/module.h>
11 #include <linux/errno.h>
12 #include <linux/init.h>
13 #include <linux/types.h>
14 #include <linux/interrupt.h>
15 #include <linux/slab.h>
16 #include <linux/string.h>
17 #include <linux/delay.h>
18 #include <linux/netdevice.h>
19 #include <linux/platform_device.h>
20 #include <linux/etherdevice.h>
21 #include <linux/skbuff.h>
23 #include <asm/sgi/hpc3.h>
24 #include <asm/sgi/ip22.h>
25 #include <asm/sgi/seeq.h>
29 static char *sgiseeqstr = "SGI Seeq8003";
32 * If you want speed, you do something silly, it always has worked for me. So,
33 * with that in mind, I've decided to make this driver look completely like a
34 * stupid Lance from a driver architecture perspective. Only difference is that
35 * here our "ring buffer" looks and acts like a real Lance one does but is
36 * layed out like how the HPC DMA and the Seeq want it to. You'd be surprised
37 * how a stupid idea like this can pay off in performance, not to mention
38 * making this driver 2,000 times easier to write. ;-)
41 /* Tune these if we tend to run out often etc. */
42 #define SEEQ_RX_BUFFERS 16
43 #define SEEQ_TX_BUFFERS 16
45 #define PKT_BUF_SZ 1584
47 #define NEXT_RX(i) (((i) + 1) & (SEEQ_RX_BUFFERS - 1))
48 #define NEXT_TX(i) (((i) + 1) & (SEEQ_TX_BUFFERS - 1))
49 #define PREV_RX(i) (((i) - 1) & (SEEQ_RX_BUFFERS - 1))
50 #define PREV_TX(i) (((i) - 1) & (SEEQ_TX_BUFFERS - 1))
52 #define TX_BUFFS_AVAIL(sp) ((sp->tx_old <= sp->tx_new) ? \
53 sp->tx_old + (SEEQ_TX_BUFFERS - 1) - sp->tx_new : \
54 sp->tx_old - sp->tx_new - 1)
56 struct sgiseeq_rx_desc {
57 volatile struct hpc_dma_desc rdma;
58 volatile signed int buf_vaddr;
61 struct sgiseeq_tx_desc {
62 volatile struct hpc_dma_desc tdma;
63 volatile signed int buf_vaddr;
67 * Warning: This structure is layed out in a certain way because HPC dma
68 * descriptors must be 8-byte aligned. So don't touch this without
71 struct sgiseeq_init_block { /* Note the name ;-) */
72 struct sgiseeq_rx_desc rxvector[SEEQ_RX_BUFFERS];
73 struct sgiseeq_tx_desc txvector[SEEQ_TX_BUFFERS];
76 struct sgiseeq_private {
77 struct sgiseeq_init_block *srings;
78 dma_addr_t srings_dma;
80 /* Ptrs to the descriptors in uncached space. */
81 struct sgiseeq_rx_desc *rx_desc;
82 struct sgiseeq_tx_desc *tx_desc;
85 struct hpc3_ethregs *hregs;
86 struct sgiseeq_regs *sregs;
88 /* Ring entry counters. */
89 unsigned int rx_new, tx_new;
90 unsigned int rx_old, tx_old;
93 unsigned char control;
96 struct net_device_stats stats;
101 static inline void hpc3_eth_reset(struct hpc3_ethregs *hregs)
103 hregs->reset = HPC3_ERST_CRESET | HPC3_ERST_CLRIRQ;
108 static inline void reset_hpc3_and_seeq(struct hpc3_ethregs *hregs,
109 struct sgiseeq_regs *sregs)
111 hregs->rx_ctrl = hregs->tx_ctrl = 0;
112 hpc3_eth_reset(hregs);
115 #define RSTAT_GO_BITS (SEEQ_RCMD_IGOOD | SEEQ_RCMD_IEOF | SEEQ_RCMD_ISHORT | \
116 SEEQ_RCMD_IDRIB | SEEQ_RCMD_ICRC)
118 static inline void seeq_go(struct sgiseeq_private *sp,
119 struct hpc3_ethregs *hregs,
120 struct sgiseeq_regs *sregs)
122 sregs->rstat = sp->mode | RSTAT_GO_BITS;
123 hregs->rx_ctrl = HPC3_ERXCTRL_ACTIVE;
126 static inline void __sgiseeq_set_mac_address(struct net_device *dev)
128 struct sgiseeq_private *sp = netdev_priv(dev);
129 struct sgiseeq_regs *sregs = sp->sregs;
132 sregs->tstat = SEEQ_TCMD_RB0;
133 for (i = 0; i < 6; i++)
134 sregs->rw.eth_addr[i] = dev->dev_addr[i];
137 static int sgiseeq_set_mac_address(struct net_device *dev, void *addr)
139 struct sgiseeq_private *sp = netdev_priv(dev);
140 struct sockaddr *sa = addr;
142 memcpy(dev->dev_addr, sa->sa_data, dev->addr_len);
144 spin_lock_irq(&sp->tx_lock);
145 __sgiseeq_set_mac_address(dev);
146 spin_unlock_irq(&sp->tx_lock);
151 #define TCNTINFO_INIT (HPCDMA_EOX | HPCDMA_ETXD)
152 #define RCNTCFG_INIT (HPCDMA_OWN | HPCDMA_EORP | HPCDMA_XIE)
153 #define RCNTINFO_INIT (RCNTCFG_INIT | (PKT_BUF_SZ & HPCDMA_BCNT))
155 static int seeq_init_ring(struct net_device *dev)
157 struct sgiseeq_private *sp = netdev_priv(dev);
160 netif_stop_queue(dev);
161 sp->rx_new = sp->tx_new = 0;
162 sp->rx_old = sp->tx_old = 0;
164 __sgiseeq_set_mac_address(dev);
167 for(i = 0; i < SEEQ_TX_BUFFERS; i++) {
168 if (!sp->tx_desc[i].tdma.pbuf) {
169 unsigned long buffer;
171 buffer = (unsigned long) kmalloc(PKT_BUF_SZ, GFP_KERNEL);
174 sp->tx_desc[i].buf_vaddr = CKSEG1ADDR(buffer);
175 sp->tx_desc[i].tdma.pbuf = CPHYSADDR(buffer);
177 sp->tx_desc[i].tdma.cntinfo = TCNTINFO_INIT;
180 /* And now the rx ring. */
181 for (i = 0; i < SEEQ_RX_BUFFERS; i++) {
182 if (!sp->rx_desc[i].rdma.pbuf) {
183 unsigned long buffer;
185 buffer = (unsigned long) kmalloc(PKT_BUF_SZ, GFP_KERNEL);
188 sp->rx_desc[i].buf_vaddr = CKSEG1ADDR(buffer);
189 sp->rx_desc[i].rdma.pbuf = CPHYSADDR(buffer);
191 sp->rx_desc[i].rdma.cntinfo = RCNTINFO_INIT;
193 sp->rx_desc[i - 1].rdma.cntinfo |= HPCDMA_EOR;
198 static struct sgiseeq_private *gpriv;
199 static struct net_device *gdev;
201 static void sgiseeq_dump_rings(void)
204 struct sgiseeq_rx_desc *r = gpriv->rx_desc;
205 struct sgiseeq_tx_desc *t = gpriv->tx_desc;
206 struct hpc3_ethregs *hregs = gpriv->hregs;
212 printk("RING DUMP:\n");
213 for (i = 0; i < SEEQ_RX_BUFFERS; i++) {
214 printk("RX [%d]: @(%p) [%08x,%08x,%08x] ",
215 i, (&r[i]), r[i].rdma.pbuf, r[i].rdma.cntinfo,
218 printk("-- [%d]: @(%p) [%08x,%08x,%08x]\n",
219 i, (&r[i]), r[i].rdma.pbuf, r[i].rdma.cntinfo,
222 for (i = 0; i < SEEQ_TX_BUFFERS; i++) {
223 printk("TX [%d]: @(%p) [%08x,%08x,%08x] ",
224 i, (&t[i]), t[i].tdma.pbuf, t[i].tdma.cntinfo,
227 printk("-- [%d]: @(%p) [%08x,%08x,%08x]\n",
228 i, (&t[i]), t[i].tdma.pbuf, t[i].tdma.cntinfo,
231 printk("INFO: [rx_new = %d rx_old=%d] [tx_new = %d tx_old = %d]\n",
232 gpriv->rx_new, gpriv->rx_old, gpriv->tx_new, gpriv->tx_old);
233 printk("RREGS: rx_cbptr[%08x] rx_ndptr[%08x] rx_ctrl[%08x]\n",
234 hregs->rx_cbptr, hregs->rx_ndptr, hregs->rx_ctrl);
235 printk("TREGS: tx_cbptr[%08x] tx_ndptr[%08x] tx_ctrl[%08x]\n",
236 hregs->tx_cbptr, hregs->tx_ndptr, hregs->tx_ctrl);
240 #define TSTAT_INIT_SEEQ (SEEQ_TCMD_IPT|SEEQ_TCMD_I16|SEEQ_TCMD_IC|SEEQ_TCMD_IUF)
241 #define TSTAT_INIT_EDLC ((TSTAT_INIT_SEEQ) | SEEQ_TCMD_RB2)
243 static int init_seeq(struct net_device *dev, struct sgiseeq_private *sp,
244 struct sgiseeq_regs *sregs)
246 struct hpc3_ethregs *hregs = sp->hregs;
249 reset_hpc3_and_seeq(hregs, sregs);
250 err = seeq_init_ring(dev);
254 /* Setup to field the proper interrupt types. */
256 sregs->tstat = TSTAT_INIT_EDLC;
257 sregs->rw.wregs.control = sp->control;
258 sregs->rw.wregs.frame_gap = 0;
260 sregs->tstat = TSTAT_INIT_SEEQ;
263 hregs->rx_ndptr = CPHYSADDR(sp->rx_desc);
264 hregs->tx_ndptr = CPHYSADDR(sp->tx_desc);
266 seeq_go(sp, hregs, sregs);
270 static inline void record_rx_errors(struct sgiseeq_private *sp,
271 unsigned char status)
273 if (status & SEEQ_RSTAT_OVERF ||
274 status & SEEQ_RSTAT_SFRAME)
275 sp->stats.rx_over_errors++;
276 if (status & SEEQ_RSTAT_CERROR)
277 sp->stats.rx_crc_errors++;
278 if (status & SEEQ_RSTAT_DERROR)
279 sp->stats.rx_frame_errors++;
280 if (status & SEEQ_RSTAT_REOF)
281 sp->stats.rx_errors++;
284 static inline void rx_maybe_restart(struct sgiseeq_private *sp,
285 struct hpc3_ethregs *hregs,
286 struct sgiseeq_regs *sregs)
288 if (!(hregs->rx_ctrl & HPC3_ERXCTRL_ACTIVE)) {
289 hregs->rx_ndptr = CPHYSADDR(sp->rx_desc + sp->rx_new);
290 seeq_go(sp, hregs, sregs);
294 #define for_each_rx(rd, sp) for((rd) = &(sp)->rx_desc[(sp)->rx_new]; \
295 !((rd)->rdma.cntinfo & HPCDMA_OWN); \
296 (rd) = &(sp)->rx_desc[(sp)->rx_new])
298 static inline void sgiseeq_rx(struct net_device *dev, struct sgiseeq_private *sp,
299 struct hpc3_ethregs *hregs,
300 struct sgiseeq_regs *sregs)
302 struct sgiseeq_rx_desc *rd;
303 struct sk_buff *skb = NULL;
304 unsigned char pkt_status;
305 unsigned char *pkt_pointer = NULL;
307 unsigned int orig_end = PREV_RX(sp->rx_new);
309 /* Service every received packet. */
310 for_each_rx(rd, sp) {
311 len = PKT_BUF_SZ - (rd->rdma.cntinfo & HPCDMA_BCNT) - 3;
312 pkt_pointer = (unsigned char *)(long)rd->buf_vaddr;
313 pkt_status = pkt_pointer[len + 2];
315 if (pkt_status & SEEQ_RSTAT_FIG) {
317 skb = dev_alloc_skb(len + 2);
323 /* Copy out of kseg1 to avoid silly cache flush. */
324 skb_copy_to_linear_data(skb, pkt_pointer + 2, len);
325 skb->protocol = eth_type_trans(skb, dev);
327 /* We don't want to receive our own packets */
328 if (memcmp(eth_hdr(skb)->h_source, dev->dev_addr, ETH_ALEN)) {
330 dev->last_rx = jiffies;
331 sp->stats.rx_packets++;
332 sp->stats.rx_bytes += len;
334 /* Silently drop my own packets */
335 dev_kfree_skb_irq(skb);
338 printk (KERN_NOTICE "%s: Memory squeeze, deferring packet.\n",
340 sp->stats.rx_dropped++;
343 record_rx_errors(sp, pkt_status);
346 /* Return the entry to the ring pool. */
347 rd->rdma.cntinfo = RCNTINFO_INIT;
348 sp->rx_new = NEXT_RX(sp->rx_new);
350 sp->rx_desc[orig_end].rdma.cntinfo &= ~(HPCDMA_EOR);
351 sp->rx_desc[PREV_RX(sp->rx_new)].rdma.cntinfo |= HPCDMA_EOR;
352 rx_maybe_restart(sp, hregs, sregs);
355 static inline void tx_maybe_reset_collisions(struct sgiseeq_private *sp,
356 struct sgiseeq_regs *sregs)
359 sregs->rw.wregs.control = sp->control & ~(SEEQ_CTRL_XCNT);
360 sregs->rw.wregs.control = sp->control;
364 static inline void kick_tx(struct sgiseeq_tx_desc *td,
365 struct hpc3_ethregs *hregs)
367 /* If the HPC aint doin nothin, and there are more packets
368 * with ETXD cleared and XIU set we must make very certain
369 * that we restart the HPC else we risk locking up the
370 * adapter. The following code is only safe iff the HPCDMA
373 while ((td->tdma.cntinfo & (HPCDMA_XIU | HPCDMA_ETXD)) ==
374 (HPCDMA_XIU | HPCDMA_ETXD))
375 td = (struct sgiseeq_tx_desc *)(long) CKSEG1ADDR(td->tdma.pnext);
376 if (td->tdma.cntinfo & HPCDMA_XIU) {
377 hregs->tx_ndptr = CPHYSADDR(td);
378 hregs->tx_ctrl = HPC3_ETXCTRL_ACTIVE;
382 static inline void sgiseeq_tx(struct net_device *dev, struct sgiseeq_private *sp,
383 struct hpc3_ethregs *hregs,
384 struct sgiseeq_regs *sregs)
386 struct sgiseeq_tx_desc *td;
387 unsigned long status = hregs->tx_ctrl;
390 tx_maybe_reset_collisions(sp, sregs);
392 if (!(status & (HPC3_ETXCTRL_ACTIVE | SEEQ_TSTAT_PTRANS))) {
393 /* Oops, HPC detected some sort of error. */
394 if (status & SEEQ_TSTAT_R16)
395 sp->stats.tx_aborted_errors++;
396 if (status & SEEQ_TSTAT_UFLOW)
397 sp->stats.tx_fifo_errors++;
398 if (status & SEEQ_TSTAT_LCLS)
399 sp->stats.collisions++;
403 for (j = sp->tx_old; j != sp->tx_new; j = NEXT_TX(j)) {
404 td = &sp->tx_desc[j];
406 if (!(td->tdma.cntinfo & (HPCDMA_XIU)))
408 if (!(td->tdma.cntinfo & (HPCDMA_ETXD))) {
409 if (!(status & HPC3_ETXCTRL_ACTIVE)) {
410 hregs->tx_ndptr = CPHYSADDR(td);
411 hregs->tx_ctrl = HPC3_ETXCTRL_ACTIVE;
415 sp->stats.tx_packets++;
416 sp->tx_old = NEXT_TX(sp->tx_old);
417 td->tdma.cntinfo &= ~(HPCDMA_XIU | HPCDMA_XIE);
418 td->tdma.cntinfo |= HPCDMA_EOX;
422 static irqreturn_t sgiseeq_interrupt(int irq, void *dev_id)
424 struct net_device *dev = (struct net_device *) dev_id;
425 struct sgiseeq_private *sp = netdev_priv(dev);
426 struct hpc3_ethregs *hregs = sp->hregs;
427 struct sgiseeq_regs *sregs = sp->sregs;
429 spin_lock(&sp->tx_lock);
431 /* Ack the IRQ and set software state. */
432 hregs->reset = HPC3_ERST_CLRIRQ;
434 /* Always check for received packets. */
435 sgiseeq_rx(dev, sp, hregs, sregs);
437 /* Only check for tx acks if we have something queued. */
438 if (sp->tx_old != sp->tx_new)
439 sgiseeq_tx(dev, sp, hregs, sregs);
441 if ((TX_BUFFS_AVAIL(sp) > 0) && netif_queue_stopped(dev)) {
442 netif_wake_queue(dev);
444 spin_unlock(&sp->tx_lock);
449 static int sgiseeq_open(struct net_device *dev)
451 struct sgiseeq_private *sp = netdev_priv(dev);
452 struct sgiseeq_regs *sregs = sp->sregs;
453 unsigned int irq = dev->irq;
456 if (request_irq(irq, sgiseeq_interrupt, 0, sgiseeqstr, dev)) {
457 printk(KERN_ERR "Seeq8003: Can't get irq %d\n", dev->irq);
461 err = init_seeq(dev, sp, sregs);
465 netif_start_queue(dev);
475 static int sgiseeq_close(struct net_device *dev)
477 struct sgiseeq_private *sp = netdev_priv(dev);
478 struct sgiseeq_regs *sregs = sp->sregs;
479 unsigned int irq = dev->irq;
481 netif_stop_queue(dev);
483 /* Shutdown the Seeq. */
484 reset_hpc3_and_seeq(sp->hregs, sregs);
490 static inline int sgiseeq_reset(struct net_device *dev)
492 struct sgiseeq_private *sp = netdev_priv(dev);
493 struct sgiseeq_regs *sregs = sp->sregs;
496 err = init_seeq(dev, sp, sregs);
500 dev->trans_start = jiffies;
501 netif_wake_queue(dev);
506 static int sgiseeq_start_xmit(struct sk_buff *skb, struct net_device *dev)
508 struct sgiseeq_private *sp = netdev_priv(dev);
509 struct hpc3_ethregs *hregs = sp->hregs;
511 struct sgiseeq_tx_desc *td;
512 int skblen, len, entry;
514 spin_lock_irqsave(&sp->tx_lock, flags);
518 len = (skblen <= ETH_ZLEN) ? ETH_ZLEN : skblen;
519 sp->stats.tx_bytes += len;
521 td = &sp->tx_desc[entry];
523 /* Create entry. There are so many races with adding a new
524 * descriptor to the chain:
525 * 1) Assume that the HPC is off processing a DMA chain while
526 * we are changing all of the following.
527 * 2) Do no allow the HPC to look at a new descriptor until
528 * we have completely set up it's state. This means, do
529 * not clear HPCDMA_EOX in the current last descritptor
530 * until the one we are adding looks consistent and could
531 * be processes right now.
532 * 3) The tx interrupt code must notice when we've added a new
533 * entry and the HPC got to the end of the chain before we
534 * added this new entry and restarted it.
536 skb_copy_from_linear_data(skb, (char *)(long)td->buf_vaddr, skblen);
538 memset((char *)(long)td->buf_vaddr + skb->len, 0, len-skblen);
539 td->tdma.cntinfo = (len & HPCDMA_BCNT) |
540 HPCDMA_XIU | HPCDMA_EOXP | HPCDMA_XIE | HPCDMA_EOX;
541 if (sp->tx_old != sp->tx_new) {
542 struct sgiseeq_tx_desc *backend;
544 backend = &sp->tx_desc[PREV_TX(sp->tx_new)];
545 backend->tdma.cntinfo &= ~HPCDMA_EOX;
547 sp->tx_new = NEXT_TX(sp->tx_new); /* Advance. */
549 /* Maybe kick the HPC back into motion. */
550 if (!(hregs->tx_ctrl & HPC3_ETXCTRL_ACTIVE))
551 kick_tx(&sp->tx_desc[sp->tx_old], hregs);
553 dev->trans_start = jiffies;
556 if (!TX_BUFFS_AVAIL(sp))
557 netif_stop_queue(dev);
558 spin_unlock_irqrestore(&sp->tx_lock, flags);
563 static void timeout(struct net_device *dev)
565 printk(KERN_NOTICE "%s: transmit timed out, resetting\n", dev->name);
568 dev->trans_start = jiffies;
569 netif_wake_queue(dev);
572 static struct net_device_stats *sgiseeq_get_stats(struct net_device *dev)
574 struct sgiseeq_private *sp = netdev_priv(dev);
579 static void sgiseeq_set_multicast(struct net_device *dev)
581 struct sgiseeq_private *sp = (struct sgiseeq_private *) dev->priv;
582 unsigned char oldmode = sp->mode;
584 if(dev->flags & IFF_PROMISC)
585 sp->mode = SEEQ_RCMD_RANY;
586 else if ((dev->flags & IFF_ALLMULTI) || dev->mc_count)
587 sp->mode = SEEQ_RCMD_RBMCAST;
589 sp->mode = SEEQ_RCMD_RBCAST;
591 /* XXX I know this sucks, but is there a better way to reprogram
592 * XXX the receiver? At least, this shouldn't happen too often.
595 if (oldmode != sp->mode)
599 static inline void setup_tx_ring(struct sgiseeq_tx_desc *buf, int nbufs)
603 while (i < (nbufs - 1)) {
604 buf[i].tdma.pnext = CPHYSADDR(buf + i + 1);
605 buf[i].tdma.pbuf = 0;
608 buf[i].tdma.pnext = CPHYSADDR(buf);
611 static inline void setup_rx_ring(struct sgiseeq_rx_desc *buf, int nbufs)
615 while (i < (nbufs - 1)) {
616 buf[i].rdma.pnext = CPHYSADDR(buf + i + 1);
617 buf[i].rdma.pbuf = 0;
620 buf[i].rdma.pbuf = 0;
621 buf[i].rdma.pnext = CPHYSADDR(buf);
624 #define ALIGNED(x) ((((unsigned long)(x)) + 0xf) & ~(0xf))
626 static int __init sgiseeq_probe(struct platform_device *pdev)
628 struct sgiseeq_platform_data *pd = pdev->dev.platform_data;
629 struct hpc3_regs *hpcregs = pd->hpc;
630 struct sgiseeq_init_block *sr;
631 unsigned int irq = pd->irq;
632 struct sgiseeq_private *sp;
633 struct net_device *dev;
636 dev = alloc_etherdev(sizeof (struct sgiseeq_private));
638 printk(KERN_ERR "Sgiseeq: Etherdev alloc failed, aborting.\n");
643 platform_set_drvdata(pdev, dev);
644 sp = netdev_priv(dev);
646 /* Make private data page aligned */
647 sr = dma_alloc_coherent(&pdev->dev, sizeof(*sp->srings),
648 &sp->srings_dma, GFP_KERNEL);
650 printk(KERN_ERR "Sgiseeq: Page alloc failed, aborting.\n");
652 goto err_out_free_dev;
655 sp->rx_desc = sp->srings->rxvector;
656 sp->tx_desc = sp->srings->txvector;
658 /* A couple calculations now, saves many cycles later. */
659 setup_rx_ring(sp->rx_desc, SEEQ_RX_BUFFERS);
660 setup_tx_ring(sp->tx_desc, SEEQ_TX_BUFFERS);
662 memcpy(dev->dev_addr, pd->mac, ETH_ALEN);
668 sp->sregs = (struct sgiseeq_regs *) &hpcregs->eth_ext[0];
669 sp->hregs = &hpcregs->ethregs;
670 sp->name = sgiseeqstr;
671 sp->mode = SEEQ_RCMD_RBCAST;
673 /* Setup PIO and DMA transfer timing */
674 sp->hregs->pconfig = 0x161;
675 sp->hregs->dconfig = HPC3_EDCFG_FIRQ | HPC3_EDCFG_FEOP |
676 HPC3_EDCFG_FRXDC | HPC3_EDCFG_PTO | 0x026;
678 /* Setup PIO and DMA transfer timing */
679 sp->hregs->pconfig = 0x161;
680 sp->hregs->dconfig = HPC3_EDCFG_FIRQ | HPC3_EDCFG_FEOP |
681 HPC3_EDCFG_FRXDC | HPC3_EDCFG_PTO | 0x026;
683 /* Reset the chip. */
684 hpc3_eth_reset(sp->hregs);
686 sp->is_edlc = !(sp->sregs->rw.rregs.collision_tx[0] & 0xff);
688 sp->control = SEEQ_CTRL_XCNT | SEEQ_CTRL_ACCNT |
689 SEEQ_CTRL_SFLAG | SEEQ_CTRL_ESHORT |
692 dev->open = sgiseeq_open;
693 dev->stop = sgiseeq_close;
694 dev->hard_start_xmit = sgiseeq_start_xmit;
695 dev->tx_timeout = timeout;
696 dev->watchdog_timeo = (200 * HZ) / 1000;
697 dev->get_stats = sgiseeq_get_stats;
698 dev->set_multicast_list = sgiseeq_set_multicast;
699 dev->set_mac_address = sgiseeq_set_mac_address;
702 if (register_netdev(dev)) {
703 printk(KERN_ERR "Sgiseeq: Cannot register net device, "
706 goto err_out_free_page;
709 printk(KERN_INFO "%s: %s ", dev->name, sgiseeqstr);
710 for (i = 0; i < 6; i++)
711 printk("%2.2x%c", dev->dev_addr[i], i == 5 ? '\n' : ':');
716 free_page((unsigned long) sp->srings);
724 static int __exit sgiseeq_remove(struct platform_device *pdev)
726 struct net_device *dev = platform_get_drvdata(pdev);
727 struct sgiseeq_private *sp = netdev_priv(dev);
729 unregister_netdev(dev);
730 dma_free_coherent(&pdev->dev, sizeof(*sp->srings), sp->srings,
733 platform_set_drvdata(pdev, NULL);
738 static struct platform_driver sgiseeq_driver = {
739 .probe = sgiseeq_probe,
740 .remove = __devexit_p(sgiseeq_remove),
746 static int __init sgiseeq_module_init(void)
748 if (platform_driver_register(&sgiseeq_driver)) {
749 printk(KERN_ERR "Driver registration failed\n");
756 static void __exit sgiseeq_module_exit(void)
758 platform_driver_unregister(&sgiseeq_driver);
761 module_init(sgiseeq_module_init);
762 module_exit(sgiseeq_module_exit);
764 MODULE_DESCRIPTION("SGI Seeq 8003 driver");
765 MODULE_AUTHOR("Linux/MIPS Mailing List <linux-mips@linux-mips.org>");
766 MODULE_LICENSE("GPL");