2 * sgiseeq.c: Seeq8003 ethernet driver for SGI machines.
4 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
6 #include <linux/kernel.h>
7 #include <linux/module.h>
8 #include <linux/errno.h>
9 #include <linux/init.h>
10 #include <linux/types.h>
11 #include <linux/interrupt.h>
12 #include <linux/ioport.h>
13 #include <linux/socket.h>
15 #include <linux/route.h>
16 #include <linux/slab.h>
17 #include <linux/string.h>
18 #include <linux/delay.h>
19 #include <linux/netdevice.h>
20 #include <linux/etherdevice.h>
21 #include <linux/skbuff.h>
22 #include <linux/bitops.h>
24 #include <asm/byteorder.h>
26 #include <asm/system.h>
28 #include <asm/pgtable.h>
29 #include <asm/sgi/hpc3.h>
30 #include <asm/sgi/ip22.h>
31 #include <asm/sgialib.h>
35 static char *sgiseeqstr = "SGI Seeq8003";
38 * If you want speed, you do something silly, it always has worked for me. So,
39 * with that in mind, I've decided to make this driver look completely like a
40 * stupid Lance from a driver architecture perspective. Only difference is that
41 * here our "ring buffer" looks and acts like a real Lance one does but is
42 * layed out like how the HPC DMA and the Seeq want it to. You'd be surprised
43 * how a stupid idea like this can pay off in performance, not to mention
44 * making this driver 2,000 times easier to write. ;-)
47 /* Tune these if we tend to run out often etc. */
48 #define SEEQ_RX_BUFFERS 16
49 #define SEEQ_TX_BUFFERS 16
51 #define PKT_BUF_SZ 1584
53 #define NEXT_RX(i) (((i) + 1) & (SEEQ_RX_BUFFERS - 1))
54 #define NEXT_TX(i) (((i) + 1) & (SEEQ_TX_BUFFERS - 1))
55 #define PREV_RX(i) (((i) - 1) & (SEEQ_RX_BUFFERS - 1))
56 #define PREV_TX(i) (((i) - 1) & (SEEQ_TX_BUFFERS - 1))
58 #define TX_BUFFS_AVAIL(sp) ((sp->tx_old <= sp->tx_new) ? \
59 sp->tx_old + (SEEQ_TX_BUFFERS - 1) - sp->tx_new : \
60 sp->tx_old - sp->tx_new - 1)
64 struct sgiseeq_rx_desc {
65 volatile struct hpc_dma_desc rdma;
66 volatile signed int buf_vaddr;
69 struct sgiseeq_tx_desc {
70 volatile struct hpc_dma_desc tdma;
71 volatile signed int buf_vaddr;
75 * Warning: This structure is layed out in a certain way because HPC dma
76 * descriptors must be 8-byte aligned. So don't touch this without
79 struct sgiseeq_init_block { /* Note the name ;-) */
80 struct sgiseeq_rx_desc rxvector[SEEQ_RX_BUFFERS];
81 struct sgiseeq_tx_desc txvector[SEEQ_TX_BUFFERS];
84 struct sgiseeq_private {
85 struct sgiseeq_init_block *srings;
87 /* Ptrs to the descriptors in uncached space. */
88 struct sgiseeq_rx_desc *rx_desc;
89 struct sgiseeq_tx_desc *tx_desc;
92 struct hpc3_ethregs *hregs;
93 struct sgiseeq_regs *sregs;
95 /* Ring entry counters. */
96 unsigned int rx_new, tx_new;
97 unsigned int rx_old, tx_old;
100 unsigned char control;
103 struct net_device_stats stats;
105 struct net_device *next_module;
109 /* A list of all installed seeq devices, for removing the driver module. */
110 static struct net_device *root_sgiseeq_dev;
112 static inline void hpc3_eth_reset(struct hpc3_ethregs *hregs)
114 hregs->reset = HPC3_ERST_CRESET | HPC3_ERST_CLRIRQ;
119 static inline void reset_hpc3_and_seeq(struct hpc3_ethregs *hregs,
120 struct sgiseeq_regs *sregs)
122 hregs->rx_ctrl = hregs->tx_ctrl = 0;
123 hpc3_eth_reset(hregs);
126 #define RSTAT_GO_BITS (SEEQ_RCMD_IGOOD | SEEQ_RCMD_IEOF | SEEQ_RCMD_ISHORT | \
127 SEEQ_RCMD_IDRIB | SEEQ_RCMD_ICRC)
129 static inline void seeq_go(struct sgiseeq_private *sp,
130 struct hpc3_ethregs *hregs,
131 struct sgiseeq_regs *sregs)
133 sregs->rstat = sp->mode | RSTAT_GO_BITS;
134 hregs->rx_ctrl = HPC3_ERXCTRL_ACTIVE;
137 static inline void __sgiseeq_set_mac_address(struct net_device *dev)
139 struct sgiseeq_private *sp = netdev_priv(dev);
140 struct sgiseeq_regs *sregs = sp->sregs;
143 sregs->tstat = SEEQ_TCMD_RB0;
144 for (i = 0; i < 6; i++)
145 sregs->rw.eth_addr[i] = dev->dev_addr[i];
148 static int sgiseeq_set_mac_address(struct net_device *dev, void *addr)
150 struct sgiseeq_private *sp = netdev_priv(dev);
151 struct sockaddr *sa = addr;
153 memcpy(dev->dev_addr, sa->sa_data, dev->addr_len);
155 spin_lock_irq(&sp->tx_lock);
156 __sgiseeq_set_mac_address(dev);
157 spin_unlock_irq(&sp->tx_lock);
162 #define TCNTINFO_INIT (HPCDMA_EOX | HPCDMA_ETXD)
163 #define RCNTCFG_INIT (HPCDMA_OWN | HPCDMA_EORP | HPCDMA_XIE)
164 #define RCNTINFO_INIT (RCNTCFG_INIT | (PKT_BUF_SZ & HPCDMA_BCNT))
166 static int seeq_init_ring(struct net_device *dev)
168 struct sgiseeq_private *sp = netdev_priv(dev);
171 netif_stop_queue(dev);
172 sp->rx_new = sp->tx_new = 0;
173 sp->rx_old = sp->tx_old = 0;
175 __sgiseeq_set_mac_address(dev);
178 for(i = 0; i < SEEQ_TX_BUFFERS; i++) {
179 if (!sp->tx_desc[i].tdma.pbuf) {
180 unsigned long buffer;
182 buffer = (unsigned long) kmalloc(PKT_BUF_SZ, GFP_KERNEL);
185 sp->tx_desc[i].buf_vaddr = CKSEG1ADDR(buffer);
186 sp->tx_desc[i].tdma.pbuf = CPHYSADDR(buffer);
188 sp->tx_desc[i].tdma.cntinfo = TCNTINFO_INIT;
191 /* And now the rx ring. */
192 for (i = 0; i < SEEQ_RX_BUFFERS; i++) {
193 if (!sp->rx_desc[i].rdma.pbuf) {
194 unsigned long buffer;
196 buffer = (unsigned long) kmalloc(PKT_BUF_SZ, GFP_KERNEL);
199 sp->rx_desc[i].buf_vaddr = CKSEG1ADDR(buffer);
200 sp->rx_desc[i].rdma.pbuf = CPHYSADDR(buffer);
202 sp->rx_desc[i].rdma.cntinfo = RCNTINFO_INIT;
204 sp->rx_desc[i - 1].rdma.cntinfo |= HPCDMA_EOR;
209 static struct sgiseeq_private *gpriv;
210 static struct net_device *gdev;
212 void sgiseeq_dump_rings(void)
215 struct sgiseeq_rx_desc *r = gpriv->rx_desc;
216 struct sgiseeq_tx_desc *t = gpriv->tx_desc;
217 struct hpc3_ethregs *hregs = gpriv->hregs;
223 printk("RING DUMP:\n");
224 for (i = 0; i < SEEQ_RX_BUFFERS; i++) {
225 printk("RX [%d]: @(%p) [%08x,%08x,%08x] ",
226 i, (&r[i]), r[i].rdma.pbuf, r[i].rdma.cntinfo,
229 printk("-- [%d]: @(%p) [%08x,%08x,%08x]\n",
230 i, (&r[i]), r[i].rdma.pbuf, r[i].rdma.cntinfo,
233 for (i = 0; i < SEEQ_TX_BUFFERS; i++) {
234 printk("TX [%d]: @(%p) [%08x,%08x,%08x] ",
235 i, (&t[i]), t[i].tdma.pbuf, t[i].tdma.cntinfo,
238 printk("-- [%d]: @(%p) [%08x,%08x,%08x]\n",
239 i, (&t[i]), t[i].tdma.pbuf, t[i].tdma.cntinfo,
242 printk("INFO: [rx_new = %d rx_old=%d] [tx_new = %d tx_old = %d]\n",
243 gpriv->rx_new, gpriv->rx_old, gpriv->tx_new, gpriv->tx_old);
244 printk("RREGS: rx_cbptr[%08x] rx_ndptr[%08x] rx_ctrl[%08x]\n",
245 hregs->rx_cbptr, hregs->rx_ndptr, hregs->rx_ctrl);
246 printk("TREGS: tx_cbptr[%08x] tx_ndptr[%08x] tx_ctrl[%08x]\n",
247 hregs->tx_cbptr, hregs->tx_ndptr, hregs->tx_ctrl);
251 #define TSTAT_INIT_SEEQ (SEEQ_TCMD_IPT|SEEQ_TCMD_I16|SEEQ_TCMD_IC|SEEQ_TCMD_IUF)
252 #define TSTAT_INIT_EDLC ((TSTAT_INIT_SEEQ) | SEEQ_TCMD_RB2)
254 static int init_seeq(struct net_device *dev, struct sgiseeq_private *sp,
255 struct sgiseeq_regs *sregs)
257 struct hpc3_ethregs *hregs = sp->hregs;
260 reset_hpc3_and_seeq(hregs, sregs);
261 err = seeq_init_ring(dev);
265 /* Setup to field the proper interrupt types. */
267 sregs->tstat = TSTAT_INIT_EDLC;
268 sregs->rw.wregs.control = sp->control;
269 sregs->rw.wregs.frame_gap = 0;
271 sregs->tstat = TSTAT_INIT_SEEQ;
274 hregs->rx_ndptr = CPHYSADDR(sp->rx_desc);
275 hregs->tx_ndptr = CPHYSADDR(sp->tx_desc);
277 seeq_go(sp, hregs, sregs);
281 static inline void record_rx_errors(struct sgiseeq_private *sp,
282 unsigned char status)
284 if (status & SEEQ_RSTAT_OVERF ||
285 status & SEEQ_RSTAT_SFRAME)
286 sp->stats.rx_over_errors++;
287 if (status & SEEQ_RSTAT_CERROR)
288 sp->stats.rx_crc_errors++;
289 if (status & SEEQ_RSTAT_DERROR)
290 sp->stats.rx_frame_errors++;
291 if (status & SEEQ_RSTAT_REOF)
292 sp->stats.rx_errors++;
295 static inline void rx_maybe_restart(struct sgiseeq_private *sp,
296 struct hpc3_ethregs *hregs,
297 struct sgiseeq_regs *sregs)
299 if (!(hregs->rx_ctrl & HPC3_ERXCTRL_ACTIVE)) {
300 hregs->rx_ndptr = CPHYSADDR(sp->rx_desc + sp->rx_new);
301 seeq_go(sp, hregs, sregs);
305 #define for_each_rx(rd, sp) for((rd) = &(sp)->rx_desc[(sp)->rx_new]; \
306 !((rd)->rdma.cntinfo & HPCDMA_OWN); \
307 (rd) = &(sp)->rx_desc[(sp)->rx_new])
309 static inline void sgiseeq_rx(struct net_device *dev, struct sgiseeq_private *sp,
310 struct hpc3_ethregs *hregs,
311 struct sgiseeq_regs *sregs)
313 struct sgiseeq_rx_desc *rd;
314 struct sk_buff *skb = 0;
315 unsigned char pkt_status;
316 unsigned char *pkt_pointer = 0;
318 unsigned int orig_end = PREV_RX(sp->rx_new);
320 /* Service every received packet. */
321 for_each_rx(rd, sp) {
322 len = PKT_BUF_SZ - (rd->rdma.cntinfo & HPCDMA_BCNT) - 3;
323 pkt_pointer = (unsigned char *)(long)rd->buf_vaddr;
324 pkt_status = pkt_pointer[len + 2];
326 if (pkt_status & SEEQ_RSTAT_FIG) {
328 skb = dev_alloc_skb(len + 2);
335 /* Copy out of kseg1 to avoid silly cache flush. */
336 eth_copy_and_sum(skb, pkt_pointer + 2, len, 0);
337 skb->protocol = eth_type_trans(skb, dev);
339 /* We don't want to receive our own packets */
340 if (memcmp(eth_hdr(skb)->h_source, dev->dev_addr, ETH_ALEN)) {
342 dev->last_rx = jiffies;
343 sp->stats.rx_packets++;
344 sp->stats.rx_bytes += len;
346 /* Silently drop my own packets */
347 dev_kfree_skb_irq(skb);
350 printk (KERN_NOTICE "%s: Memory squeeze, deferring packet.\n",
352 sp->stats.rx_dropped++;
355 record_rx_errors(sp, pkt_status);
358 /* Return the entry to the ring pool. */
359 rd->rdma.cntinfo = RCNTINFO_INIT;
360 sp->rx_new = NEXT_RX(sp->rx_new);
362 sp->rx_desc[orig_end].rdma.cntinfo &= ~(HPCDMA_EOR);
363 sp->rx_desc[PREV_RX(sp->rx_new)].rdma.cntinfo |= HPCDMA_EOR;
364 rx_maybe_restart(sp, hregs, sregs);
367 static inline void tx_maybe_reset_collisions(struct sgiseeq_private *sp,
368 struct sgiseeq_regs *sregs)
371 sregs->rw.wregs.control = sp->control & ~(SEEQ_CTRL_XCNT);
372 sregs->rw.wregs.control = sp->control;
376 static inline void kick_tx(struct sgiseeq_tx_desc *td,
377 struct hpc3_ethregs *hregs)
379 /* If the HPC aint doin nothin, and there are more packets
380 * with ETXD cleared and XIU set we must make very certain
381 * that we restart the HPC else we risk locking up the
382 * adapter. The following code is only safe iff the HPCDMA
385 while ((td->tdma.cntinfo & (HPCDMA_XIU | HPCDMA_ETXD)) ==
386 (HPCDMA_XIU | HPCDMA_ETXD))
387 td = (struct sgiseeq_tx_desc *)(long) CKSEG1ADDR(td->tdma.pnext);
388 if (td->tdma.cntinfo & HPCDMA_XIU) {
389 hregs->tx_ndptr = CPHYSADDR(td);
390 hregs->tx_ctrl = HPC3_ETXCTRL_ACTIVE;
394 static inline void sgiseeq_tx(struct net_device *dev, struct sgiseeq_private *sp,
395 struct hpc3_ethregs *hregs,
396 struct sgiseeq_regs *sregs)
398 struct sgiseeq_tx_desc *td;
399 unsigned long status = hregs->tx_ctrl;
402 tx_maybe_reset_collisions(sp, sregs);
404 if (!(status & (HPC3_ETXCTRL_ACTIVE | SEEQ_TSTAT_PTRANS))) {
405 /* Oops, HPC detected some sort of error. */
406 if (status & SEEQ_TSTAT_R16)
407 sp->stats.tx_aborted_errors++;
408 if (status & SEEQ_TSTAT_UFLOW)
409 sp->stats.tx_fifo_errors++;
410 if (status & SEEQ_TSTAT_LCLS)
411 sp->stats.collisions++;
415 for (j = sp->tx_old; j != sp->tx_new; j = NEXT_TX(j)) {
416 td = &sp->tx_desc[j];
418 if (!(td->tdma.cntinfo & (HPCDMA_XIU)))
420 if (!(td->tdma.cntinfo & (HPCDMA_ETXD))) {
421 if (!(status & HPC3_ETXCTRL_ACTIVE)) {
422 hregs->tx_ndptr = CPHYSADDR(td);
423 hregs->tx_ctrl = HPC3_ETXCTRL_ACTIVE;
427 sp->stats.tx_packets++;
428 sp->tx_old = NEXT_TX(sp->tx_old);
429 td->tdma.cntinfo &= ~(HPCDMA_XIU | HPCDMA_XIE);
430 td->tdma.cntinfo |= HPCDMA_EOX;
434 static irqreturn_t sgiseeq_interrupt(int irq, void *dev_id, struct pt_regs *regs)
436 struct net_device *dev = (struct net_device *) dev_id;
437 struct sgiseeq_private *sp = netdev_priv(dev);
438 struct hpc3_ethregs *hregs = sp->hregs;
439 struct sgiseeq_regs *sregs = sp->sregs;
441 spin_lock(&sp->tx_lock);
443 /* Ack the IRQ and set software state. */
444 hregs->reset = HPC3_ERST_CLRIRQ;
446 /* Always check for received packets. */
447 sgiseeq_rx(dev, sp, hregs, sregs);
449 /* Only check for tx acks if we have something queued. */
450 if (sp->tx_old != sp->tx_new)
451 sgiseeq_tx(dev, sp, hregs, sregs);
453 if ((TX_BUFFS_AVAIL(sp) > 0) && netif_queue_stopped(dev)) {
454 netif_wake_queue(dev);
456 spin_unlock(&sp->tx_lock);
461 static int sgiseeq_open(struct net_device *dev)
463 struct sgiseeq_private *sp = netdev_priv(dev);
464 struct sgiseeq_regs *sregs = sp->sregs;
465 unsigned int irq = dev->irq;
468 if (request_irq(irq, sgiseeq_interrupt, 0, sgiseeqstr, dev)) {
469 printk(KERN_ERR "Seeq8003: Can't get irq %d\n", dev->irq);
473 err = init_seeq(dev, sp, sregs);
477 netif_start_queue(dev);
487 static int sgiseeq_close(struct net_device *dev)
489 struct sgiseeq_private *sp = netdev_priv(dev);
490 struct sgiseeq_regs *sregs = sp->sregs;
491 unsigned int irq = dev->irq;
493 netif_stop_queue(dev);
495 /* Shutdown the Seeq. */
496 reset_hpc3_and_seeq(sp->hregs, sregs);
502 static inline int sgiseeq_reset(struct net_device *dev)
504 struct sgiseeq_private *sp = netdev_priv(dev);
505 struct sgiseeq_regs *sregs = sp->sregs;
508 err = init_seeq(dev, sp, sregs);
512 dev->trans_start = jiffies;
513 netif_wake_queue(dev);
518 void sgiseeq_my_reset(void)
524 static int sgiseeq_start_xmit(struct sk_buff *skb, struct net_device *dev)
526 struct sgiseeq_private *sp = netdev_priv(dev);
527 struct hpc3_ethregs *hregs = sp->hregs;
529 struct sgiseeq_tx_desc *td;
530 int skblen, len, entry;
532 spin_lock_irqsave(&sp->tx_lock, flags);
536 len = (skblen <= ETH_ZLEN) ? ETH_ZLEN : skblen;
537 sp->stats.tx_bytes += len;
539 td = &sp->tx_desc[entry];
541 /* Create entry. There are so many races with adding a new
542 * descriptor to the chain:
543 * 1) Assume that the HPC is off processing a DMA chain while
544 * we are changing all of the following.
545 * 2) Do no allow the HPC to look at a new descriptor until
546 * we have completely set up it's state. This means, do
547 * not clear HPCDMA_EOX in the current last descritptor
548 * until the one we are adding looks consistent and could
549 * be processes right now.
550 * 3) The tx interrupt code must notice when we've added a new
551 * entry and the HPC got to the end of the chain before we
552 * added this new entry and restarted it.
554 memcpy((char *)(long)td->buf_vaddr, skb->data, skblen);
556 memset((char *)(long)td->buf_vaddr + skb->len, 0, len-skblen);
557 td->tdma.cntinfo = (len & HPCDMA_BCNT) |
558 HPCDMA_XIU | HPCDMA_EOXP | HPCDMA_XIE | HPCDMA_EOX;
559 if (sp->tx_old != sp->tx_new) {
560 struct sgiseeq_tx_desc *backend;
562 backend = &sp->tx_desc[PREV_TX(sp->tx_new)];
563 backend->tdma.cntinfo &= ~HPCDMA_EOX;
565 sp->tx_new = NEXT_TX(sp->tx_new); /* Advance. */
567 /* Maybe kick the HPC back into motion. */
568 if (!(hregs->tx_ctrl & HPC3_ETXCTRL_ACTIVE))
569 kick_tx(&sp->tx_desc[sp->tx_old], hregs);
571 dev->trans_start = jiffies;
574 if (!TX_BUFFS_AVAIL(sp))
575 netif_stop_queue(dev);
576 spin_unlock_irqrestore(&sp->tx_lock, flags);
581 static void timeout(struct net_device *dev)
583 printk(KERN_NOTICE "%s: transmit timed out, resetting\n", dev->name);
586 dev->trans_start = jiffies;
587 netif_wake_queue(dev);
590 static struct net_device_stats *sgiseeq_get_stats(struct net_device *dev)
592 struct sgiseeq_private *sp = netdev_priv(dev);
597 static void sgiseeq_set_multicast(struct net_device *dev)
599 struct sgiseeq_private *sp = (struct sgiseeq_private *) dev->priv;
600 unsigned char oldmode = sp->mode;
602 if(dev->flags & IFF_PROMISC)
603 sp->mode = SEEQ_RCMD_RANY;
604 else if ((dev->flags & IFF_ALLMULTI) || dev->mc_count)
605 sp->mode = SEEQ_RCMD_RBMCAST;
607 sp->mode = SEEQ_RCMD_RBCAST;
609 /* XXX I know this sucks, but is there a better way to reprogram
610 * XXX the receiver? At least, this shouldn't happen too often.
613 if (oldmode != sp->mode)
617 static inline void setup_tx_ring(struct sgiseeq_tx_desc *buf, int nbufs)
621 while (i < (nbufs - 1)) {
622 buf[i].tdma.pnext = CPHYSADDR(buf + i + 1);
623 buf[i].tdma.pbuf = 0;
626 buf[i].tdma.pnext = CPHYSADDR(buf);
629 static inline void setup_rx_ring(struct sgiseeq_rx_desc *buf, int nbufs)
633 while (i < (nbufs - 1)) {
634 buf[i].rdma.pnext = CPHYSADDR(buf + i + 1);
635 buf[i].rdma.pbuf = 0;
638 buf[i].rdma.pbuf = 0;
639 buf[i].rdma.pnext = CPHYSADDR(buf);
642 #define ALIGNED(x) ((((unsigned long)(x)) + 0xf) & ~(0xf))
644 static int sgiseeq_init(struct hpc3_regs* hpcregs, int irq)
646 struct sgiseeq_init_block *sr;
647 struct sgiseeq_private *sp;
648 struct net_device *dev;
651 dev = alloc_etherdev(sizeof (struct sgiseeq_private));
653 printk(KERN_ERR "Sgiseeq: Etherdev alloc failed, aborting.\n");
657 sp = netdev_priv(dev);
659 /* Make private data page aligned */
660 sr = (struct sgiseeq_init_block *) get_zeroed_page(GFP_KERNEL);
662 printk(KERN_ERR "Sgiseeq: Page alloc failed, aborting.\n");
664 goto err_out_free_dev;
668 #define EADDR_NVOFS 250
669 for (i = 0; i < 3; i++) {
670 unsigned short tmp = ip22_nvram_read(EADDR_NVOFS / 2 + i);
672 dev->dev_addr[2 * i] = tmp >> 8;
673 dev->dev_addr[2 * i + 1] = tmp & 0xff;
680 sp->sregs = (struct sgiseeq_regs *) &hpcregs->eth_ext[0];
681 sp->hregs = &hpcregs->ethregs;
682 sp->name = sgiseeqstr;
683 sp->mode = SEEQ_RCMD_RBCAST;
685 sp->rx_desc = (struct sgiseeq_rx_desc *)
686 CKSEG1ADDR(ALIGNED(&sp->srings->rxvector[0]));
687 dma_cache_wback_inv((unsigned long)&sp->srings->rxvector,
688 sizeof(sp->srings->rxvector));
689 sp->tx_desc = (struct sgiseeq_tx_desc *)
690 CKSEG1ADDR(ALIGNED(&sp->srings->txvector[0]));
691 dma_cache_wback_inv((unsigned long)&sp->srings->txvector,
692 sizeof(sp->srings->txvector));
694 /* A couple calculations now, saves many cycles later. */
695 setup_rx_ring(sp->rx_desc, SEEQ_RX_BUFFERS);
696 setup_tx_ring(sp->tx_desc, SEEQ_TX_BUFFERS);
698 /* Setup PIO and DMA transfer timing */
699 sp->hregs->pconfig = 0x161;
700 sp->hregs->dconfig = HPC3_EDCFG_FIRQ | HPC3_EDCFG_FEOP |
701 HPC3_EDCFG_FRXDC | HPC3_EDCFG_PTO | 0x026;
703 /* Reset the chip. */
704 hpc3_eth_reset(sp->hregs);
706 sp->is_edlc = !(sp->sregs->rw.rregs.collision_tx[0] & 0xff);
708 sp->control = SEEQ_CTRL_XCNT | SEEQ_CTRL_ACCNT |
709 SEEQ_CTRL_SFLAG | SEEQ_CTRL_ESHORT |
712 dev->open = sgiseeq_open;
713 dev->stop = sgiseeq_close;
714 dev->hard_start_xmit = sgiseeq_start_xmit;
715 dev->tx_timeout = timeout;
716 dev->watchdog_timeo = (200 * HZ) / 1000;
717 dev->get_stats = sgiseeq_get_stats;
718 dev->set_multicast_list = sgiseeq_set_multicast;
719 dev->set_mac_address = sgiseeq_set_mac_address;
722 if (register_netdev(dev)) {
723 printk(KERN_ERR "Sgiseeq: Cannot register net device, "
726 goto err_out_free_page;
729 printk(KERN_INFO "%s: %s ", dev->name, sgiseeqstr);
730 for (i = 0; i < 6; i++)
731 printk("%2.2x%c", dev->dev_addr[i], i == 5 ? '\n' : ':');
733 sp->next_module = root_sgiseeq_dev;
734 root_sgiseeq_dev = dev;
739 free_page((unsigned long) sp->srings);
747 static int __init sgiseeq_probe(void)
749 /* On board adapter on 1st HPC is always present */
750 return sgiseeq_init(hpc3c0, SGI_ENET_IRQ);
753 static void __exit sgiseeq_exit(void)
755 struct net_device *next, *dev;
756 struct sgiseeq_private *sp;
758 for (dev = root_sgiseeq_dev; dev; dev = next) {
759 sp = (struct sgiseeq_private *) netdev_priv(dev);
760 next = sp->next_module;
761 unregister_netdev(dev);
762 free_page((unsigned long) sp->srings);
767 module_init(sgiseeq_probe);
768 module_exit(sgiseeq_exit);
770 MODULE_DESCRIPTION("SGI Seeq 8003 driver");
771 MODULE_AUTHOR("Linux/MIPS Mailing List <linux-mips@linux-mips.org>");
772 MODULE_LICENSE("GPL");