aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/7990.c
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2006-09-13 13:24:59 -0400
committerJeff Garzik <jeff@garzik.org>2006-09-13 13:24:59 -0400
commit6aa20a2235535605db6d6d2bd850298b2fe7f31e (patch)
treedf0b855043407b831d57f2f2c271f8aab48444f4 /drivers/net/7990.c
parent7a291083225af6e22ffaa46b3d91cfc1a1ccaab4 (diff)
drivers/net: Trim trailing whitespace
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/7990.c')
-rw-r--r--drivers/net/7990.c60
1 files changed, 30 insertions, 30 deletions
diff --git a/drivers/net/7990.c b/drivers/net/7990.c
index 86633c5f1a4b..db7b19a5cd59 100644
--- a/drivers/net/7990.c
+++ b/drivers/net/7990.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * 7990.c -- LANCE ethernet IC generic routines. 2 * 7990.c -- LANCE ethernet IC generic routines.
3 * This is an attempt to separate out the bits of various ethernet 3 * This is an attempt to separate out the bits of various ethernet
4 * drivers that are common because they all use the AMD 7990 LANCE 4 * drivers that are common because they all use the AMD 7990 LANCE
5 * (Local Area Network Controller for Ethernet) chip. 5 * (Local Area Network Controller for Ethernet) chip.
6 * 6 *
7 * Copyright (C) 05/1998 Peter Maydell <pmaydell@chiark.greenend.org.uk> 7 * Copyright (C) 05/1998 Peter Maydell <pmaydell@chiark.greenend.org.uk>
@@ -9,7 +9,7 @@
9 * Most of this stuff was obtained by looking at other LANCE drivers, 9 * Most of this stuff was obtained by looking at other LANCE drivers,
10 * in particular a2065.[ch]. The AMD C-LANCE datasheet was also helpful. 10 * in particular a2065.[ch]. The AMD C-LANCE datasheet was also helpful.
11 * NB: this was made easy by the fact that Jes Sorensen had cleaned up 11 * NB: this was made easy by the fact that Jes Sorensen had cleaned up
12 * most of a2025 and sunlance with the aim of merging them, so the 12 * most of a2025 and sunlance with the aim of merging them, so the
13 * common code was pretty obvious. 13 * common code was pretty obvious.
14 */ 14 */
15#include <linux/crc32.h> 15#include <linux/crc32.h>
@@ -109,10 +109,10 @@ do { \
109 ib->btx_ring[t].length,\ 109 ib->btx_ring[t].length,\
110 ib->btx_ring[t].misc, ib->btx_ring[t].tmd1_bits);\ 110 ib->btx_ring[t].misc, ib->btx_ring[t].tmd1_bits);\
111 }\ 111 }\
112} while (0) 112} while (0)
113#else 113#else
114#define PRINT_RINGS() 114#define PRINT_RINGS()
115#endif 115#endif
116 116
117/* Load the CSR registers. The LANCE has to be STOPped when we do this! */ 117/* Load the CSR registers. The LANCE has to be STOPped when we do this! */
118static void load_csrs (struct lance_private *lp) 118static void load_csrs (struct lance_private *lp)
@@ -157,7 +157,7 @@ static void lance_init_ring (struct net_device *dev)
157 * a2065 and atarilance do the byteswap and lance.c (PC) doesn't. 157 * a2065 and atarilance do the byteswap and lance.c (PC) doesn't.
158 * However, the datasheet says that the BSWAP bit doesn't affect 158 * However, the datasheet says that the BSWAP bit doesn't affect
159 * the init block, so surely it should be low byte first for 159 * the init block, so surely it should be low byte first for
160 * everybody? Um.] 160 * everybody? Um.]
161 * We could define the ib->physaddr as three 16bit values and 161 * We could define the ib->physaddr as three 16bit values and
162 * use (addr[1] << 8) | addr[0] & co, but this is more efficient. 162 * use (addr[1] << 8) | addr[0] & co, but this is more efficient.
163 */ 163 */
@@ -171,11 +171,11 @@ static void lance_init_ring (struct net_device *dev)
171#else 171#else
172 for (i=0; i<6; i++) 172 for (i=0; i<6; i++)
173 ib->phys_addr[i] = dev->dev_addr[i]; 173 ib->phys_addr[i] = dev->dev_addr[i];
174#endif 174#endif
175 175
176 if (DEBUG_IRING) 176 if (DEBUG_IRING)
177 printk ("TX rings:\n"); 177 printk ("TX rings:\n");
178 178
179 lp->tx_full = 0; 179 lp->tx_full = 0;
180 /* Setup the Tx ring entries */ 180 /* Setup the Tx ring entries */
181 for (i = 0; i < (1<<lp->lance_log_tx_bufs); i++) { 181 for (i = 0; i < (1<<lp->lance_log_tx_bufs); i++) {
@@ -185,7 +185,7 @@ static void lance_init_ring (struct net_device *dev)
185 ib->btx_ring [i].tmd1_bits = 0; 185 ib->btx_ring [i].tmd1_bits = 0;
186 ib->btx_ring [i].length = 0xf000; /* The ones required by tmd2 */ 186 ib->btx_ring [i].length = 0xf000; /* The ones required by tmd2 */
187 ib->btx_ring [i].misc = 0; 187 ib->btx_ring [i].misc = 0;
188 if (DEBUG_IRING) 188 if (DEBUG_IRING)
189 printk ("%d: 0x%8.8x\n", i, leptr); 189 printk ("%d: 0x%8.8x\n", i, leptr);
190 } 190 }
191 191
@@ -206,14 +206,14 @@ static void lance_init_ring (struct net_device *dev)
206 } 206 }
207 207
208 /* Setup the initialization block */ 208 /* Setup the initialization block */
209 209
210 /* Setup rx descriptor pointer */ 210 /* Setup rx descriptor pointer */
211 leptr = LANCE_ADDR(&aib->brx_ring); 211 leptr = LANCE_ADDR(&aib->brx_ring);
212 ib->rx_len = (lp->lance_log_rx_bufs << 13) | (leptr >> 16); 212 ib->rx_len = (lp->lance_log_rx_bufs << 13) | (leptr >> 16);
213 ib->rx_ptr = leptr; 213 ib->rx_ptr = leptr;
214 if (DEBUG_IRING) 214 if (DEBUG_IRING)
215 printk ("RX ptr: %8.8x\n", leptr); 215 printk ("RX ptr: %8.8x\n", leptr);
216 216
217 /* Setup tx descriptor pointer */ 217 /* Setup tx descriptor pointer */
218 leptr = LANCE_ADDR(&aib->btx_ring); 218 leptr = LANCE_ADDR(&aib->btx_ring);
219 ib->tx_len = (lp->lance_log_tx_bufs << 13) | (leptr >> 16); 219 ib->tx_len = (lp->lance_log_tx_bufs << 13) | (leptr >> 16);
@@ -256,7 +256,7 @@ static int lance_reset (struct net_device *dev)
256{ 256{
257 struct lance_private *lp = netdev_priv(dev); 257 struct lance_private *lp = netdev_priv(dev);
258 int status; 258 int status;
259 259
260 /* Stop the lance */ 260 /* Stop the lance */
261 WRITERAP(lp, LE_CSR0); 261 WRITERAP(lp, LE_CSR0);
262 WRITERDP(lp, LE_C0_STOP); 262 WRITERDP(lp, LE_C0_STOP);
@@ -297,7 +297,7 @@ static int lance_rx (struct net_device *dev)
297#endif 297#endif
298#ifdef CONFIG_HP300 298#ifdef CONFIG_HP300
299 blinken_leds(0x40, 0); 299 blinken_leds(0x40, 0);
300#endif 300#endif
301 WRITERDP(lp, LE_C0_RINT | LE_C0_INEA); /* ack Rx int, reenable ints */ 301 WRITERDP(lp, LE_C0_RINT | LE_C0_INEA); /* ack Rx int, reenable ints */
302 for (rd = &ib->brx_ring [lp->rx_new]; /* For each Rx ring we own... */ 302 for (rd = &ib->brx_ring [lp->rx_new]; /* For each Rx ring we own... */
303 !((bits = rd->rmd1_bits) & LE_R1_OWN); 303 !((bits = rd->rmd1_bits) & LE_R1_OWN);
@@ -330,7 +330,7 @@ static int lance_rx (struct net_device *dev)
330 lp->rx_new = (lp->rx_new + 1) & lp->rx_ring_mod_mask; 330 lp->rx_new = (lp->rx_new + 1) & lp->rx_ring_mod_mask;
331 return 0; 331 return 0;
332 } 332 }
333 333
334 skb->dev = dev; 334 skb->dev = dev;
335 skb_reserve (skb, 2); /* 16 byte align */ 335 skb_reserve (skb, 2); /* 16 byte align */
336 skb_put (skb, len); /* make room */ 336 skb_put (skb, len); /* make room */
@@ -374,10 +374,10 @@ static int lance_tx (struct net_device *dev)
374 /* If we hit a packet not owned by us, stop */ 374 /* If we hit a packet not owned by us, stop */
375 if (td->tmd1_bits & LE_T1_OWN) 375 if (td->tmd1_bits & LE_T1_OWN)
376 break; 376 break;
377 377
378 if (td->tmd1_bits & LE_T1_ERR) { 378 if (td->tmd1_bits & LE_T1_ERR) {
379 status = td->misc; 379 status = td->misc;
380 380
381 lp->stats.tx_errors++; 381 lp->stats.tx_errors++;
382 if (status & LE_T3_RTY) lp->stats.tx_aborted_errors++; 382 if (status & LE_T3_RTY) lp->stats.tx_aborted_errors++;
383 if (status & LE_T3_LCOL) lp->stats.tx_window_errors++; 383 if (status & LE_T3_LCOL) lp->stats.tx_window_errors++;
@@ -429,7 +429,7 @@ static int lance_tx (struct net_device *dev)
429 429
430 lp->stats.tx_packets++; 430 lp->stats.tx_packets++;
431 } 431 }
432 432
433 j = (j + 1) & lp->tx_ring_mod_mask; 433 j = (j + 1) & lp->tx_ring_mod_mask;
434 } 434 }
435 lp->tx_old = j; 435 lp->tx_old = j;
@@ -450,7 +450,7 @@ lance_interrupt (int irq, void *dev_id, struct pt_regs *regs)
450 csr0 = READRDP(lp); 450 csr0 = READRDP(lp);
451 451
452 PRINT_RINGS(); 452 PRINT_RINGS();
453 453
454 if (!(csr0 & LE_C0_INTR)) { /* Check if any interrupt has */ 454 if (!(csr0 & LE_C0_INTR)) { /* Check if any interrupt has */
455 spin_unlock (&lp->devlock); 455 spin_unlock (&lp->devlock);
456 return IRQ_NONE; /* been generated by the Lance. */ 456 return IRQ_NONE; /* been generated by the Lance. */
@@ -476,7 +476,7 @@ lance_interrupt (int irq, void *dev_id, struct pt_regs *regs)
476 if (csr0 & LE_C0_MISS) 476 if (csr0 & LE_C0_MISS)
477 lp->stats.rx_errors++; /* Missed a Rx frame. */ 477 lp->stats.rx_errors++; /* Missed a Rx frame. */
478 if (csr0 & LE_C0_MERR) { 478 if (csr0 & LE_C0_MERR) {
479 printk("%s: Bus master arbitration failure, status %4.4x.\n", 479 printk("%s: Bus master arbitration failure, status %4.4x.\n",
480 dev->name, csr0); 480 dev->name, csr0);
481 /* Restart the chip. */ 481 /* Restart the chip. */
482 WRITERDP(lp, LE_C0_STRT); 482 WRITERDP(lp, LE_C0_STRT);
@@ -486,7 +486,7 @@ lance_interrupt (int irq, void *dev_id, struct pt_regs *regs)
486 lp->tx_full = 0; 486 lp->tx_full = 0;
487 netif_wake_queue (dev); 487 netif_wake_queue (dev);
488 } 488 }
489 489
490 WRITERAP(lp, LE_CSR0); 490 WRITERAP(lp, LE_CSR0);
491 WRITERDP(lp, LE_C0_BABL|LE_C0_CERR|LE_C0_MISS|LE_C0_MERR|LE_C0_IDON|LE_C0_INEA); 491 WRITERDP(lp, LE_C0_BABL|LE_C0_CERR|LE_C0_MISS|LE_C0_MERR|LE_C0_IDON|LE_C0_INEA);
492 492
@@ -498,7 +498,7 @@ int lance_open (struct net_device *dev)
498{ 498{
499 struct lance_private *lp = netdev_priv(dev); 499 struct lance_private *lp = netdev_priv(dev);
500 int res; 500 int res;
501 501
502 /* Install the Interrupt handler. Or we could shunt this out to specific drivers? */ 502 /* Install the Interrupt handler. Or we could shunt this out to specific drivers? */
503 if (request_irq(lp->irq, lance_interrupt, 0, lp->name, dev)) 503 if (request_irq(lp->irq, lance_interrupt, 0, lp->name, dev))
504 return -EAGAIN; 504 return -EAGAIN;
@@ -513,7 +513,7 @@ int lance_open (struct net_device *dev)
513int lance_close (struct net_device *dev) 513int lance_close (struct net_device *dev)
514{ 514{
515 struct lance_private *lp = netdev_priv(dev); 515 struct lance_private *lp = netdev_priv(dev);
516 516
517 netif_stop_queue (dev); 517 netif_stop_queue (dev);
518 518
519 /* Stop the LANCE */ 519 /* Stop the LANCE */
@@ -553,7 +553,7 @@ int lance_start_xmit (struct sk_buff *skb, struct net_device *dev)
553 /* dump the packet */ 553 /* dump the packet */
554 { 554 {
555 int i; 555 int i;
556 556
557 for (i = 0; i < 64; i++) { 557 for (i = 0; i < 64; i++) {
558 if ((i % 16) == 0) 558 if ((i % 16) == 0)
559 printk ("\n"); 559 printk ("\n");
@@ -565,11 +565,11 @@ int lance_start_xmit (struct sk_buff *skb, struct net_device *dev)
565 entry = lp->tx_new & lp->tx_ring_mod_mask; 565 entry = lp->tx_new & lp->tx_ring_mod_mask;
566 ib->btx_ring [entry].length = (-len) | 0xf000; 566 ib->btx_ring [entry].length = (-len) | 0xf000;
567 ib->btx_ring [entry].misc = 0; 567 ib->btx_ring [entry].misc = 0;
568 568
569 if (skb->len < ETH_ZLEN) 569 if (skb->len < ETH_ZLEN)
570 memset((char *)&ib->tx_buf[entry][0], 0, ETH_ZLEN); 570 memset((char *)&ib->tx_buf[entry][0], 0, ETH_ZLEN);
571 memcpy ((char *)&ib->tx_buf [entry][0], skb->data, skblen); 571 memcpy ((char *)&ib->tx_buf [entry][0], skb->data, skblen);
572 572
573 /* Now, give the packet to the lance */ 573 /* Now, give the packet to the lance */
574 ib->btx_ring [entry].tmd1_bits = (LE_T1_POK|LE_T1_OWN); 574 ib->btx_ring [entry].tmd1_bits = (LE_T1_POK|LE_T1_OWN);
575 lp->tx_new = (lp->tx_new+1) & lp->tx_ring_mod_mask; 575 lp->tx_new = (lp->tx_new+1) & lp->tx_ring_mod_mask;
@@ -579,7 +579,7 @@ int lance_start_xmit (struct sk_buff *skb, struct net_device *dev)
579 WRITERDP(lp, LE_C0_INEA | LE_C0_TDMD); 579 WRITERDP(lp, LE_C0_INEA | LE_C0_TDMD);
580 dev->trans_start = jiffies; 580 dev->trans_start = jiffies;
581 dev_kfree_skb (skb); 581 dev_kfree_skb (skb);
582 582
583 spin_lock_irqsave (&lp->devlock, flags); 583 spin_lock_irqsave (&lp->devlock, flags);
584 if (TX_BUFFS_AVAIL) 584 if (TX_BUFFS_AVAIL)
585 netif_start_queue (dev); 585 netif_start_queue (dev);
@@ -607,9 +607,9 @@ static void lance_load_multicast (struct net_device *dev)
607 char *addrs; 607 char *addrs;
608 int i; 608 int i;
609 u32 crc; 609 u32 crc;
610 610
611 /* set all multicast bits */ 611 /* set all multicast bits */
612 if (dev->flags & IFF_ALLMULTI){ 612 if (dev->flags & IFF_ALLMULTI){
613 ib->filter [0] = 0xffffffff; 613 ib->filter [0] = 0xffffffff;
614 ib->filter [1] = 0xffffffff; 614 ib->filter [1] = 0xffffffff;
615 return; 615 return;
@@ -626,7 +626,7 @@ static void lance_load_multicast (struct net_device *dev)
626 /* multicast address? */ 626 /* multicast address? */
627 if (!(*addrs & 1)) 627 if (!(*addrs & 1))
628 continue; 628 continue;
629 629
630 crc = ether_crc_le(6, addrs); 630 crc = ether_crc_le(6, addrs);
631 crc = crc >> 26; 631 crc = crc >> 26;
632 mcast_table [crc >> 4] |= 1 << (crc & 0xf); 632 mcast_table [crc >> 4] |= 1 << (crc & 0xf);