Lines Matching full:lp
45 #define WRITERAP(lp, x) out_be16(lp->base + LANCE_RAP, (x)) argument
46 #define WRITERDP(lp, x) out_be16(lp->base + LANCE_RDP, (x)) argument
47 #define READRDP(lp) in_be16(lp->base + LANCE_RDP) argument
59 #define WRITERAP(lp, x) (lp->writerap(lp, x)) argument
60 #define WRITERDP(lp, x) (lp->writerdp(lp, x)) argument
61 #define READRDP(lp) (lp->readrdp(lp)) argument
66 static inline void WRITERAP(struct lance_private *lp, __u16 value) in WRITERAP() argument
69 out_be16(lp->base + HPLANCE_REGOFF + LANCE_RAP, value); in WRITERAP()
70 } while ((in_8(lp->base + HPLANCE_STATUS) & LE_ACK) == 0); in WRITERAP()
73 static inline void WRITERDP(struct lance_private *lp, __u16 value) in WRITERDP() argument
76 out_be16(lp->base + HPLANCE_REGOFF + LANCE_RDP, value); in WRITERDP()
77 } while ((in_8(lp->base + HPLANCE_STATUS) & LE_ACK) == 0); in WRITERDP()
80 static inline __u16 READRDP(struct lance_private *lp) in READRDP() argument
84 value = in_be16(lp->base + HPLANCE_REGOFF + LANCE_RDP); in READRDP()
85 } while ((in_8(lp->base + HPLANCE_STATUS) & LE_ACK) == 0); in READRDP()
116 static void load_csrs(struct lance_private *lp) in load_csrs() argument
118 volatile struct lance_init_block *aib = lp->lance_init_block; in load_csrs()
123 WRITERAP(lp, LE_CSR1); /* load address of init block */ in load_csrs()
124 WRITERDP(lp, leptr & 0xFFFF); in load_csrs()
125 WRITERAP(lp, LE_CSR2); in load_csrs()
126 WRITERDP(lp, leptr >> 16); in load_csrs()
127 WRITERAP(lp, LE_CSR3); in load_csrs()
128 WRITERDP(lp, lp->busmaster_regval); /* set byteswap/ALEctrl/byte ctrl */ in load_csrs()
131 WRITERAP(lp, LE_CSR0); in load_csrs()
139 struct lance_private *lp = netdev_priv(dev); in lance_init_ring() local
140 volatile struct lance_init_block *ib = lp->init_block; in lance_init_ring()
145 aib = lp->lance_init_block; in lance_init_ring()
147 lp->rx_new = lp->tx_new = 0; in lance_init_ring()
148 lp->rx_old = lp->tx_old = 0; in lance_init_ring()
177 lp->tx_full = 0; in lance_init_ring()
179 for (i = 0; i < (1 << lp->lance_log_tx_bufs); i++) { in lance_init_ring()
193 for (i = 0; i < (1 << lp->lance_log_rx_bufs); i++) { in lance_init_ring()
210 ib->rx_len = (lp->lance_log_rx_bufs << 13) | (leptr >> 16); in lance_init_ring()
217 ib->tx_len = (lp->lance_log_tx_bufs << 13) | (leptr >> 16); in lance_init_ring()
229 static int init_restart_lance(struct lance_private *lp) in init_restart_lance() argument
233 WRITERAP(lp, LE_CSR0); in init_restart_lance()
234 WRITERDP(lp, LE_C0_INIT); in init_restart_lance()
239 for (i = 0; (i < 100) && !(READRDP(lp) & (LE_C0_ERR | LE_C0_IDON)); i++) in init_restart_lance()
241 if ((i == 100) || (READRDP(lp) & LE_C0_ERR)) { in init_restart_lance()
242 printk("LANCE unopened after %d ticks, csr0=%4.4x.\n", i, READRDP(lp)); in init_restart_lance()
247 WRITERDP(lp, LE_C0_IDON); in init_restart_lance()
248 WRITERDP(lp, LE_C0_INEA | LE_C0_STRT); in init_restart_lance()
255 struct lance_private *lp = netdev_priv(dev); in lance_reset() local
259 WRITERAP(lp, LE_CSR0); in lance_reset()
260 WRITERDP(lp, LE_C0_STOP); in lance_reset()
262 load_csrs(lp); in lance_reset()
265 status = init_restart_lance(lp); in lance_reset()
274 struct lance_private *lp = netdev_priv(dev); in lance_rx() local
275 volatile struct lance_init_block *ib = lp->init_block; in lance_rx()
285 if (i == lp->rx_new) in lance_rx()
297 WRITERDP(lp, LE_C0_RINT | LE_C0_INEA); /* ack Rx int, reenable ints */ in lance_rx()
298 for (rd = &ib->brx_ring[lp->rx_new]; /* For each Rx ring we own... */ in lance_rx()
300 rd = &ib->brx_ring[lp->rx_new]) { in lance_rx()
329 lp->rx_new = (lp->rx_new + 1) & lp->rx_ring_mod_mask; in lance_rx()
336 (unsigned char *)&(ib->rx_buf[lp->rx_new][0]), in lance_rx()
347 lp->rx_new = (lp->rx_new + 1) & lp->rx_ring_mod_mask; in lance_rx()
354 struct lance_private *lp = netdev_priv(dev); in lance_tx() local
355 volatile struct lance_init_block *ib = lp->init_block; in lance_tx()
364 WRITERDP(lp, LE_C0_TINT | LE_C0_INEA); in lance_tx()
367 j = lp->tx_old; in lance_tx()
368 for (i = j; i != lp->tx_new; i = j) { in lance_tx()
386 if (lp->auto_select) { in lance_tx()
387 lp->tpe = 1 - lp->tpe; in lance_tx()
390 lp->tpe ? "TPE" : "AUI"); in lance_tx()
392 WRITERAP(lp, LE_CSR0); in lance_tx()
393 WRITERDP(lp, LE_C0_STOP); in lance_tx()
395 load_csrs(lp); in lance_tx()
396 init_restart_lance(lp); in lance_tx()
409 WRITERAP(lp, LE_CSR0); in lance_tx()
410 WRITERDP(lp, LE_C0_STOP); in lance_tx()
412 load_csrs(lp); in lance_tx()
413 init_restart_lance(lp); in lance_tx()
433 j = (j + 1) & lp->tx_ring_mod_mask; in lance_tx()
435 lp->tx_old = j; in lance_tx()
436 WRITERDP(lp, LE_C0_TINT | LE_C0_INEA); in lance_tx()
444 struct lance_private *lp = netdev_priv(dev); in lance_interrupt() local
447 spin_lock(&lp->devlock); in lance_interrupt()
449 WRITERAP(lp, LE_CSR0); /* LANCE Controller Status */ in lance_interrupt()
450 csr0 = READRDP(lp); in lance_interrupt()
455 spin_unlock(&lp->devlock); in lance_interrupt()
460 WRITERDP(lp, csr0 & ~(LE_C0_INEA|LE_C0_TDMD|LE_C0_STOP|LE_C0_STRT|LE_C0_INIT)); in lance_interrupt()
464 WRITERDP(lp, LE_C0_BABL|LE_C0_ERR|LE_C0_MISS|LE_C0_INEA); in lance_interrupt()
482 WRITERDP(lp, LE_C0_STRT); in lance_interrupt()
485 if (lp->tx_full && netif_queue_stopped(dev) && (TX_BUFFS_AVAIL >= 0)) { in lance_interrupt()
486 lp->tx_full = 0; in lance_interrupt()
490 WRITERAP(lp, LE_CSR0); in lance_interrupt()
491 WRITERDP(lp, LE_C0_BABL|LE_C0_CERR|LE_C0_MISS|LE_C0_MERR|LE_C0_IDON|LE_C0_INEA); in lance_interrupt()
493 spin_unlock(&lp->devlock); in lance_interrupt()
499 struct lance_private *lp = netdev_priv(dev); in lance_open() local
503 if (request_irq(lp->irq, lance_interrupt, IRQF_SHARED, lp->name, dev)) in lance_open()
507 spin_lock_init(&lp->devlock); in lance_open()
516 struct lance_private *lp = netdev_priv(dev); in lance_close() local
521 WRITERAP(lp, LE_CSR0); in lance_close()
522 WRITERDP(lp, LE_C0_STOP); in lance_close()
524 free_irq(lp->irq, dev); in lance_close()
541 struct lance_private *lp = netdev_priv(dev); in lance_start_xmit() local
542 volatile struct lance_init_block *ib = lp->init_block; in lance_start_xmit()
569 entry = lp->tx_new & lp->tx_ring_mod_mask; in lance_start_xmit()
579 lp->tx_new = (lp->tx_new + 1) & lp->tx_ring_mod_mask; in lance_start_xmit()
583 WRITERDP(lp, LE_C0_INEA | LE_C0_TDMD); in lance_start_xmit()
586 spin_lock_irqsave(&lp->devlock, flags); in lance_start_xmit()
590 lp->tx_full = 1; in lance_start_xmit()
591 spin_unlock_irqrestore(&lp->devlock, flags); in lance_start_xmit()
600 struct lance_private *lp = netdev_priv(dev); in lance_load_multicast() local
601 volatile struct lance_init_block *ib = lp->init_block; in lance_load_multicast()
627 struct lance_private *lp = netdev_priv(dev); in lance_set_multicast() local
628 volatile struct lance_init_block *ib = lp->init_block; in lance_set_multicast()
635 while (lp->tx_old != lp->tx_new) in lance_set_multicast()
638 WRITERAP(lp, LE_CSR0); in lance_set_multicast()
639 WRITERDP(lp, LE_C0_STOP); in lance_set_multicast()
648 load_csrs(lp); in lance_set_multicast()
649 init_restart_lance(lp); in lance_set_multicast()
659 struct lance_private *lp = netdev_priv(dev); in lance_poll() local
661 spin_lock(&lp->devlock); in lance_poll()
662 WRITERAP(lp, LE_CSR0); in lance_poll()
663 WRITERDP(lp, LE_C0_STRT); in lance_poll()
664 spin_unlock(&lp->devlock); in lance_poll()