33 #include <linux/module.h>
34 #include <linux/kernel.h>
35 #include <linux/types.h>
36 #include <linux/fcntl.h>
40 #include <linux/string.h>
43 #include <linux/errno.h>
44 #include <linux/netdevice.h>
47 #include <linux/bitops.h>
57 static unsigned int seeq8005_portlist[]
__initdata =
58 { 0x300, 0x320, 0x340, 0x360, 0};
79 static int seeq8005_probe1(
struct net_device *
dev,
int ioaddr);
90 #define tx_done(dev) (inw(SEEQ_STATUS) & SEEQSTAT_TX_ON)
101 static int io = 0x320;
121 err = seeq8005_probe1(dev,
io);
122 }
else if (
io != 0) {
125 for (port = seeq8005_portlist; *
port; port++) {
126 if (seeq8005_probe1(dev, *port) == 0)
146 .ndo_open = seeq8005_open,
147 .ndo_stop = seeq8005_close,
148 .ndo_start_xmit = seeq8005_send_packet,
149 .ndo_tx_timeout = seeq8005_timeout,
150 .ndo_set_rx_mode = set_multicast_list,
162 static unsigned version_printed;
164 unsigned char SA_prom[32];
176 printk(
"seeq8005: probing at 0x%x\n",ioaddr);
179 if (old_stat == 0xffff) {
183 if ( (old_stat & 0x1800) != 0x1800 ) {
185 printk(
"seeq8005: reserved stat bits != 0x1800\n");
186 printk(
" == 0x%04x\n",old_stat);
193 if (old_rear == 0xffff) {
199 }
else if ((old_rear & 0xff00) != 0xff00) {
201 printk(
"seeq8005: unused rear bits != 0xff00\n");
202 printk(
" == 0x%04x\n",old_rear);
213 printk(
"seeq8005: stat = 0x%04x\n",old_stat);
214 printk(
"seeq8005: cfg1 = 0x%04x\n",old_cfg1);
215 printk(
"seeq8005: cfg2 = 0x%04x\n",old_cfg2);
216 printk(
"seeq8005: raer = 0x%04x\n",old_rear);
217 printk(
"seeq8005: dmaar= 0x%04x\n",old_dmaar);
226 for(i=0; i <32; i++) {
232 if ( (j&0xff) != 0 ) {
234 printk(
"seeq8005: prom sum error\n");
249 printk(
"seeq8005: prom sum = 0x%08x\n",j);
250 for(j=0; j<32; j+=16) {
251 printk(
"seeq8005: prom %02x: ",j);
253 printk(
"%02x ",SA_prom[j|i]);
257 if ((SA_prom[j|i]>31)&&(SA_prom[j|i]<127)) {
258 printk(
"%c", SA_prom[j|i]);
274 printk(
"seeq8005: testing packet buffer ... ");
278 for(i=0;i<32768;i++) {
287 if ( (
inw(
SEEQ_STATUS) & SEEQSTAT_WINDOW_INT) == SEEQSTAT_WINDOW_INT)
291 for(i=0;i<32768;i++) {
306 printk(
"%s: %s found at %#3x, ", dev->
name,
"seeq8005", ioaddr);
313 for (i = 0; i < 6; i++)
317 if (dev->
irq == 0xff)
319 else if (dev->
irq < 2) {
328 }
else if (dev->
irq == 2)
336 int irqval =
request_irq(dev->
irq, seeq8005_interrupt, 0,
"seeq8005", dev);
338 printk (
"%s: unable to get IRQ %d (irqval=%d).\n", dev->
name,
363 static int seeq8005_open(
struct net_device *dev)
368 int irqval =
request_irq(dev->
irq, seeq8005_interrupt, 0,
"seeq8005", dev);
370 printk (
"%s: unable to get IRQ %d (irqval=%d).\n", dev->
name,
381 netif_start_queue(dev);
385 static void seeq8005_timeout(
struct net_device *dev)
389 tx_done(dev) ?
"IRQ conflict" :
"network cable problem");
393 netif_wake_queue(dev);
410 netif_stop_queue(dev);
412 hardware_send_packet(dev, buf, length);
427 inline void wait_for_buffer(
struct net_device * dev)
437 if ( (status & SEEQSTAT_WINDOW_INT) == SEEQSTAT_WINDOW_INT)
447 int ioaddr,
status, boguscount = 0;
451 lp = netdev_priv(dev);
456 printk(
"%s: int, status=0x%04x\n",dev->
name,status);
459 if (status & SEEQSTAT_WINDOW_INT) {
469 dev->
stats.tx_packets++;
470 netif_wake_queue(dev);
487 static void seeq8005_rx(
struct net_device *dev)
503 wait_for_buffer(dev);
525 printk(
"%s: recv packet ring corrupt, resetting board\n",dev->
name);
533 printk(
"%s: recv len=0x%04x\n",dev->
name,pkt_len);
537 dev->
stats.rx_errors++;
550 skb = netdev_alloc_skb(dev, pkt_len);
552 printk(
"%s: Memory squeeze, dropping packet.\n", dev->
name);
553 dev->
stats.rx_dropped++;
565 printk(
"%02x ",*(p++)&0xff);
572 dev->
stats.rx_packets++;
575 }
while ((--boguscount) && (pkt_hdr & SEEQPKTH_CHAIN));
583 static int seeq8005_close(
struct net_device *dev)
590 netif_stop_queue(dev);
609 static void set_multicast_list(
struct net_device *dev)
679 printk(
"%s: cfg1 = 0x%04x\n",dev->
name,old_cfg1);
688 static void hardware_send_packet(
struct net_device * dev,
char *buf,
int length)
692 int transmit_ptr = 0;
739 return PTR_RET(dev_seeq);