aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/seeq8005.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/seeq8005.c')
-rw-r--r--drivers/net/seeq8005.c98
1 files changed, 49 insertions, 49 deletions
diff --git a/drivers/net/seeq8005.c b/drivers/net/seeq8005.c
index 01392bca0223..20afdc7f2b97 100644
--- a/drivers/net/seeq8005.c
+++ b/drivers/net/seeq8005.c
@@ -20,7 +20,7 @@ static const char version[] =
20/* 20/*
21 Sources: 21 Sources:
22 SEEQ 8005 databook 22 SEEQ 8005 databook
23 23
24 Version history: 24 Version history:
25 1.00 Public release. cosmetic changes (no warnings now) 25 1.00 Public release. cosmetic changes (no warnings now)
26 0.68 Turning per- packet,interrupt debug messages off - testing for release. 26 0.68 Turning per- packet,interrupt debug messages off - testing for release.
@@ -95,7 +95,7 @@ static void hardware_send_packet(struct net_device *dev, char *buf, int length);
95extern void seeq8005_init(struct net_device *dev, int startp); 95extern void seeq8005_init(struct net_device *dev, int startp);
96static inline void wait_for_buffer(struct net_device *dev); 96static inline void wait_for_buffer(struct net_device *dev);
97 97
98 98
99/* Check for a network adaptor of this type, and return '0' iff one exists. 99/* Check for a network adaptor of this type, and return '0' iff one exists.
100 If dev->base_addr == 0, probe all likely locations. 100 If dev->base_addr == 0, probe all likely locations.
101 If dev->base_addr == 1, always return failure. 101 If dev->base_addr == 1, always return failure.
@@ -196,11 +196,11 @@ static int __init seeq8005_probe1(struct net_device *dev, int ioaddr)
196 retval = -ENODEV; 196 retval = -ENODEV;
197 goto out; 197 goto out;
198 } 198 }
199 199
200 old_cfg2 = inw(SEEQ_CFG2); /* read CFG2 register */ 200 old_cfg2 = inw(SEEQ_CFG2); /* read CFG2 register */
201 old_cfg1 = inw(SEEQ_CFG1); 201 old_cfg1 = inw(SEEQ_CFG1);
202 old_dmaar = inw(SEEQ_DMAAR); 202 old_dmaar = inw(SEEQ_DMAAR);
203 203
204 if (net_debug>4) { 204 if (net_debug>4) {
205 printk("seeq8005: stat = 0x%04x\n",old_stat); 205 printk("seeq8005: stat = 0x%04x\n",old_stat);
206 printk("seeq8005: cfg1 = 0x%04x\n",old_cfg1); 206 printk("seeq8005: cfg1 = 0x%04x\n",old_cfg1);
@@ -208,7 +208,7 @@ static int __init seeq8005_probe1(struct net_device *dev, int ioaddr)
208 printk("seeq8005: raer = 0x%04x\n",old_rear); 208 printk("seeq8005: raer = 0x%04x\n",old_rear);
209 printk("seeq8005: dmaar= 0x%04x\n",old_dmaar); 209 printk("seeq8005: dmaar= 0x%04x\n",old_dmaar);
210 } 210 }
211 211
212 outw( SEEQCMD_FIFO_WRITE | SEEQCMD_SET_ALL_OFF, SEEQ_CMD); /* setup for reading PROM */ 212 outw( SEEQCMD_FIFO_WRITE | SEEQCMD_SET_ALL_OFF, SEEQ_CMD); /* setup for reading PROM */
213 outw( 0, SEEQ_DMAAR); /* set starting PROM address */ 213 outw( 0, SEEQ_DMAAR); /* set starting PROM address */
214 outw( SEEQCFG1_BUFFER_PROM, SEEQ_CFG1); /* set buffer to look at PROM */ 214 outw( SEEQCFG1_BUFFER_PROM, SEEQ_CFG1); /* set buffer to look at PROM */
@@ -236,7 +236,7 @@ static int __init seeq8005_probe1(struct net_device *dev, int ioaddr)
236 outw( SEEQCFG2_RESET, SEEQ_CFG2); /* reset the card */ 236 outw( SEEQCFG2_RESET, SEEQ_CFG2); /* reset the card */
237 udelay(5); 237 udelay(5);
238 outw( SEEQCMD_SET_ALL_OFF, SEEQ_CMD); 238 outw( SEEQCMD_SET_ALL_OFF, SEEQ_CMD);
239 239
240 if (net_debug) { 240 if (net_debug) {
241 printk("seeq8005: prom sum = 0x%08x\n",j); 241 printk("seeq8005: prom sum = 0x%08x\n",j);
242 for(j=0; j<32; j+=16) { 242 for(j=0; j<32; j+=16) {
@@ -256,10 +256,10 @@ static int __init seeq8005_probe1(struct net_device *dev, int ioaddr)
256 } 256 }
257 } 257 }
258 258
259#if 0 259#if 0
260 /* 260 /*
261 * testing the packet buffer memory doesn't work yet 261 * testing the packet buffer memory doesn't work yet
262 * but all other buffer accesses do 262 * but all other buffer accesses do
263 * - fixing is not a priority 263 * - fixing is not a priority
264 */ 264 */
265 if (net_debug>1) { /* test packet buffer memory */ 265 if (net_debug>1) { /* test packet buffer memory */
@@ -309,16 +309,16 @@ static int __init seeq8005_probe1(struct net_device *dev, int ioaddr)
309 ; /* Do nothing: a user-level program will set it. */ 309 ; /* Do nothing: a user-level program will set it. */
310 else if (dev->irq < 2) { /* "Auto-IRQ" */ 310 else if (dev->irq < 2) { /* "Auto-IRQ" */
311 unsigned long cookie = probe_irq_on(); 311 unsigned long cookie = probe_irq_on();
312 312
313 outw( SEEQCMD_RX_INT_EN | SEEQCMD_SET_RX_ON | SEEQCMD_SET_RX_OFF, SEEQ_CMD ); 313 outw( SEEQCMD_RX_INT_EN | SEEQCMD_SET_RX_ON | SEEQCMD_SET_RX_OFF, SEEQ_CMD );
314 314
315 dev->irq = probe_irq_off(cookie); 315 dev->irq = probe_irq_off(cookie);
316 316
317 if (net_debug >= 2) 317 if (net_debug >= 2)
318 printk(" autoirq is %d\n", dev->irq); 318 printk(" autoirq is %d\n", dev->irq);
319 } else if (dev->irq == 2) 319 } else if (dev->irq == 2)
320 /* Fixup for users that don't know that IRQ 2 is really IRQ 9, 320 /* Fixup for users that don't know that IRQ 2 is really IRQ 9,
321 * or don't know which one to set. 321 * or don't know which one to set.
322 */ 322 */
323 dev->irq = 9; 323 dev->irq = 9;
324 324
@@ -348,7 +348,7 @@ out:
348 return retval; 348 return retval;
349} 349}
350 350
351 351
352/* Open/initialize the board. This is called (in the current kernel) 352/* Open/initialize the board. This is called (in the current kernel)
353 sometime after booting when the 'ifconfig' program is run. 353 sometime after booting when the 'ifconfig' program is run.
354 354
@@ -404,8 +404,8 @@ static int seeq8005_send_packet(struct sk_buff *skb, struct net_device *dev)
404 404
405 /* Block a timer-based transmit from overlapping */ 405 /* Block a timer-based transmit from overlapping */
406 netif_stop_queue(dev); 406 netif_stop_queue(dev);
407 407
408 hardware_send_packet(dev, buf, length); 408 hardware_send_packet(dev, buf, length);
409 dev->trans_start = jiffies; 409 dev->trans_start = jiffies;
410 lp->stats.tx_bytes += length; 410 lp->stats.tx_bytes += length;
411 dev_kfree_skb (skb); 411 dev_kfree_skb (skb);
@@ -413,7 +413,7 @@ static int seeq8005_send_packet(struct sk_buff *skb, struct net_device *dev)
413 413
414 return 0; 414 return 0;
415} 415}
416 416
417/* 417/*
418 * wait_for_buffer 418 * wait_for_buffer
419 * 419 *
@@ -426,15 +426,15 @@ inline void wait_for_buffer(struct net_device * dev)
426 int ioaddr = dev->base_addr; 426 int ioaddr = dev->base_addr;
427 unsigned long tmp; 427 unsigned long tmp;
428 int status; 428 int status;
429 429
430 tmp = jiffies + HZ; 430 tmp = jiffies + HZ;
431 while ( ( ((status=inw(SEEQ_STATUS)) & SEEQSTAT_WINDOW_INT) != SEEQSTAT_WINDOW_INT) && time_before(jiffies, tmp)) 431 while ( ( ((status=inw(SEEQ_STATUS)) & SEEQSTAT_WINDOW_INT) != SEEQSTAT_WINDOW_INT) && time_before(jiffies, tmp))
432 cpu_relax(); 432 cpu_relax();
433 433
434 if ( (status & SEEQSTAT_WINDOW_INT) == SEEQSTAT_WINDOW_INT) 434 if ( (status & SEEQSTAT_WINDOW_INT) == SEEQSTAT_WINDOW_INT)
435 outw( SEEQCMD_WINDOW_INT_ACK | (status & SEEQCMD_INT_MASK), SEEQ_CMD); 435 outw( SEEQCMD_WINDOW_INT_ACK | (status & SEEQCMD_INT_MASK), SEEQ_CMD);
436} 436}
437 437
438/* The typical workload of the driver: 438/* The typical workload of the driver:
439 Handle the network interface interrupts. */ 439 Handle the network interface interrupts. */
440static irqreturn_t seeq8005_interrupt(int irq, void *dev_id, struct pt_regs * regs) 440static irqreturn_t seeq8005_interrupt(int irq, void *dev_id, struct pt_regs * regs)
@@ -452,7 +452,7 @@ static irqreturn_t seeq8005_interrupt(int irq, void *dev_id, struct pt_regs * re
452 if (net_debug >2) { 452 if (net_debug >2) {
453 printk("%s: int, status=0x%04x\n",dev->name,status); 453 printk("%s: int, status=0x%04x\n",dev->name,status);
454 } 454 }
455 455
456 if (status & SEEQSTAT_WINDOW_INT) { 456 if (status & SEEQSTAT_WINDOW_INT) {
457 handled = 1; 457 handled = 1;
458 outw( SEEQCMD_WINDOW_INT_ACK | (status & SEEQCMD_INT_MASK), SEEQ_CMD); 458 outw( SEEQCMD_WINDOW_INT_ACK | (status & SEEQCMD_INT_MASK), SEEQ_CMD);
@@ -500,32 +500,32 @@ static void seeq8005_rx(struct net_device *dev)
500 wait_for_buffer(dev); 500 wait_for_buffer(dev);
501 next_packet = ntohs(inw(SEEQ_BUFFER)); 501 next_packet = ntohs(inw(SEEQ_BUFFER));
502 pkt_hdr = inw(SEEQ_BUFFER); 502 pkt_hdr = inw(SEEQ_BUFFER);
503 503
504 if (net_debug>2) { 504 if (net_debug>2) {
505 printk("%s: 0x%04x recv next=0x%04x, hdr=0x%04x\n",dev->name,lp->receive_ptr,next_packet,pkt_hdr); 505 printk("%s: 0x%04x recv next=0x%04x, hdr=0x%04x\n",dev->name,lp->receive_ptr,next_packet,pkt_hdr);
506 } 506 }
507 507
508 if ((next_packet == 0) || ((pkt_hdr & SEEQPKTH_CHAIN)==0)) { /* Read all the frames? */ 508 if ((next_packet == 0) || ((pkt_hdr & SEEQPKTH_CHAIN)==0)) { /* Read all the frames? */
509 return; /* Done for now */ 509 return; /* Done for now */
510 } 510 }
511 511
512 if ((pkt_hdr & SEEQPKTS_DONE)==0) 512 if ((pkt_hdr & SEEQPKTS_DONE)==0)
513 break; 513 break;
514 514
515 if (next_packet < lp->receive_ptr) { 515 if (next_packet < lp->receive_ptr) {
516 pkt_len = (next_packet + 0x10000 - ((DEFAULT_TEA+1)<<8)) - lp->receive_ptr - 4; 516 pkt_len = (next_packet + 0x10000 - ((DEFAULT_TEA+1)<<8)) - lp->receive_ptr - 4;
517 } else { 517 } else {
518 pkt_len = next_packet - lp->receive_ptr - 4; 518 pkt_len = next_packet - lp->receive_ptr - 4;
519 } 519 }
520 520
521 if (next_packet < ((DEFAULT_TEA+1)<<8)) { /* is the next_packet address sane? */ 521 if (next_packet < ((DEFAULT_TEA+1)<<8)) { /* is the next_packet address sane? */
522 printk("%s: recv packet ring corrupt, resetting board\n",dev->name); 522 printk("%s: recv packet ring corrupt, resetting board\n",dev->name);
523 seeq8005_init(dev,1); 523 seeq8005_init(dev,1);
524 return; 524 return;
525 } 525 }
526 526
527 lp->receive_ptr = next_packet; 527 lp->receive_ptr = next_packet;
528 528
529 if (net_debug>2) { 529 if (net_debug>2) {
530 printk("%s: recv len=0x%04x\n",dev->name,pkt_len); 530 printk("%s: recv len=0x%04x\n",dev->name,pkt_len);
531 } 531 }
@@ -553,9 +553,9 @@ static void seeq8005_rx(struct net_device *dev)
553 skb->dev = dev; 553 skb->dev = dev;
554 skb_reserve(skb, 2); /* align data on 16 byte */ 554 skb_reserve(skb, 2); /* align data on 16 byte */
555 buf = skb_put(skb,pkt_len); 555 buf = skb_put(skb,pkt_len);
556 556
557 insw(SEEQ_BUFFER, buf, (pkt_len + 1) >> 1); 557 insw(SEEQ_BUFFER, buf, (pkt_len + 1) >> 1);
558 558
559 if (net_debug>2) { 559 if (net_debug>2) {
560 char * p = buf; 560 char * p = buf;
561 printk("%s: recv ",dev->name); 561 printk("%s: recv ",dev->name);
@@ -588,7 +588,7 @@ static int seeq8005_close(struct net_device *dev)
588 lp->open_time = 0; 588 lp->open_time = 0;
589 589
590 netif_stop_queue(dev); 590 netif_stop_queue(dev);
591 591
592 /* Flush the Tx and disable Rx here. */ 592 /* Flush the Tx and disable Rx here. */
593 outw( SEEQCMD_SET_ALL_OFF, SEEQ_CMD); 593 outw( SEEQCMD_SET_ALL_OFF, SEEQ_CMD);
594 594
@@ -627,7 +627,7 @@ static void set_multicast_list(struct net_device *dev)
627 * hmm, not even sure if my matching works _anyway_ - seem to be receiving 627 * hmm, not even sure if my matching works _anyway_ - seem to be receiving
628 * _everything_ . . . 628 * _everything_ . . .
629 */ 629 */
630 630
631 if (num_addrs) { /* Enable promiscuous mode */ 631 if (num_addrs) { /* Enable promiscuous mode */
632 outw( (inw(SEEQ_CFG1) & ~SEEQCFG1_MATCH_MASK)| SEEQCFG1_MATCH_ALL, SEEQ_CFG1); 632 outw( (inw(SEEQ_CFG1) & ~SEEQCFG1_MATCH_MASK)| SEEQCFG1_MATCH_ALL, SEEQ_CFG1);
633 dev->flags|=IFF_PROMISC; 633 dev->flags|=IFF_PROMISC;
@@ -642,26 +642,26 @@ void seeq8005_init(struct net_device *dev, int startp)
642 struct net_local *lp = netdev_priv(dev); 642 struct net_local *lp = netdev_priv(dev);
643 int ioaddr = dev->base_addr; 643 int ioaddr = dev->base_addr;
644 int i; 644 int i;
645 645
646 outw(SEEQCFG2_RESET, SEEQ_CFG2); /* reset device */ 646 outw(SEEQCFG2_RESET, SEEQ_CFG2); /* reset device */
647 udelay(5); 647 udelay(5);
648 648
649 outw( SEEQCMD_FIFO_WRITE | SEEQCMD_SET_ALL_OFF, SEEQ_CMD); 649 outw( SEEQCMD_FIFO_WRITE | SEEQCMD_SET_ALL_OFF, SEEQ_CMD);
650 outw( 0, SEEQ_DMAAR); /* load start address into both low and high byte */ 650 outw( 0, SEEQ_DMAAR); /* load start address into both low and high byte */
651/* wait_for_buffer(dev); */ /* I think that you only need a wait for memory buffer */ 651/* wait_for_buffer(dev); */ /* I think that you only need a wait for memory buffer */
652 outw( SEEQCFG1_BUFFER_MAC0, SEEQ_CFG1); 652 outw( SEEQCFG1_BUFFER_MAC0, SEEQ_CFG1);
653 653
654 for(i=0;i<6;i++) { /* set Station address */ 654 for(i=0;i<6;i++) { /* set Station address */
655 outb(dev->dev_addr[i], SEEQ_BUFFER); 655 outb(dev->dev_addr[i], SEEQ_BUFFER);
656 udelay(2); 656 udelay(2);
657 } 657 }
658 658
659 outw( SEEQCFG1_BUFFER_TEA, SEEQ_CFG1); /* set xmit end area pointer to 16K */ 659 outw( SEEQCFG1_BUFFER_TEA, SEEQ_CFG1); /* set xmit end area pointer to 16K */
660 outb( DEFAULT_TEA, SEEQ_BUFFER); /* this gives us 16K of send buffer and 48K of recv buffer */ 660 outb( DEFAULT_TEA, SEEQ_BUFFER); /* this gives us 16K of send buffer and 48K of recv buffer */
661 661
662 lp->receive_ptr = (DEFAULT_TEA+1)<<8; /* so we can find our packet_header */ 662 lp->receive_ptr = (DEFAULT_TEA+1)<<8; /* so we can find our packet_header */
663 outw( lp->receive_ptr, SEEQ_RPR); /* Receive Pointer Register is set to recv buffer memory */ 663 outw( lp->receive_ptr, SEEQ_RPR); /* Receive Pointer Register is set to recv buffer memory */
664 664
665 outw( 0x00ff, SEEQ_REA); /* Receive Area End */ 665 outw( 0x00ff, SEEQ_REA); /* Receive Area End */
666 666
667 if (net_debug>4) { 667 if (net_debug>4) {
@@ -670,13 +670,13 @@ void seeq8005_init(struct net_device *dev, int startp)
670 outw( SEEQCMD_FIFO_READ | SEEQCMD_SET_ALL_OFF, SEEQ_CMD); 670 outw( SEEQCMD_FIFO_READ | SEEQCMD_SET_ALL_OFF, SEEQ_CMD);
671 outw( 0, SEEQ_DMAAR); 671 outw( 0, SEEQ_DMAAR);
672 outw( SEEQCFG1_BUFFER_MAC0, SEEQ_CFG1); 672 outw( SEEQCFG1_BUFFER_MAC0, SEEQ_CFG1);
673 673
674 for(i=0;i<6;i++) { 674 for(i=0;i<6;i++) {
675 printk("%02x ",inb(SEEQ_BUFFER)); 675 printk("%02x ",inb(SEEQ_BUFFER));
676 } 676 }
677 printk("\n"); 677 printk("\n");
678 } 678 }
679 679
680 outw( SEEQCFG1_MAC0_EN | SEEQCFG1_MATCH_BROAD | SEEQCFG1_BUFFER_BUFFER, SEEQ_CFG1); 680 outw( SEEQCFG1_MAC0_EN | SEEQCFG1_MATCH_BROAD | SEEQCFG1_BUFFER_BUFFER, SEEQ_CFG1);
681 outw( SEEQCFG2_AUTO_REA | SEEQCFG2_CTRLO, SEEQ_CFG2); 681 outw( SEEQCFG2_AUTO_REA | SEEQCFG2_CTRLO, SEEQ_CFG2);
682 outw( SEEQCMD_SET_RX_ON | SEEQCMD_TX_INT_EN | SEEQCMD_RX_INT_EN, SEEQ_CMD); 682 outw( SEEQCMD_SET_RX_ON | SEEQCMD_TX_INT_EN | SEEQCMD_RX_INT_EN, SEEQ_CMD);
@@ -689,9 +689,9 @@ void seeq8005_init(struct net_device *dev, int startp)
689 printk("%s: cfg2 = 0x%04x\n",dev->name,inw(SEEQ_CFG2)); 689 printk("%s: cfg2 = 0x%04x\n",dev->name,inw(SEEQ_CFG2));
690 printk("%s: raer = 0x%04x\n",dev->name,inw(SEEQ_REA)); 690 printk("%s: raer = 0x%04x\n",dev->name,inw(SEEQ_REA));
691 printk("%s: dmaar= 0x%04x\n",dev->name,inw(SEEQ_DMAAR)); 691 printk("%s: dmaar= 0x%04x\n",dev->name,inw(SEEQ_DMAAR));
692 692
693 } 693 }
694} 694}
695 695
696 696
697static void hardware_send_packet(struct net_device * dev, char *buf, int length) 697static void hardware_send_packet(struct net_device * dev, char *buf, int length)
@@ -704,32 +704,32 @@ static void hardware_send_packet(struct net_device * dev, char *buf, int length)
704 if (net_debug>4) { 704 if (net_debug>4) {
705 printk("%s: send 0x%04x\n",dev->name,length); 705 printk("%s: send 0x%04x\n",dev->name,length);
706 } 706 }
707 707
708 /* Set FIFO to writemode and set packet-buffer address */ 708 /* Set FIFO to writemode and set packet-buffer address */
709 outw( SEEQCMD_FIFO_WRITE | (status & SEEQCMD_INT_MASK), SEEQ_CMD); 709 outw( SEEQCMD_FIFO_WRITE | (status & SEEQCMD_INT_MASK), SEEQ_CMD);
710 outw( transmit_ptr, SEEQ_DMAAR); 710 outw( transmit_ptr, SEEQ_DMAAR);
711 711
712 /* output SEEQ Packet header barfage */ 712 /* output SEEQ Packet header barfage */
713 outw( htons(length + 4), SEEQ_BUFFER); 713 outw( htons(length + 4), SEEQ_BUFFER);
714 outw( SEEQPKTH_XMIT | SEEQPKTH_DATA_FOLLOWS | SEEQPKTH_XMIT_INT_EN, SEEQ_BUFFER ); 714 outw( SEEQPKTH_XMIT | SEEQPKTH_DATA_FOLLOWS | SEEQPKTH_XMIT_INT_EN, SEEQ_BUFFER );
715 715
716 /* blat the buffer */ 716 /* blat the buffer */
717 outsw( SEEQ_BUFFER, buf, (length +1) >> 1); 717 outsw( SEEQ_BUFFER, buf, (length +1) >> 1);
718 /* paranoia !! */ 718 /* paranoia !! */
719 outw( 0, SEEQ_BUFFER); 719 outw( 0, SEEQ_BUFFER);
720 outw( 0, SEEQ_BUFFER); 720 outw( 0, SEEQ_BUFFER);
721 721
722 /* set address of start of transmit chain */ 722 /* set address of start of transmit chain */
723 outw( transmit_ptr, SEEQ_TPR); 723 outw( transmit_ptr, SEEQ_TPR);
724 724
725 /* drain FIFO */ 725 /* drain FIFO */
726 tmp = jiffies; 726 tmp = jiffies;
727 while ( (((status=inw(SEEQ_STATUS)) & SEEQSTAT_FIFO_EMPTY) == 0) && time_before(jiffies, tmp + HZ)) 727 while ( (((status=inw(SEEQ_STATUS)) & SEEQSTAT_FIFO_EMPTY) == 0) && time_before(jiffies, tmp + HZ))
728 mb(); 728 mb();
729 729
730 /* doit ! */ 730 /* doit ! */
731 outw( SEEQCMD_WINDOW_INT_ACK | SEEQCMD_SET_TX_ON | (status & SEEQCMD_INT_MASK), SEEQ_CMD); 731 outw( SEEQCMD_WINDOW_INT_ACK | SEEQCMD_SET_TX_ON | (status & SEEQCMD_INT_MASK), SEEQ_CMD);
732 732
733} 733}
734 734
735 735
@@ -758,7 +758,7 @@ void cleanup_module(void)
758} 758}
759 759
760#endif /* MODULE */ 760#endif /* MODULE */
761 761
762/* 762/*
763 * Local variables: 763 * Local variables:
764 * compile-command: "gcc -D__KERNEL__ -I/usr/src/linux/net/inet -Wall -Wstrict-prototypes -O6 -m486 -c skeleton.c" 764 * compile-command: "gcc -D__KERNEL__ -I/usr/src/linux/net/inet -Wall -Wstrict-prototypes -O6 -m486 -c skeleton.c"