Lines Matching refs:lp
273 #define TX_BUFFS_AVAIL ((lp->tx_old<=lp->tx_new)?\
274 lp->tx_old+TX_RING_MOD_MASK-lp->tx_new:\
275 lp->tx_old - lp->tx_new-1)
301 static void load_csrs(struct lance_private *lp) in load_csrs() argument
303 volatile struct lance_regs *ll = lp->ll; in load_csrs()
316 writereg(&ll->rdp, lp->busmaster_regval); in load_csrs()
450 struct lance_private *lp = netdev_priv(dev); in lance_init_ring() local
457 lp->rx_new = lp->tx_new = 0; in lance_init_ring()
458 lp->rx_old = lp->tx_old = 0; in lance_init_ring()
463 *lib_ptr(ib, phys_addr[0], lp->type) = (dev->dev_addr[1] << 8) | in lance_init_ring()
465 *lib_ptr(ib, phys_addr[1], lp->type) = (dev->dev_addr[3] << 8) | in lance_init_ring()
467 *lib_ptr(ib, phys_addr[2], lp->type) = (dev->dev_addr[5] << 8) | in lance_init_ring()
473 *lib_ptr(ib, rx_len, lp->type) = (LANCE_LOG_RX_BUFFERS << 13) | in lance_init_ring()
475 *lib_ptr(ib, rx_ptr, lp->type) = leptr; in lance_init_ring()
478 leptr, (uint)lib_off(brx_ring, lp->type)); in lance_init_ring()
482 *lib_ptr(ib, tx_len, lp->type) = (LANCE_LOG_TX_BUFFERS << 13) | in lance_init_ring()
484 *lib_ptr(ib, tx_ptr, lp->type) = leptr; in lance_init_ring()
487 leptr, (uint)lib_off(btx_ring, lp->type)); in lance_init_ring()
494 leptr = lp->tx_buf_ptr_lnc[i]; in lance_init_ring()
495 *lib_ptr(ib, btx_ring[i].tmd0, lp->type) = leptr; in lance_init_ring()
496 *lib_ptr(ib, btx_ring[i].tmd1, lp->type) = (leptr >> 16) & in lance_init_ring()
498 *lib_ptr(ib, btx_ring[i].length, lp->type) = 0xf000; in lance_init_ring()
500 *lib_ptr(ib, btx_ring[i].misc, lp->type) = 0; in lance_init_ring()
503 i, leptr, lp->tx_buf_ptr_cpu[i]); in lance_init_ring()
510 leptr = lp->rx_buf_ptr_lnc[i]; in lance_init_ring()
511 *lib_ptr(ib, brx_ring[i].rmd0, lp->type) = leptr; in lance_init_ring()
512 *lib_ptr(ib, brx_ring[i].rmd1, lp->type) = ((leptr >> 16) & in lance_init_ring()
515 *lib_ptr(ib, brx_ring[i].length, lp->type) = -RX_BUFF_SIZE | in lance_init_ring()
517 *lib_ptr(ib, brx_ring[i].mblength, lp->type) = 0; in lance_init_ring()
520 i, leptr, lp->rx_buf_ptr_cpu[i]); in lance_init_ring()
525 static int init_restart_lance(struct lance_private *lp) in init_restart_lance() argument
527 volatile struct lance_regs *ll = lp->ll; in init_restart_lance()
556 struct lance_private *lp = netdev_priv(dev); in lance_rx() local
569 if (i == lp->rx_new) in lance_rx()
571 lp->type) & in lance_rx()
575 lp->type) & in lance_rx()
582 for (rd = lib_ptr(ib, brx_ring[lp->rx_new], lp->type); in lance_rx()
583 !((bits = *rds_ptr(rd, rmd1, lp->type)) & LE_R1_OWN); in lance_rx()
584 rd = lib_ptr(ib, brx_ring[lp->rx_new], lp->type)) { in lance_rx()
585 entry = lp->rx_new; in lance_rx()
606 len = (*rds_ptr(rd, mblength, lp->type) & 0xfff) - 4; in lance_rx()
611 *rds_ptr(rd, mblength, lp->type) = 0; in lance_rx()
612 *rds_ptr(rd, rmd1, lp->type) = in lance_rx()
613 ((lp->rx_buf_ptr_lnc[entry] >> 16) & in lance_rx()
615 lp->rx_new = (entry + 1) & RX_RING_MOD_MASK; in lance_rx()
623 cp_from_buf(lp->type, skb->data, in lance_rx()
624 lp->rx_buf_ptr_cpu[entry], len); in lance_rx()
632 *rds_ptr(rd, mblength, lp->type) = 0; in lance_rx()
633 *rds_ptr(rd, length, lp->type) = -RX_BUFF_SIZE | 0xf000; in lance_rx()
634 *rds_ptr(rd, rmd1, lp->type) = in lance_rx()
635 ((lp->rx_buf_ptr_lnc[entry] >> 16) & 0xff) | LE_R1_OWN; in lance_rx()
636 lp->rx_new = (entry + 1) & RX_RING_MOD_MASK; in lance_rx()
643 struct lance_private *lp = netdev_priv(dev); in lance_tx() local
645 volatile struct lance_regs *ll = lp->ll; in lance_tx()
650 j = lp->tx_old; in lance_tx()
652 spin_lock(&lp->lock); in lance_tx()
654 for (i = j; i != lp->tx_new; i = j) { in lance_tx()
655 td = lib_ptr(ib, btx_ring[i], lp->type); in lance_tx()
657 if (*tds_ptr(td, tmd1, lp->type) & LE_T1_OWN) in lance_tx()
660 if (*tds_ptr(td, tmd1, lp->type) & LE_T1_ERR) { in lance_tx()
661 status = *tds_ptr(td, misc, lp->type); in lance_tx()
676 load_csrs(lp); in lance_tx()
677 init_restart_lance(lp); in lance_tx()
692 load_csrs(lp); in lance_tx()
693 init_restart_lance(lp); in lance_tx()
696 } else if ((*tds_ptr(td, tmd1, lp->type) & LE_T1_POK) == in lance_tx()
701 *tds_ptr(td, tmd1, lp->type) &= ~(LE_T1_POK); in lance_tx()
704 if (*tds_ptr(td, tmd1, lp->type) & LE_T1_EONE) in lance_tx()
708 if (*tds_ptr(td, tmd1, lp->type) & LE_T1_EMORE) in lance_tx()
715 lp->tx_old = j; in lance_tx()
721 spin_unlock(&lp->lock); in lance_tx()
735 struct lance_private *lp = netdev_priv(dev); in lance_interrupt() local
736 volatile struct lance_regs *ll = lp->ll; in lance_interrupt()
768 load_csrs(lp); in lance_interrupt()
769 init_restart_lance(lp); in lance_interrupt()
781 struct lance_private *lp = netdev_priv(dev); in lance_open() local
782 volatile struct lance_regs *ll = lp->ll; in lance_open()
795 *lib_ptr(ib, mode, lp->type) = 0; in lance_open()
796 *lib_ptr(ib, filter[0], lp->type) = 0; in lance_open()
797 *lib_ptr(ib, filter[1], lp->type) = 0; in lance_open()
798 *lib_ptr(ib, filter[2], lp->type) = 0; in lance_open()
799 *lib_ptr(ib, filter[3], lp->type) = 0; in lance_open()
802 load_csrs(lp); in lance_open()
811 if (lp->dma_irq >= 0) { in lance_open()
814 if (request_irq(lp->dma_irq, lance_dma_merr_int, IRQF_ONESHOT, in lance_open()
818 lp->dma_irq); in lance_open()
833 status = init_restart_lance(lp); in lance_open()
839 struct lance_private *lp = netdev_priv(dev); in lance_close() local
840 volatile struct lance_regs *ll = lp->ll; in lance_close()
843 del_timer_sync(&lp->multicast_timer); in lance_close()
849 if (lp->dma_irq >= 0) { in lance_close()
862 free_irq(lp->dma_irq, dev); in lance_close()
870 struct lance_private *lp = netdev_priv(dev); in lance_reset() local
871 volatile struct lance_regs *ll = lp->ll; in lance_reset()
879 load_csrs(lp); in lance_reset()
881 status = init_restart_lance(lp); in lance_reset()
887 struct lance_private *lp = netdev_priv(dev); in lance_tx_timeout() local
888 volatile struct lance_regs *ll = lp->ll; in lance_tx_timeout()
898 struct lance_private *lp = netdev_priv(dev); in lance_start_xmit() local
899 volatile struct lance_regs *ll = lp->ll; in lance_start_xmit()
914 spin_lock_irqsave(&lp->lock, flags); in lance_start_xmit()
916 entry = lp->tx_new; in lance_start_xmit()
917 *lib_ptr(ib, btx_ring[entry].length, lp->type) = (-len); in lance_start_xmit()
918 *lib_ptr(ib, btx_ring[entry].misc, lp->type) = 0; in lance_start_xmit()
920 cp_to_buf(lp->type, lp->tx_buf_ptr_cpu[entry], skb->data, len); in lance_start_xmit()
923 *lib_ptr(ib, btx_ring[entry].tmd1, lp->type) = in lance_start_xmit()
924 ((lp->tx_buf_ptr_lnc[entry] >> 16) & 0xff) | in lance_start_xmit()
926 lp->tx_new = (entry + 1) & TX_RING_MOD_MASK; in lance_start_xmit()
934 spin_unlock_irqrestore(&lp->lock, flags); in lance_start_xmit()
943 struct lance_private *lp = netdev_priv(dev); in lance_load_multicast() local
950 *lib_ptr(ib, filter[0], lp->type) = 0xffff; in lance_load_multicast()
951 *lib_ptr(ib, filter[1], lp->type) = 0xffff; in lance_load_multicast()
952 *lib_ptr(ib, filter[2], lp->type) = 0xffff; in lance_load_multicast()
953 *lib_ptr(ib, filter[3], lp->type) = 0xffff; in lance_load_multicast()
957 *lib_ptr(ib, filter[0], lp->type) = 0; in lance_load_multicast()
958 *lib_ptr(ib, filter[1], lp->type) = 0; in lance_load_multicast()
959 *lib_ptr(ib, filter[2], lp->type) = 0; in lance_load_multicast()
960 *lib_ptr(ib, filter[3], lp->type) = 0; in lance_load_multicast()
966 *lib_ptr(ib, filter[crc >> 4], lp->type) |= 1 << (crc & 0xf); in lance_load_multicast()
972 struct lance_private *lp = netdev_priv(dev); in lance_set_multicast() local
974 volatile struct lance_regs *ll = lp->ll; in lance_set_multicast()
979 if (lp->tx_old != lp->tx_new) { in lance_set_multicast()
980 mod_timer(&lp->multicast_timer, jiffies + 4 * HZ/100); in lance_set_multicast()
993 *lib_ptr(ib, mode, lp->type) |= LE_MO_PROM; in lance_set_multicast()
995 *lib_ptr(ib, mode, lp->type) &= ~LE_MO_PROM; in lance_set_multicast()
998 load_csrs(lp); in lance_set_multicast()
999 init_restart_lance(lp); in lance_set_multicast()
1027 struct lance_private *lp; in dec_lance_probe() local
1044 lp = netdev_priv(dev); in dec_lance_probe()
1045 dev = lp->next; in dec_lance_probe()
1060 lp = netdev_priv(dev); in dec_lance_probe()
1061 spin_lock_init(&lp->lock); in dec_lance_probe()
1063 lp->type = type; in dec_lance_probe()
1085 lp->rx_buf_ptr_cpu[i] = in dec_lance_probe()
1088 lp->rx_buf_ptr_lnc[i] = in dec_lance_probe()
1092 lp->tx_buf_ptr_cpu[i] = in dec_lance_probe()
1096 lp->tx_buf_ptr_lnc[i] = in dec_lance_probe()
1103 lp->dma_irq = dec_interrupt[DEC_IRQ_LANCE_MERR]; in dec_lance_probe()
1127 lp->dma_irq = -1; in dec_lance_probe()
1130 lp->rx_buf_ptr_cpu[i] = in dec_lance_probe()
1133 lp->rx_buf_ptr_lnc[i] = in dec_lance_probe()
1137 lp->tx_buf_ptr_cpu[i] = in dec_lance_probe()
1141 lp->tx_buf_ptr_lnc[i] = in dec_lance_probe()
1155 lp->dma_irq = -1; in dec_lance_probe()
1161 lp->rx_buf_ptr_cpu[i] = in dec_lance_probe()
1164 lp->rx_buf_ptr_lnc[i] = in dec_lance_probe()
1168 lp->tx_buf_ptr_cpu[i] = in dec_lance_probe()
1172 lp->tx_buf_ptr_lnc[i] = in dec_lance_probe()
1236 lp->ll = ll; in dec_lance_probe()
1241 lp->busmaster_regval = 0; in dec_lance_probe()
1250 init_timer(&lp->multicast_timer); in dec_lance_probe()
1251 lp->multicast_timer.data = (unsigned long) dev; in dec_lance_probe()
1252 lp->multicast_timer.function = lance_set_multicast_retry; in dec_lance_probe()
1262 lp->next = root_lance_dev; in dec_lance_probe()
1314 struct lance_private *lp = netdev_priv(dev); in dec_lance_platform_remove() local
1317 root_lance_dev = lp->next; in dec_lance_platform_remove()