aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/znet.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/znet.c')
-rw-r--r--drivers/net/znet.c72
1 files changed, 36 insertions, 36 deletions
diff --git a/drivers/net/znet.c b/drivers/net/znet.c
index 9f0291f35290..656d5a02908b 100644
--- a/drivers/net/znet.c
+++ b/drivers/net/znet.c
@@ -75,7 +75,7 @@
75 - Now survives unplugging/replugging cable. 75 - Now survives unplugging/replugging cable.
76 76
77 Some code was taken from wavelan_cs. 77 Some code was taken from wavelan_cs.
78 78
79 Tested on a vintage Zenith Z-Note 433Lnp+. Probably broken on 79 Tested on a vintage Zenith Z-Note 433Lnp+. Probably broken on
80 anything else. Testers (and detailed bug reports) are welcome :-). 80 anything else. Testers (and detailed bug reports) are welcome :-).
81 81
@@ -171,7 +171,7 @@ static int znet_request_resources (struct net_device *dev)
171{ 171{
172 struct znet_private *znet = dev->priv; 172 struct znet_private *znet = dev->priv;
173 unsigned long flags; 173 unsigned long flags;
174 174
175 if (request_irq (dev->irq, &znet_interrupt, 0, "ZNet", dev)) 175 if (request_irq (dev->irq, &znet_interrupt, 0, "ZNet", dev))
176 goto failed; 176 goto failed;
177 if (request_dma (znet->rx_dma, "ZNet rx")) 177 if (request_dma (znet->rx_dma, "ZNet rx"))
@@ -205,7 +205,7 @@ static void znet_release_resources (struct net_device *dev)
205{ 205{
206 struct znet_private *znet = dev->priv; 206 struct znet_private *znet = dev->priv;
207 unsigned long flags; 207 unsigned long flags;
208 208
209 release_region (znet->sia_base, znet->sia_size); 209 release_region (znet->sia_base, znet->sia_size);
210 release_region (dev->base_addr, znet->io_size); 210 release_region (dev->base_addr, znet->io_size);
211 flags = claim_dma_lock(); 211 flags = claim_dma_lock();
@@ -229,7 +229,7 @@ static void znet_transceiver_power (struct net_device *dev, int on)
229 v = inb(znet->sia_base + 1) | 0x84; 229 v = inb(znet->sia_base + 1) | 0x84;
230 else 230 else
231 v = inb(znet->sia_base + 1) & ~0x84; 231 v = inb(znet->sia_base + 1) & ~0x84;
232 232
233 outb(v, znet->sia_base+1); /* Turn on/off LAN power (bit 2). */ 233 outb(v, znet->sia_base+1); /* Turn on/off LAN power (bit 2). */
234} 234}
235 235
@@ -242,7 +242,7 @@ static void znet_set_multicast_list (struct net_device *dev)
242 struct i82593_conf_block *cfblk = &znet->i593_init; 242 struct i82593_conf_block *cfblk = &znet->i593_init;
243 243
244 memset(cfblk, 0x00, sizeof(struct i82593_conf_block)); 244 memset(cfblk, 0x00, sizeof(struct i82593_conf_block));
245 245
246 /* The configuration block. What an undocumented nightmare. 246 /* The configuration block. What an undocumented nightmare.
247 The first set of values are those suggested (without explanation) 247 The first set of values are those suggested (without explanation)
248 for ethernet in the Intel 82586 databook. The rest appear to be 248 for ethernet in the Intel 82586 databook. The rest appear to be
@@ -251,7 +251,7 @@ static void znet_set_multicast_list (struct net_device *dev)
251 251
252 /* maz : Rewritten to take advantage of the wanvelan includes. 252 /* maz : Rewritten to take advantage of the wanvelan includes.
253 At least we have names, not just blind values */ 253 At least we have names, not just blind values */
254 254
255 /* Byte 0 */ 255 /* Byte 0 */
256 cfblk->fifo_limit = 10; /* = 16 B rx and 80 B tx fifo thresholds */ 256 cfblk->fifo_limit = 10; /* = 16 B rx and 80 B tx fifo thresholds */
257 cfblk->forgnesi = 0; /* 0=82C501, 1=AMD7992B compatibility */ 257 cfblk->forgnesi = 0; /* 0=82C501, 1=AMD7992B compatibility */
@@ -269,23 +269,23 @@ static void znet_set_multicast_list (struct net_device *dev)
269 cfblk->acloc = 1; /* Disable source addr insertion by i82593 */ 269 cfblk->acloc = 1; /* Disable source addr insertion by i82593 */
270 cfblk->preamb_len = 2; /* 8 bytes preamble */ 270 cfblk->preamb_len = 2; /* 8 bytes preamble */
271 cfblk->loopback = 0; /* Loopback off */ 271 cfblk->loopback = 0; /* Loopback off */
272 272
273 /* Byte 3 */ 273 /* Byte 3 */
274 cfblk->lin_prio = 0; /* Default priorities & backoff methods. */ 274 cfblk->lin_prio = 0; /* Default priorities & backoff methods. */
275 cfblk->tbofstop = 0; 275 cfblk->tbofstop = 0;
276 cfblk->exp_prio = 0; 276 cfblk->exp_prio = 0;
277 cfblk->bof_met = 0; 277 cfblk->bof_met = 0;
278 278
279 /* Byte 4 */ 279 /* Byte 4 */
280 cfblk->ifrm_spc = 6; /* 96 bit times interframe spacing */ 280 cfblk->ifrm_spc = 6; /* 96 bit times interframe spacing */
281 281
282 /* Byte 5 */ 282 /* Byte 5 */
283 cfblk->slottim_low = 0; /* 512 bit times slot time (low) */ 283 cfblk->slottim_low = 0; /* 512 bit times slot time (low) */
284 284
285 /* Byte 6 */ 285 /* Byte 6 */
286 cfblk->slottim_hi = 2; /* 512 bit times slot time (high) */ 286 cfblk->slottim_hi = 2; /* 512 bit times slot time (high) */
287 cfblk->max_retr = 15; /* 15 collisions retries */ 287 cfblk->max_retr = 15; /* 15 collisions retries */
288 288
289 /* Byte 7 */ 289 /* Byte 7 */
290 cfblk->prmisc = ((dev->flags & IFF_PROMISC) ? 1 : 0); /* Promiscuous mode */ 290 cfblk->prmisc = ((dev->flags & IFF_PROMISC) ? 1 : 0); /* Promiscuous mode */
291 cfblk->bc_dis = 0; /* Enable broadcast reception */ 291 cfblk->bc_dis = 0; /* Enable broadcast reception */
@@ -293,15 +293,15 @@ static void znet_set_multicast_list (struct net_device *dev)
293 cfblk->nocrc_ins = 0; /* i82593 generates CRC */ 293 cfblk->nocrc_ins = 0; /* i82593 generates CRC */
294 cfblk->crc_1632 = 0; /* 32-bit Autodin-II CRC */ 294 cfblk->crc_1632 = 0; /* 32-bit Autodin-II CRC */
295 cfblk->crs_cdt = 0; /* CD not to be interpreted as CS */ 295 cfblk->crs_cdt = 0; /* CD not to be interpreted as CS */
296 296
297 /* Byte 8 */ 297 /* Byte 8 */
298 cfblk->cs_filter = 0; /* CS is recognized immediately */ 298 cfblk->cs_filter = 0; /* CS is recognized immediately */
299 cfblk->crs_src = 0; /* External carrier sense */ 299 cfblk->crs_src = 0; /* External carrier sense */
300 cfblk->cd_filter = 0; /* CD is recognized immediately */ 300 cfblk->cd_filter = 0; /* CD is recognized immediately */
301 301
302 /* Byte 9 */ 302 /* Byte 9 */
303 cfblk->min_fr_len = ETH_ZLEN >> 2; /* Minimum frame length */ 303 cfblk->min_fr_len = ETH_ZLEN >> 2; /* Minimum frame length */
304 304
305 /* Byte A */ 305 /* Byte A */
306 cfblk->lng_typ = 1; /* Type/length checks OFF */ 306 cfblk->lng_typ = 1; /* Type/length checks OFF */
307 cfblk->lng_fld = 1; /* Disable 802.3 length field check */ 307 cfblk->lng_fld = 1; /* Disable 802.3 length field check */
@@ -311,15 +311,15 @@ static void znet_set_multicast_list (struct net_device *dev)
311 cfblk->tx_jabber = 0; /* Disable jabber jam sequence */ 311 cfblk->tx_jabber = 0; /* Disable jabber jam sequence */
312 cfblk->hash_1 = 1; /* Use bits 0-5 in mc address hash */ 312 cfblk->hash_1 = 1; /* Use bits 0-5 in mc address hash */
313 cfblk->lbpkpol = 0; /* Loopback pin active high */ 313 cfblk->lbpkpol = 0; /* Loopback pin active high */
314 314
315 /* Byte B */ 315 /* Byte B */
316 cfblk->fdx = 0; /* Disable full duplex operation */ 316 cfblk->fdx = 0; /* Disable full duplex operation */
317 317
318 /* Byte C */ 318 /* Byte C */
319 cfblk->dummy_6 = 0x3f; /* all ones, Default multicast addresses & backoff. */ 319 cfblk->dummy_6 = 0x3f; /* all ones, Default multicast addresses & backoff. */
320 cfblk->mult_ia = 0; /* No multiple individual addresses */ 320 cfblk->mult_ia = 0; /* No multiple individual addresses */
321 cfblk->dis_bof = 0; /* Disable the backoff algorithm ?! */ 321 cfblk->dis_bof = 0; /* Disable the backoff algorithm ?! */
322 322
323 /* Byte D */ 323 /* Byte D */
324 cfblk->dummy_1 = 1; /* set to 1 */ 324 cfblk->dummy_1 = 1; /* set to 1 */
325 cfblk->tx_ifs_retrig = 3; /* Hmm... Disabled */ 325 cfblk->tx_ifs_retrig = 3; /* Hmm... Disabled */
@@ -327,7 +327,7 @@ static void znet_set_multicast_list (struct net_device *dev)
327 cfblk->rcv_mon = 0; /* Monitor mode disabled */ 327 cfblk->rcv_mon = 0; /* Monitor mode disabled */
328 cfblk->frag_acpt = 0; /* Do not accept fragments */ 328 cfblk->frag_acpt = 0; /* Do not accept fragments */
329 cfblk->tstrttrs = 0; /* No start transmission threshold */ 329 cfblk->tstrttrs = 0; /* No start transmission threshold */
330 330
331 /* Byte E */ 331 /* Byte E */
332 cfblk->fretx = 1; /* FIFO automatic retransmission */ 332 cfblk->fretx = 1; /* FIFO automatic retransmission */
333 cfblk->runt_eop = 0; /* drop "runt" packets */ 333 cfblk->runt_eop = 0; /* drop "runt" packets */
@@ -350,7 +350,7 @@ static void znet_set_multicast_list (struct net_device *dev)
350 printk ("%02X ", c[i]); 350 printk ("%02X ", c[i]);
351 printk ("\n"); 351 printk ("\n");
352 } 352 }
353 353
354 *znet->tx_cur++ = sizeof(struct i82593_conf_block); 354 *znet->tx_cur++ = sizeof(struct i82593_conf_block);
355 memcpy(znet->tx_cur, cfblk, sizeof(struct i82593_conf_block)); 355 memcpy(znet->tx_cur, cfblk, sizeof(struct i82593_conf_block));
356 znet->tx_cur += sizeof(struct i82593_conf_block)/2; 356 znet->tx_cur += sizeof(struct i82593_conf_block)/2;
@@ -359,7 +359,7 @@ static void znet_set_multicast_list (struct net_device *dev)
359 /* XXX FIXME maz : Add multicast addresses here, so having a 359 /* XXX FIXME maz : Add multicast addresses here, so having a
360 * multicast address configured isn't equal to IFF_ALLMULTI */ 360 * multicast address configured isn't equal to IFF_ALLMULTI */
361} 361}
362 362
363/* The Z-Note probe is pretty easy. The NETIDBLK exists in the safe-to-probe 363/* The Z-Note probe is pretty easy. The NETIDBLK exists in the safe-to-probe
364 BIOS area. We just scan for the signature, and pull the vital parameters 364 BIOS area. We just scan for the signature, and pull the vital parameters
365 out of the structure. */ 365 out of the structure. */
@@ -438,7 +438,7 @@ static int __init znet_probe (void)
438 printk (KERN_WARNING "tx/rx crossing DMA frontiers, giving up\n"); 438 printk (KERN_WARNING "tx/rx crossing DMA frontiers, giving up\n");
439 goto free_tx; 439 goto free_tx;
440 } 440 }
441 441
442 znet->rx_end = znet->rx_start + RX_BUF_SIZE/2; 442 znet->rx_end = znet->rx_start + RX_BUF_SIZE/2;
443 znet->tx_buf_len = TX_BUF_SIZE/2; 443 znet->tx_buf_len = TX_BUF_SIZE/2;
444 znet->tx_end = znet->tx_start + znet->tx_buf_len; 444 znet->tx_end = znet->tx_start + znet->tx_buf_len;
@@ -466,7 +466,7 @@ static int __init znet_probe (void)
466 return err; 466 return err;
467} 467}
468 468
469 469
470static int znet_open(struct net_device *dev) 470static int znet_open(struct net_device *dev)
471{ 471{
472 int ioaddr = dev->base_addr; 472 int ioaddr = dev->base_addr;
@@ -481,7 +481,7 @@ static int znet_open(struct net_device *dev)
481 } 481 }
482 482
483 znet_transceiver_power (dev, 1); 483 znet_transceiver_power (dev, 1);
484 484
485 /* According to the Crynwr driver we should wait 50 msec. for the 485 /* According to the Crynwr driver we should wait 50 msec. for the
486 LAN clock to stabilize. My experiments indicates that the '593 can 486 LAN clock to stabilize. My experiments indicates that the '593 can
487 be initialized immediately. The delay is probably needed for the 487 be initialized immediately. The delay is probably needed for the
@@ -496,7 +496,7 @@ static int znet_open(struct net_device *dev)
496 * all, even if the message is completly harmless on my 496 * all, even if the message is completly harmless on my
497 * setup. */ 497 * setup. */
498 mdelay (50); 498 mdelay (50);
499 499
500 /* This follows the packet driver's lead, and checks for success. */ 500 /* This follows the packet driver's lead, and checks for success. */
501 if (inb(ioaddr) != 0x10 && inb(ioaddr) != 0x00) 501 if (inb(ioaddr) != 0x10 && inb(ioaddr) != 0x00)
502 printk(KERN_WARNING "%s: Problem turning on the transceiver power.\n", 502 printk(KERN_WARNING "%s: Problem turning on the transceiver power.\n",
@@ -547,9 +547,9 @@ static int znet_send_packet(struct sk_buff *skb, struct net_device *dev)
547 return 0; 547 return 0;
548 length = ETH_ZLEN; 548 length = ETH_ZLEN;
549 } 549 }
550 550
551 netif_stop_queue (dev); 551 netif_stop_queue (dev);
552 552
553 /* Check that the part hasn't reset itself, probably from suspend. */ 553 /* Check that the part hasn't reset itself, probably from suspend. */
554 outb(CR0_STATUS_0, ioaddr); 554 outb(CR0_STATUS_0, ioaddr);
555 if (inw(ioaddr) == 0x0010 && 555 if (inw(ioaddr) == 0x0010 &&
@@ -565,7 +565,7 @@ static int znet_send_packet(struct sk_buff *skb, struct net_device *dev)
565 unsigned char *buf = (void *)skb->data; 565 unsigned char *buf = (void *)skb->data;
566 ushort *tx_link = znet->tx_cur - 1; 566 ushort *tx_link = znet->tx_cur - 1;
567 ushort rnd_len = (length + 1)>>1; 567 ushort rnd_len = (length + 1)>>1;
568 568
569 znet->stats.tx_bytes+=length; 569 znet->stats.tx_bytes+=length;
570 570
571 if (znet->tx_cur >= znet->tx_end) 571 if (znet->tx_cur >= znet->tx_end)
@@ -597,7 +597,7 @@ static int znet_send_packet(struct sk_buff *skb, struct net_device *dev)
597 if (znet_debug > 4) 597 if (znet_debug > 4)
598 printk(KERN_DEBUG "%s: Transmitter queued, length %d.\n", dev->name, length); 598 printk(KERN_DEBUG "%s: Transmitter queued, length %d.\n", dev->name, length);
599 } 599 }
600 dev_kfree_skb(skb); 600 dev_kfree_skb(skb);
601 return 0; 601 return 0;
602} 602}
603 603
@@ -616,7 +616,7 @@ static irqreturn_t znet_interrupt(int irq, void *dev_id, struct pt_regs * regs)
616 } 616 }
617 617
618 spin_lock (&znet->lock); 618 spin_lock (&znet->lock);
619 619
620 ioaddr = dev->base_addr; 620 ioaddr = dev->base_addr;
621 621
622 outb(CR0_STATUS_0, ioaddr); 622 outb(CR0_STATUS_0, ioaddr);
@@ -666,7 +666,7 @@ static irqreturn_t znet_interrupt(int irq, void *dev_id, struct pt_regs * regs)
666 * packet. Flip it off, then on to 666 * packet. Flip it off, then on to
667 * reset it. This is very empirical, 667 * reset it. This is very empirical,
668 * but it seems to work. */ 668 * but it seems to work. */
669 669
670 znet_transceiver_power (dev, 0); 670 znet_transceiver_power (dev, 0);
671 znet_transceiver_power (dev, 1); 671 znet_transceiver_power (dev, 1);
672 } 672 }
@@ -682,7 +682,7 @@ static irqreturn_t znet_interrupt(int irq, void *dev_id, struct pt_regs * regs)
682 } while (boguscnt--); 682 } while (boguscnt--);
683 683
684 spin_unlock (&znet->lock); 684 spin_unlock (&znet->lock);
685 685
686 return IRQ_RETVAL(handled); 686 return IRQ_RETVAL(handled);
687} 687}
688 688
@@ -748,7 +748,7 @@ static void znet_rx(struct net_device *dev)
748 ushort *this_rfp_ptr = znet->rx_start + next_frame_end_offset; 748 ushort *this_rfp_ptr = znet->rx_start + next_frame_end_offset;
749 int status = this_rfp_ptr[-4]; 749 int status = this_rfp_ptr[-4];
750 int pkt_len = this_rfp_ptr[-2]; 750 int pkt_len = this_rfp_ptr[-2];
751 751
752 if (znet_debug > 5) 752 if (znet_debug > 5)
753 printk(KERN_DEBUG "Looking at trailer ending at %04x status %04x length %03x" 753 printk(KERN_DEBUG "Looking at trailer ending at %04x status %04x length %03x"
754 " next %04x.\n", next_frame_end_offset<<1, status, pkt_len, 754 " next %04x.\n", next_frame_end_offset<<1, status, pkt_len,
@@ -829,9 +829,9 @@ static int znet_close(struct net_device *dev)
829 printk(KERN_DEBUG "%s: Shutting down ethercard.\n", dev->name); 829 printk(KERN_DEBUG "%s: Shutting down ethercard.\n", dev->name);
830 /* Turn off transceiver power. */ 830 /* Turn off transceiver power. */
831 znet_transceiver_power (dev, 0); 831 znet_transceiver_power (dev, 0);
832 832
833 znet_release_resources (dev); 833 znet_release_resources (dev);
834 834
835 return 0; 835 return 0;
836} 836}
837 837
@@ -856,7 +856,7 @@ static void show_dma(struct net_device *dev)
856 856
857 addr |= inb(dma_port) << 8; 857 addr |= inb(dma_port) << 8;
858 residue = get_dma_residue(znet->tx_dma); 858 residue = get_dma_residue(znet->tx_dma);
859 859
860 if (znet_debug > 1) { 860 if (znet_debug > 1) {
861 flags=claim_dma_lock(); 861 flags=claim_dma_lock();
862 printk(KERN_DEBUG "Stat:%02x Addr: %04x cnt:%3x\n", 862 printk(KERN_DEBUG "Stat:%02x Addr: %04x cnt:%3x\n",
@@ -894,7 +894,7 @@ static void hardware_init(struct net_device *dev)
894 set_dma_count(znet->tx_dma, znet->tx_buf_len<<1); 894 set_dma_count(znet->tx_dma, znet->tx_buf_len<<1);
895 enable_dma(znet->tx_dma); 895 enable_dma(znet->tx_dma);
896 release_dma_lock(flags); 896 release_dma_lock(flags);
897 897
898 if (znet_debug > 1) 898 if (znet_debug > 1)
899 printk(KERN_DEBUG "%s: Initializing the i82593, rx buf %p tx buf %p\n", 899 printk(KERN_DEBUG "%s: Initializing the i82593, rx buf %p tx buf %p\n",
900 dev->name, znet->rx_start,znet->tx_start); 900 dev->name, znet->rx_start,znet->tx_start);