Lines Matching full:lp

275 #define TX_BUFFS_AVAIL ((lp->tx_old<=lp->tx_new)?\
276 lp->tx_old+TX_RING_MOD_MASK-lp->tx_new:\
277 lp->tx_old - lp->tx_new-1)
303 static void load_csrs(struct lance_private *lp) in load_csrs() argument
305 volatile struct lance_regs *ll = lp->ll; in load_csrs()
318 writereg(&ll->rdp, lp->busmaster_regval); in load_csrs()
452 struct lance_private *lp = netdev_priv(dev); in lance_init_ring() local
459 lp->rx_new = lp->tx_new = 0; in lance_init_ring()
460 lp->rx_old = lp->tx_old = 0; in lance_init_ring()
465 *lib_ptr(ib, phys_addr[0], lp->type) = (dev->dev_addr[1] << 8) | in lance_init_ring()
467 *lib_ptr(ib, phys_addr[1], lp->type) = (dev->dev_addr[3] << 8) | in lance_init_ring()
469 *lib_ptr(ib, phys_addr[2], lp->type) = (dev->dev_addr[5] << 8) | in lance_init_ring()
475 *lib_ptr(ib, rx_len, lp->type) = (LANCE_LOG_RX_BUFFERS << 13) | in lance_init_ring()
477 *lib_ptr(ib, rx_ptr, lp->type) = leptr; in lance_init_ring()
480 leptr, (uint)lib_off(brx_ring, lp->type)); in lance_init_ring()
484 *lib_ptr(ib, tx_len, lp->type) = (LANCE_LOG_TX_BUFFERS << 13) | in lance_init_ring()
486 *lib_ptr(ib, tx_ptr, lp->type) = leptr; in lance_init_ring()
489 leptr, (uint)lib_off(btx_ring, lp->type)); in lance_init_ring()
496 leptr = lp->tx_buf_ptr_lnc[i]; in lance_init_ring()
497 *lib_ptr(ib, btx_ring[i].tmd0, lp->type) = leptr; in lance_init_ring()
498 *lib_ptr(ib, btx_ring[i].tmd1, lp->type) = (leptr >> 16) & in lance_init_ring()
500 *lib_ptr(ib, btx_ring[i].length, lp->type) = 0xf000; in lance_init_ring()
502 *lib_ptr(ib, btx_ring[i].misc, lp->type) = 0; in lance_init_ring()
505 i, leptr, lp->tx_buf_ptr_cpu[i]); in lance_init_ring()
512 leptr = lp->rx_buf_ptr_lnc[i]; in lance_init_ring()
513 *lib_ptr(ib, brx_ring[i].rmd0, lp->type) = leptr; in lance_init_ring()
514 *lib_ptr(ib, brx_ring[i].rmd1, lp->type) = ((leptr >> 16) & in lance_init_ring()
517 *lib_ptr(ib, brx_ring[i].length, lp->type) = -RX_BUFF_SIZE | in lance_init_ring()
519 *lib_ptr(ib, brx_ring[i].mblength, lp->type) = 0; in lance_init_ring()
522 i, leptr, lp->rx_buf_ptr_cpu[i]); in lance_init_ring()
527 static int init_restart_lance(struct lance_private *lp) in init_restart_lance() argument
529 volatile struct lance_regs *ll = lp->ll; in init_restart_lance()
558 struct lance_private *lp = netdev_priv(dev); in lance_rx() local
571 if (i == lp->rx_new) in lance_rx()
573 lp->type) & in lance_rx()
577 lp->type) & in lance_rx()
584 for (rd = lib_ptr(ib, brx_ring[lp->rx_new], lp->type); in lance_rx()
585 !((bits = *rds_ptr(rd, rmd1, lp->type)) & LE_R1_OWN); in lance_rx()
586 rd = lib_ptr(ib, brx_ring[lp->rx_new], lp->type)) { in lance_rx()
587 entry = lp->rx_new; in lance_rx()
608 len = (*rds_ptr(rd, mblength, lp->type) & 0xfff) - 4; in lance_rx()
613 *rds_ptr(rd, mblength, lp->type) = 0; in lance_rx()
614 *rds_ptr(rd, rmd1, lp->type) = in lance_rx()
615 ((lp->rx_buf_ptr_lnc[entry] >> 16) & in lance_rx()
617 lp->rx_new = (entry + 1) & RX_RING_MOD_MASK; in lance_rx()
625 cp_from_buf(lp->type, skb->data, in lance_rx()
626 lp->rx_buf_ptr_cpu[entry], len); in lance_rx()
634 *rds_ptr(rd, mblength, lp->type) = 0; in lance_rx()
635 *rds_ptr(rd, length, lp->type) = -RX_BUFF_SIZE | 0xf000; in lance_rx()
636 *rds_ptr(rd, rmd1, lp->type) = in lance_rx()
637 ((lp->rx_buf_ptr_lnc[entry] >> 16) & 0xff) | LE_R1_OWN; in lance_rx()
638 lp->rx_new = (entry + 1) & RX_RING_MOD_MASK; in lance_rx()
645 struct lance_private *lp = netdev_priv(dev); in lance_tx() local
647 volatile struct lance_regs *ll = lp->ll; in lance_tx()
652 j = lp->tx_old; in lance_tx()
654 spin_lock(&lp->lock); in lance_tx()
656 for (i = j; i != lp->tx_new; i = j) { in lance_tx()
657 td = lib_ptr(ib, btx_ring[i], lp->type); in lance_tx()
659 if (*tds_ptr(td, tmd1, lp->type) & LE_T1_OWN) in lance_tx()
662 if (*tds_ptr(td, tmd1, lp->type) & LE_T1_ERR) { in lance_tx()
663 status = *tds_ptr(td, misc, lp->type); in lance_tx()
678 load_csrs(lp); in lance_tx()
679 init_restart_lance(lp); in lance_tx()
694 load_csrs(lp); in lance_tx()
695 init_restart_lance(lp); in lance_tx()
698 } else if ((*tds_ptr(td, tmd1, lp->type) & LE_T1_POK) == in lance_tx()
703 *tds_ptr(td, tmd1, lp->type) &= ~(LE_T1_POK); in lance_tx()
706 if (*tds_ptr(td, tmd1, lp->type) & LE_T1_EONE) in lance_tx()
710 if (*tds_ptr(td, tmd1, lp->type) & LE_T1_EMORE) in lance_tx()
717 lp->tx_old = j; in lance_tx()
723 spin_unlock(&lp->lock); in lance_tx()
737 struct lance_private *lp = netdev_priv(dev); in lance_interrupt() local
738 volatile struct lance_regs *ll = lp->ll; in lance_interrupt()
770 load_csrs(lp); in lance_interrupt()
771 init_restart_lance(lp); in lance_interrupt()
783 struct lance_private *lp = netdev_priv(dev); in lance_open() local
784 volatile struct lance_regs *ll = lp->ll; in lance_open()
797 *lib_ptr(ib, mode, lp->type) = 0; in lance_open()
798 *lib_ptr(ib, filter[0], lp->type) = 0; in lance_open()
799 *lib_ptr(ib, filter[1], lp->type) = 0; in lance_open()
800 *lib_ptr(ib, filter[2], lp->type) = 0; in lance_open()
801 *lib_ptr(ib, filter[3], lp->type) = 0; in lance_open()
804 load_csrs(lp); in lance_open()
813 if (lp->dma_irq >= 0) { in lance_open()
816 if (request_irq(lp->dma_irq, lance_dma_merr_int, IRQF_ONESHOT, in lance_open()
820 lp->dma_irq); in lance_open()
835 status = init_restart_lance(lp); in lance_open()
841 struct lance_private *lp = netdev_priv(dev); in lance_close() local
842 volatile struct lance_regs *ll = lp->ll; in lance_close()
845 timer_delete_sync(&lp->multicast_timer); in lance_close()
851 if (lp->dma_irq >= 0) { in lance_close()
864 free_irq(lp->dma_irq, dev); in lance_close()
872 struct lance_private *lp = netdev_priv(dev); in lance_reset() local
873 volatile struct lance_regs *ll = lp->ll; in lance_reset()
881 load_csrs(lp); in lance_reset()
883 status = init_restart_lance(lp); in lance_reset()
889 struct lance_private *lp = netdev_priv(dev); in lance_tx_timeout() local
890 volatile struct lance_regs *ll = lp->ll; in lance_tx_timeout()
900 struct lance_private *lp = netdev_priv(dev); in lance_start_xmit() local
901 volatile struct lance_regs *ll = lp->ll; in lance_start_xmit()
916 spin_lock_irqsave(&lp->lock, flags); in lance_start_xmit()
918 entry = lp->tx_new; in lance_start_xmit()
919 *lib_ptr(ib, btx_ring[entry].length, lp->type) = (-len); in lance_start_xmit()
920 *lib_ptr(ib, btx_ring[entry].misc, lp->type) = 0; in lance_start_xmit()
922 cp_to_buf(lp->type, lp->tx_buf_ptr_cpu[entry], skb->data, len); in lance_start_xmit()
925 *lib_ptr(ib, btx_ring[entry].tmd1, lp->type) = in lance_start_xmit()
926 ((lp->tx_buf_ptr_lnc[entry] >> 16) & 0xff) | in lance_start_xmit()
928 lp->tx_new = (entry + 1) & TX_RING_MOD_MASK; in lance_start_xmit()
936 spin_unlock_irqrestore(&lp->lock, flags); in lance_start_xmit()
945 struct lance_private *lp = netdev_priv(dev); in lance_load_multicast() local
952 *lib_ptr(ib, filter[0], lp->type) = 0xffff; in lance_load_multicast()
953 *lib_ptr(ib, filter[1], lp->type) = 0xffff; in lance_load_multicast()
954 *lib_ptr(ib, filter[2], lp->type) = 0xffff; in lance_load_multicast()
955 *lib_ptr(ib, filter[3], lp->type) = 0xffff; in lance_load_multicast()
959 *lib_ptr(ib, filter[0], lp->type) = 0; in lance_load_multicast()
960 *lib_ptr(ib, filter[1], lp->type) = 0; in lance_load_multicast()
961 *lib_ptr(ib, filter[2], lp->type) = 0; in lance_load_multicast()
962 *lib_ptr(ib, filter[3], lp->type) = 0; in lance_load_multicast()
968 *lib_ptr(ib, filter[crc >> 4], lp->type) |= 1 << (crc & 0xf); in lance_load_multicast()
974 struct lance_private *lp = netdev_priv(dev); in lance_set_multicast() local
976 volatile struct lance_regs *ll = lp->ll; in lance_set_multicast()
981 if (lp->tx_old != lp->tx_new) { in lance_set_multicast()
982 mod_timer(&lp->multicast_timer, jiffies + 4 * HZ/100); in lance_set_multicast()
995 *lib_ptr(ib, mode, lp->type) |= LE_MO_PROM; in lance_set_multicast()
997 *lib_ptr(ib, mode, lp->type) &= ~LE_MO_PROM; in lance_set_multicast()
1000 load_csrs(lp); in lance_set_multicast()
1001 init_restart_lance(lp); in lance_set_multicast()
1007 struct lance_private *lp = timer_container_of(lp, t, multicast_timer); in lance_set_multicast_retry() local
1008 struct net_device *dev = lp->dev; in lance_set_multicast_retry()
1029 struct lance_private *lp; in dec_lance_probe() local
1048 lp = netdev_priv(dev); in dec_lance_probe()
1049 dev = lp->next; in dec_lance_probe()
1064 lp = netdev_priv(dev); in dec_lance_probe()
1065 spin_lock_init(&lp->lock); in dec_lance_probe()
1067 lp->type = type; in dec_lance_probe()
1089 lp->rx_buf_ptr_cpu[i] = in dec_lance_probe()
1092 lp->rx_buf_ptr_lnc[i] = in dec_lance_probe()
1096 lp->tx_buf_ptr_cpu[i] = in dec_lance_probe()
1100 lp->tx_buf_ptr_lnc[i] = in dec_lance_probe()
1107 lp->dma_irq = dec_interrupt[DEC_IRQ_LANCE_MERR]; in dec_lance_probe()
1131 lp->dma_irq = -1; in dec_lance_probe()
1134 lp->rx_buf_ptr_cpu[i] = in dec_lance_probe()
1137 lp->rx_buf_ptr_lnc[i] = in dec_lance_probe()
1141 lp->tx_buf_ptr_cpu[i] = in dec_lance_probe()
1145 lp->tx_buf_ptr_lnc[i] = in dec_lance_probe()
1159 lp->dma_irq = -1; in dec_lance_probe()
1165 lp->rx_buf_ptr_cpu[i] = in dec_lance_probe()
1168 lp->rx_buf_ptr_lnc[i] = in dec_lance_probe()
1172 lp->tx_buf_ptr_cpu[i] = in dec_lance_probe()
1176 lp->tx_buf_ptr_lnc[i] = in dec_lance_probe()
1241 /* lp->ll is the location of the registers for lance card */ in dec_lance_probe()
1242 lp->ll = ll; in dec_lance_probe()
1247 lp->busmaster_regval = 0; in dec_lance_probe()
1256 lp->dev = dev; in dec_lance_probe()
1257 timer_setup(&lp->multicast_timer, lance_set_multicast_retry, 0); in dec_lance_probe()
1268 lp->next = root_lance_dev; in dec_lance_probe()
1308 struct lance_private *lp = netdev_priv(dev); in dec_lance_platform_remove() local
1311 root_lance_dev = lp->next; in dec_lance_platform_remove()