Lines Matching refs:lp
243 struct r6040_private *lp = netdev_priv(dev); in r6040_mdio_read() local
244 void __iomem *ioaddr = lp->base; in r6040_mdio_read()
246 return (r6040_phy_read(ioaddr, lp->phy_addr, reg)); in r6040_mdio_read()
251 struct r6040_private *lp = netdev_priv(dev); in r6040_mdio_write() local
252 void __iomem *ioaddr = lp->base; in r6040_mdio_write()
254 r6040_phy_write(ioaddr, lp->phy_addr, reg, val); in r6040_mdio_write()
259 struct r6040_private *lp = netdev_priv(dev); in r6040_free_txbufs() local
263 if (lp->tx_insert_ptr->skb_ptr) { in r6040_free_txbufs()
264 pci_unmap_single(lp->pdev, in r6040_free_txbufs()
265 le32_to_cpu(lp->tx_insert_ptr->buf), in r6040_free_txbufs()
267 dev_kfree_skb(lp->tx_insert_ptr->skb_ptr); in r6040_free_txbufs()
268 lp->tx_insert_ptr->skb_ptr = NULL; in r6040_free_txbufs()
270 lp->tx_insert_ptr = lp->tx_insert_ptr->vndescp; in r6040_free_txbufs()
276 struct r6040_private *lp = netdev_priv(dev); in r6040_free_rxbufs() local
280 if (lp->rx_insert_ptr->skb_ptr) { in r6040_free_rxbufs()
281 pci_unmap_single(lp->pdev, in r6040_free_rxbufs()
282 le32_to_cpu(lp->rx_insert_ptr->buf), in r6040_free_rxbufs()
284 dev_kfree_skb(lp->rx_insert_ptr->skb_ptr); in r6040_free_rxbufs()
285 lp->rx_insert_ptr->skb_ptr = NULL; in r6040_free_rxbufs()
287 lp->rx_insert_ptr = lp->rx_insert_ptr->vndescp; in r6040_free_rxbufs()
310 struct r6040_private *lp = netdev_priv(dev); in r6040_init_txbufs() local
312 lp->tx_free_desc = TX_DCNT; in r6040_init_txbufs()
314 lp->tx_remove_ptr = lp->tx_insert_ptr = lp->tx_ring; in r6040_init_txbufs()
315 r6040_init_ring_desc(lp->tx_ring, lp->tx_ring_dma, TX_DCNT); in r6040_init_txbufs()
320 struct r6040_private *lp = netdev_priv(dev); in r6040_alloc_rxbufs() local
325 lp->rx_remove_ptr = lp->rx_insert_ptr = lp->rx_ring; in r6040_alloc_rxbufs()
326 r6040_init_ring_desc(lp->rx_ring, lp->rx_ring_dma, RX_DCNT); in r6040_alloc_rxbufs()
329 desc = lp->rx_ring; in r6040_alloc_rxbufs()
338 desc->buf = cpu_to_le32(pci_map_single(lp->pdev, in r6040_alloc_rxbufs()
343 } while (desc != lp->rx_ring); in r6040_alloc_rxbufs()
355 struct r6040_private *lp = netdev_priv(dev); in r6040_init_mac_regs() local
356 void __iomem *ioaddr = lp->base; in r6040_init_mac_regs()
382 iowrite16(lp->tx_ring_dma, ioaddr + MTD_SA0); in r6040_init_mac_regs()
383 iowrite16(lp->tx_ring_dma >> 16, ioaddr + MTD_SA1); in r6040_init_mac_regs()
386 iowrite16(lp->rx_ring_dma, ioaddr + MRD_SA0); in r6040_init_mac_regs()
387 iowrite16(lp->rx_ring_dma >> 16, ioaddr + MRD_SA1); in r6040_init_mac_regs()
397 iowrite16(lp->mcr0 | 0x0002, ioaddr); in r6040_init_mac_regs()
439 struct r6040_private *lp = netdev_priv(dev); in r6040_down() local
440 void __iomem *ioaddr = lp->base; in r6040_down()
463 struct r6040_private *lp = netdev_priv(dev); in r6040_close() local
464 struct pci_dev *pdev = lp->pdev; in r6040_close()
467 del_timer_sync(&lp->timer); in r6040_close()
469 spin_lock_irq(&lp->lock); in r6040_close()
470 napi_disable(&lp->napi); in r6040_close()
482 spin_unlock_irq(&lp->lock); in r6040_close()
485 if (lp->rx_ring) { in r6040_close()
486 pci_free_consistent(pdev, RX_DESC_SIZE, lp->rx_ring, lp->rx_ring_dma); in r6040_close()
487 lp->rx_ring = 0; in r6040_close()
490 if (lp->tx_ring) { in r6040_close()
491 pci_free_consistent(pdev, TX_DESC_SIZE, lp->tx_ring, lp->tx_ring_dma); in r6040_close()
492 lp->tx_ring = 0; in r6040_close()
501 struct r6040_private *lp = netdev_priv(dev); in r6040_phy_mode_chk() local
502 void __iomem *ioaddr = lp->base; in r6040_phy_mode_chk()
506 phy_dat = r6040_phy_read(ioaddr, lp->phy_addr, 1); in r6040_phy_mode_chk()
511 phy_dat = r6040_phy_read(ioaddr, lp->phy_addr, 1); in r6040_phy_mode_chk()
514 phy_dat = r6040_phy_read(ioaddr, lp->phy_addr, 5); in r6040_phy_mode_chk()
515 phy_dat &= r6040_phy_read(ioaddr, lp->phy_addr, 4); in r6040_phy_mode_chk()
523 phy_dat = r6040_phy_read(ioaddr, lp->phy_addr, 0); in r6040_phy_mode_chk()
545 struct r6040_private *lp = netdev_priv(dev); in r6040_ioctl() local
551 spin_lock_irq(&lp->lock); in r6040_ioctl()
552 rc = generic_mii_ioctl(&lp->mii_if, data, cmd, NULL); in r6040_ioctl()
553 spin_unlock_irq(&lp->lock); in r6040_ioctl()
554 r6040_set_carrier(&lp->mii_if); in r6040_ioctl()
690 struct r6040_private *lp = netdev_priv(dev); in r6040_interrupt() local
691 void __iomem *ioaddr = lp->base; in r6040_interrupt()
716 netif_rx_schedule(&lp->napi); in r6040_interrupt()
741 struct r6040_private *lp = netdev_priv(dev); in r6040_up() local
742 void __iomem *ioaddr = lp->base; in r6040_up()
752 lp->switch_sig = r6040_phy_read(ioaddr, 0, 2); in r6040_up()
754 if (lp->switch_sig == ICPLUS_PHY_ID) { in r6040_up()
756 lp->phy_mode = 0x8000; in r6040_up()
759 r6040_phy_write(ioaddr, lp->phy_addr, 4, PHY_CAP); in r6040_up()
760 r6040_phy_write(ioaddr, lp->phy_addr, 0, PHY_MODE); in r6040_up()
763 lp->phy_mode = r6040_phy_mode_chk(dev); in r6040_up()
765 lp->phy_mode = (PHY_MODE & 0x0100) ? 0x8000:0x0; in r6040_up()
769 lp->mcr0 |= lp->phy_mode; in r6040_up()
790 struct r6040_private *lp = netdev_priv(dev); in r6040_timer() local
791 void __iomem *ioaddr = lp->base; in r6040_timer()
800 if (phy_mode != lp->phy_mode) { in r6040_timer()
801 lp->phy_mode = phy_mode; in r6040_timer()
802 lp->mcr0 = (lp->mcr0 & 0x7fff) | phy_mode; in r6040_timer()
803 iowrite16(lp->mcr0, ioaddr); in r6040_timer()
808 mod_timer(&lp->timer, round_jiffies(jiffies + HZ)); in r6040_timer()
814 struct r6040_private *lp = netdev_priv(dev); in r6040_mac_address() local
815 void __iomem *ioaddr = lp->base; in r6040_mac_address()
833 struct r6040_private *lp = netdev_priv(dev); in r6040_open() local
846 lp->rx_ring = in r6040_open()
847 pci_alloc_consistent(lp->pdev, RX_DESC_SIZE, &lp->rx_ring_dma); in r6040_open()
848 if (!lp->rx_ring) in r6040_open()
851 lp->tx_ring = in r6040_open()
852 pci_alloc_consistent(lp->pdev, TX_DESC_SIZE, &lp->tx_ring_dma); in r6040_open()
853 if (!lp->tx_ring) { in r6040_open()
854 pci_free_consistent(lp->pdev, RX_DESC_SIZE, lp->rx_ring, in r6040_open()
855 lp->rx_ring_dma); in r6040_open()
861 pci_free_consistent(lp->pdev, TX_DESC_SIZE, lp->tx_ring, in r6040_open()
862 lp->tx_ring_dma); in r6040_open()
863 pci_free_consistent(lp->pdev, RX_DESC_SIZE, lp->rx_ring, in r6040_open()
864 lp->rx_ring_dma); in r6040_open()
868 napi_enable(&lp->napi); in r6040_open()
872 setup_timer(&lp->timer, r6040_timer, (unsigned long) dev); in r6040_open()
873 if (lp->switch_sig != ICPLUS_PHY_ID) in r6040_open()
874 mod_timer(&lp->timer, jiffies + HZ); in r6040_open()
880 struct r6040_private *lp = netdev_priv(dev); in r6040_start_xmit() local
882 void __iomem *ioaddr = lp->base; in r6040_start_xmit()
887 spin_lock_irqsave(&lp->lock, flags); in r6040_start_xmit()
890 if (!lp->tx_free_desc) { in r6040_start_xmit()
891 spin_unlock_irqrestore(&lp->lock, flags); in r6040_start_xmit()
902 lp->tx_free_desc--; in r6040_start_xmit()
903 descptr = lp->tx_insert_ptr; in r6040_start_xmit()
910 descptr->buf = cpu_to_le32(pci_map_single(lp->pdev, in r6040_start_xmit()
915 lp->tx_insert_ptr = descptr->vndescp; in r6040_start_xmit()
918 if (!lp->tx_free_desc) in r6040_start_xmit()
922 spin_unlock_irqrestore(&lp->lock, flags); in r6040_start_xmit()
928 struct r6040_private *lp = netdev_priv(dev); in r6040_multicast_list() local
929 void __iomem *ioaddr = lp->base; in r6040_multicast_list()
943 spin_lock_irqsave(&lp->lock, flags); in r6040_multicast_list()
949 lp->mcr0 |= 0x0020; in r6040_multicast_list()
958 spin_unlock_irqrestore(&lp->lock, flags); in r6040_multicast_list()
1073 struct r6040_private *lp; in r6040_init_one() local
1118 lp = netdev_priv(dev); in r6040_init_one()
1140 lp->base = ioaddr; in r6040_init_one()
1143 spin_lock_init(&lp->lock); in r6040_init_one()
1162 lp->pdev = pdev; in r6040_init_one()
1163 lp->dev = dev; in r6040_init_one()
1166 lp->mcr0 = 0x1002; in r6040_init_one()
1167 lp->phy_addr = phy_table[card_idx]; in r6040_init_one()
1168 lp->switch_sig = 0; in r6040_init_one()
1175 netif_napi_add(dev, &lp->napi, r6040_poll, 64); in r6040_init_one()
1176 lp->mii_if.dev = dev; in r6040_init_one()
1177 lp->mii_if.mdio_read = r6040_mdio_read; in r6040_init_one()
1178 lp->mii_if.mdio_write = r6040_mdio_write; in r6040_init_one()
1179 lp->mii_if.phy_id = lp->phy_addr; in r6040_init_one()
1180 lp->mii_if.phy_id_mask = 0x1f; in r6040_init_one()
1181 lp->mii_if.reg_num_mask = 0x1f; in r6040_init_one()