• Home
  • Raw
  • Download

Lines Matching refs:lp

172 	struct korina_private *lp = netdev_priv(dev);  in korina_abort_tx()  local
174 korina_abort_dma(dev, lp->tx_dma_regs); in korina_abort_tx()
179 struct korina_private *lp = netdev_priv(dev); in korina_abort_rx() local
181 korina_abort_dma(dev, lp->rx_dma_regs); in korina_abort_rx()
184 static void korina_start_rx(struct korina_private *lp, in korina_start_rx() argument
187 korina_start_dma(lp->rx_dma_regs, CPHYSADDR(rd)); in korina_start_rx()
190 static void korina_chain_rx(struct korina_private *lp, in korina_chain_rx() argument
193 korina_chain_dma(lp->rx_dma_regs, CPHYSADDR(rd)); in korina_chain_rx()
199 struct korina_private *lp = netdev_priv(dev); in korina_send_packet() local
205 spin_lock_irqsave(&lp->lock, flags); in korina_send_packet()
207 td = &lp->td_ring[lp->tx_chain_tail]; in korina_send_packet()
210 if (lp->tx_count >= (KORINA_NUM_TDS - 2)) { in korina_send_packet()
211 lp->tx_full = 1; in korina_send_packet()
213 if (lp->tx_count == (KORINA_NUM_TDS - 2)) in korina_send_packet()
218 spin_unlock_irqrestore(&lp->lock, flags); in korina_send_packet()
224 lp->tx_count++; in korina_send_packet()
226 lp->tx_skb[lp->tx_chain_tail] = skb; in korina_send_packet()
234 chain_prev = (lp->tx_chain_tail - 1) & KORINA_TDS_MASK; in korina_send_packet()
235 chain_next = (lp->tx_chain_tail + 1) & KORINA_TDS_MASK; in korina_send_packet()
237 if (readl(&(lp->tx_dma_regs->dmandptr)) == 0) { in korina_send_packet()
238 if (lp->tx_chain_status == desc_empty) { in korina_send_packet()
243 lp->tx_chain_tail = chain_next; in korina_send_packet()
245 writel(CPHYSADDR(&lp->td_ring[lp->tx_chain_head]), in korina_send_packet()
246 &lp->tx_dma_regs->dmandptr); in korina_send_packet()
248 lp->tx_chain_head = lp->tx_chain_tail; in korina_send_packet()
254 lp->td_ring[chain_prev].control &= in korina_send_packet()
257 lp->td_ring[chain_prev].link = CPHYSADDR(td); in korina_send_packet()
259 lp->tx_chain_tail = chain_next; in korina_send_packet()
261 writel(CPHYSADDR(&lp->td_ring[lp->tx_chain_head]), in korina_send_packet()
262 &(lp->tx_dma_regs->dmandptr)); in korina_send_packet()
264 lp->tx_chain_head = lp->tx_chain_tail; in korina_send_packet()
265 lp->tx_chain_status = desc_empty; in korina_send_packet()
268 if (lp->tx_chain_status == desc_empty) { in korina_send_packet()
273 lp->tx_chain_tail = chain_next; in korina_send_packet()
274 lp->tx_chain_status = desc_filled; in korina_send_packet()
279 lp->td_ring[chain_prev].control &= in korina_send_packet()
281 lp->td_ring[chain_prev].link = CPHYSADDR(td); in korina_send_packet()
282 lp->tx_chain_tail = chain_next; in korina_send_packet()
288 spin_unlock_irqrestore(&lp->lock, flags); in korina_send_packet()
295 struct korina_private *lp = netdev_priv(dev); in mdio_read() local
298 mii_id = ((lp->rx_irq == 0x2c ? 1 : 0) << 8); in mdio_read()
300 writel(0, &lp->eth_regs->miimcfg); in mdio_read()
301 writel(0, &lp->eth_regs->miimcmd); in mdio_read()
302 writel(mii_id | reg, &lp->eth_regs->miimaddr); in mdio_read()
303 writel(ETH_MII_CMD_SCN, &lp->eth_regs->miimcmd); in mdio_read()
305 ret = (int)(readl(&lp->eth_regs->miimrdd)); in mdio_read()
311 struct korina_private *lp = netdev_priv(dev); in mdio_write() local
313 mii_id = ((lp->rx_irq == 0x2c ? 1 : 0) << 8); in mdio_write()
315 writel(0, &lp->eth_regs->miimcfg); in mdio_write()
316 writel(1, &lp->eth_regs->miimcmd); in mdio_write()
317 writel(mii_id | reg, &lp->eth_regs->miimaddr); in mdio_write()
318 writel(ETH_MII_CMD_SCN, &lp->eth_regs->miimcmd); in mdio_write()
319 writel(val, &lp->eth_regs->miimwtd); in mdio_write()
326 struct korina_private *lp = netdev_priv(dev); in korina_rx_dma_interrupt() local
330 dmas = readl(&lp->rx_dma_regs->dmas); in korina_rx_dma_interrupt()
332 dmasm = readl(&lp->rx_dma_regs->dmasm); in korina_rx_dma_interrupt()
335 &lp->rx_dma_regs->dmasm); in korina_rx_dma_interrupt()
337 netif_rx_schedule(&lp->napi); in korina_rx_dma_interrupt()
351 struct korina_private *lp = netdev_priv(dev); in korina_rx() local
352 struct dma_desc *rd = &lp->rd_ring[lp->rx_next_done]; in korina_rx()
361 skb = lp->rx_skb[lp->rx_next_done]; in korina_rx()
396 pkt_buf = (u8 *)lp->rx_skb[lp->rx_next_done]->data; in korina_rx()
422 lp->rx_skb[lp->rx_next_done] = skb_new; in korina_rx()
435 lp->rd_ring[(lp->rx_next_done - 1) & in korina_rx()
439 lp->rx_next_done = (lp->rx_next_done + 1) & KORINA_RDS_MASK; in korina_rx()
441 rd = &lp->rd_ring[lp->rx_next_done]; in korina_rx()
442 writel(~DMA_STAT_DONE, &lp->rx_dma_regs->dmas); in korina_rx()
445 dmas = readl(&lp->rx_dma_regs->dmas); in korina_rx()
449 &lp->rx_dma_regs->dmas); in korina_rx()
451 lp->dma_halt_cnt++; in korina_rx()
453 skb = lp->rx_skb[lp->rx_next_done]; in korina_rx()
456 korina_chain_rx(lp, rd); in korina_rx()
464 struct korina_private *lp = in korina_poll() local
466 struct net_device *dev = lp->dev; in korina_poll()
473 writel(readl(&lp->rx_dma_regs->dmasm) & in korina_poll()
475 &lp->rx_dma_regs->dmasm); in korina_poll()
485 struct korina_private *lp = netdev_priv(dev); in korina_multicast_list() local
524 &lp->eth_regs->ethhash0); in korina_multicast_list()
526 &lp->eth_regs->ethhash1); in korina_multicast_list()
529 spin_lock_irqsave(&lp->lock, flags); in korina_multicast_list()
530 writel(recognise, &lp->eth_regs->etharc); in korina_multicast_list()
531 spin_unlock_irqrestore(&lp->lock, flags); in korina_multicast_list()
536 struct korina_private *lp = netdev_priv(dev); in korina_tx() local
537 struct dma_desc *td = &lp->td_ring[lp->tx_next_done]; in korina_tx()
541 spin_lock(&lp->lock); in korina_tx()
545 if (lp->tx_full == 1) { in korina_tx()
547 lp->tx_full = 0; in korina_tx()
550 devcs = lp->td_ring[lp->tx_next_done].devcs; in korina_tx()
562 lp->tx_skb[lp->tx_next_done]->len; in korina_tx()
589 if (lp->tx_skb[lp->tx_next_done]) { in korina_tx()
590 dev_kfree_skb_any(lp->tx_skb[lp->tx_next_done]); in korina_tx()
591 lp->tx_skb[lp->tx_next_done] = NULL; in korina_tx()
594 lp->td_ring[lp->tx_next_done].control = DMA_DESC_IOF; in korina_tx()
595 lp->td_ring[lp->tx_next_done].devcs = ETH_TX_FD | ETH_TX_LD; in korina_tx()
596 lp->td_ring[lp->tx_next_done].link = 0; in korina_tx()
597 lp->td_ring[lp->tx_next_done].ca = 0; in korina_tx()
598 lp->tx_count--; in korina_tx()
601 lp->tx_next_done = (lp->tx_next_done + 1) & KORINA_TDS_MASK; in korina_tx()
602 td = &lp->td_ring[lp->tx_next_done]; in korina_tx()
607 dmas = readl(&lp->tx_dma_regs->dmas); in korina_tx()
608 writel(~dmas, &lp->tx_dma_regs->dmas); in korina_tx()
610 writel(readl(&lp->tx_dma_regs->dmasm) & in korina_tx()
612 &lp->tx_dma_regs->dmasm); in korina_tx()
614 spin_unlock(&lp->lock); in korina_tx()
621 struct korina_private *lp = netdev_priv(dev); in korina_tx_dma_interrupt() local
625 dmas = readl(&lp->tx_dma_regs->dmas); in korina_tx_dma_interrupt()
628 dmasm = readl(&lp->tx_dma_regs->dmasm); in korina_tx_dma_interrupt()
630 &lp->tx_dma_regs->dmasm); in korina_tx_dma_interrupt()
634 if (lp->tx_chain_status == desc_filled && in korina_tx_dma_interrupt()
635 (readl(&(lp->tx_dma_regs->dmandptr)) == 0)) { in korina_tx_dma_interrupt()
636 writel(CPHYSADDR(&lp->td_ring[lp->tx_chain_head]), in korina_tx_dma_interrupt()
637 &(lp->tx_dma_regs->dmandptr)); in korina_tx_dma_interrupt()
638 lp->tx_chain_status = desc_empty; in korina_tx_dma_interrupt()
639 lp->tx_chain_head = lp->tx_chain_tail; in korina_tx_dma_interrupt()
655 struct korina_private *lp = netdev_priv(dev); in korina_check_media() local
657 mii_check_media(&lp->mii_if, 0, init_media); in korina_check_media()
659 if (lp->mii_if.full_duplex) in korina_check_media()
660 writel(readl(&lp->eth_regs->ethmac2) | ETH_MAC2_FD, in korina_check_media()
661 &lp->eth_regs->ethmac2); in korina_check_media()
663 writel(readl(&lp->eth_regs->ethmac2) & ~ETH_MAC2_FD, in korina_check_media()
664 &lp->eth_regs->ethmac2); in korina_check_media()
679 struct korina_private *lp = netdev_priv(dev); in korina_ioctl() local
685 spin_lock_irq(&lp->lock); in korina_ioctl()
686 rc = generic_mii_ioctl(&lp->mii_if, data, cmd, NULL); in korina_ioctl()
687 spin_unlock_irq(&lp->lock); in korina_ioctl()
688 korina_set_carrier(&lp->mii_if); in korina_ioctl()
697 struct korina_private *lp = netdev_priv(dev); in netdev_get_drvinfo() local
701 strcpy(info->bus_info, lp->dev->name); in netdev_get_drvinfo()
706 struct korina_private *lp = netdev_priv(dev); in netdev_get_settings() local
709 spin_lock_irq(&lp->lock); in netdev_get_settings()
710 rc = mii_ethtool_gset(&lp->mii_if, cmd); in netdev_get_settings()
711 spin_unlock_irq(&lp->lock); in netdev_get_settings()
718 struct korina_private *lp = netdev_priv(dev); in netdev_set_settings() local
721 spin_lock_irq(&lp->lock); in netdev_set_settings()
722 rc = mii_ethtool_sset(&lp->mii_if, cmd); in netdev_set_settings()
723 spin_unlock_irq(&lp->lock); in netdev_set_settings()
724 korina_set_carrier(&lp->mii_if); in netdev_set_settings()
731 struct korina_private *lp = netdev_priv(dev); in netdev_get_link() local
733 return mii_link_ok(&lp->mii_if); in netdev_get_link()
745 struct korina_private *lp = netdev_priv(dev); in korina_alloc_ring() local
751 lp->td_ring[i].control = DMA_DESC_IOF; in korina_alloc_ring()
752 lp->td_ring[i].devcs = ETH_TX_FD | ETH_TX_LD; in korina_alloc_ring()
753 lp->td_ring[i].ca = 0; in korina_alloc_ring()
754 lp->td_ring[i].link = 0; in korina_alloc_ring()
756 lp->tx_next_done = lp->tx_chain_head = lp->tx_chain_tail = in korina_alloc_ring()
757 lp->tx_full = lp->tx_count = 0; in korina_alloc_ring()
758 lp->tx_chain_status = desc_empty; in korina_alloc_ring()
766 lp->rx_skb[i] = skb; in korina_alloc_ring()
767 lp->rd_ring[i].control = DMA_DESC_IOD | in korina_alloc_ring()
769 lp->rd_ring[i].devcs = 0; in korina_alloc_ring()
770 lp->rd_ring[i].ca = CPHYSADDR(skb->data); in korina_alloc_ring()
771 lp->rd_ring[i].link = CPHYSADDR(&lp->rd_ring[i+1]); in korina_alloc_ring()
776 lp->rd_ring[i - 1].link = CPHYSADDR(&lp->rd_ring[0]); in korina_alloc_ring()
777 lp->rd_ring[i - 1].control |= DMA_DESC_COD; in korina_alloc_ring()
779 lp->rx_next_done = 0; in korina_alloc_ring()
780 lp->rx_chain_head = 0; in korina_alloc_ring()
781 lp->rx_chain_tail = 0; in korina_alloc_ring()
782 lp->rx_chain_status = desc_empty; in korina_alloc_ring()
787 struct korina_private *lp = netdev_priv(dev); in korina_free_ring() local
791 lp->rd_ring[i].control = 0; in korina_free_ring()
792 if (lp->rx_skb[i]) in korina_free_ring()
793 dev_kfree_skb_any(lp->rx_skb[i]); in korina_free_ring()
794 lp->rx_skb[i] = NULL; in korina_free_ring()
798 lp->td_ring[i].control = 0; in korina_free_ring()
799 if (lp->tx_skb[i]) in korina_free_ring()
800 dev_kfree_skb_any(lp->tx_skb[i]); in korina_free_ring()
801 lp->tx_skb[i] = NULL; in korina_free_ring()
810 struct korina_private *lp = netdev_priv(dev); in korina_init() local
817 writel(0, &lp->eth_regs->ethintfc); in korina_init()
818 while ((readl(&lp->eth_regs->ethintfc) & ETH_INT_FC_RIP)) in korina_init()
822 writel(ETH_INT_FC_EN, &lp->eth_regs->ethintfc); in korina_init()
827 writel(0, &lp->rx_dma_regs->dmas); in korina_init()
829 korina_start_rx(lp, &lp->rd_ring[0]); in korina_init()
831 writel(readl(&lp->tx_dma_regs->dmasm) & in korina_init()
833 &lp->tx_dma_regs->dmasm); in korina_init()
834 writel(readl(&lp->rx_dma_regs->dmasm) & in korina_init()
836 &lp->rx_dma_regs->dmasm); in korina_init()
839 writel(ETH_ARC_AB, &lp->eth_regs->etharc); in korina_init()
842 writel(STATION_ADDRESS_LOW(dev), &lp->eth_regs->ethsal0); in korina_init()
843 writel(STATION_ADDRESS_HIGH(dev), &lp->eth_regs->ethsah0); in korina_init()
845 writel(STATION_ADDRESS_LOW(dev), &lp->eth_regs->ethsal1); in korina_init()
846 writel(STATION_ADDRESS_HIGH(dev), &lp->eth_regs->ethsah1); in korina_init()
848 writel(STATION_ADDRESS_LOW(dev), &lp->eth_regs->ethsal2); in korina_init()
849 writel(STATION_ADDRESS_HIGH(dev), &lp->eth_regs->ethsah2); in korina_init()
851 writel(STATION_ADDRESS_LOW(dev), &lp->eth_regs->ethsal3); in korina_init()
852 writel(STATION_ADDRESS_HIGH(dev), &lp->eth_regs->ethsah3); in korina_init()
857 &lp->eth_regs->ethmac2); in korina_init()
860 writel(0x15, &lp->eth_regs->ethipgt); in korina_init()
862 writel(0x12, &lp->eth_regs->ethipgr); in korina_init()
867 &lp->eth_regs->ethmcp); in korina_init()
870 writel(48, &lp->eth_regs->ethfifott); in korina_init()
872 writel(ETH_MAC1_RE, &lp->eth_regs->ethmac1); in korina_init()
874 napi_enable(&lp->napi); in korina_init()
886 struct korina_private *lp = netdev_priv(dev); in korina_restart() local
892 disable_irq(lp->rx_irq); in korina_restart()
893 disable_irq(lp->tx_irq); in korina_restart()
894 disable_irq(lp->ovr_irq); in korina_restart()
895 disable_irq(lp->und_irq); in korina_restart()
897 writel(readl(&lp->tx_dma_regs->dmasm) | in korina_restart()
899 &lp->tx_dma_regs->dmasm); in korina_restart()
900 writel(readl(&lp->rx_dma_regs->dmasm) | in korina_restart()
902 &lp->rx_dma_regs->dmasm); in korina_restart()
906 napi_disable(&lp->napi); in korina_restart()
916 enable_irq(lp->und_irq); in korina_restart()
917 enable_irq(lp->ovr_irq); in korina_restart()
918 enable_irq(lp->tx_irq); in korina_restart()
919 enable_irq(lp->rx_irq); in korina_restart()
926 struct korina_private *lp = netdev_priv(dev); in korina_clear_and_restart() local
929 writel(value, &lp->eth_regs->ethintfc); in korina_clear_and_restart()
937 struct korina_private *lp = netdev_priv(dev); in korina_und_interrupt() local
940 spin_lock(&lp->lock); in korina_und_interrupt()
942 und = readl(&lp->eth_regs->ethintfc); in korina_und_interrupt()
947 spin_unlock(&lp->lock); in korina_und_interrupt()
954 struct korina_private *lp = netdev_priv(dev); in korina_tx_timeout() local
957 spin_lock_irqsave(&lp->lock, flags); in korina_tx_timeout()
959 spin_unlock_irqrestore(&lp->lock, flags); in korina_tx_timeout()
967 struct korina_private *lp = netdev_priv(dev); in korina_ovr_interrupt() local
970 spin_lock(&lp->lock); in korina_ovr_interrupt()
971 ovr = readl(&lp->eth_regs->ethintfc); in korina_ovr_interrupt()
976 spin_unlock(&lp->lock); in korina_ovr_interrupt()
992 struct korina_private *lp = netdev_priv(dev); in korina_open() local
1005 ret = request_irq(lp->rx_irq, &korina_rx_dma_interrupt, in korina_open()
1009 dev->name, lp->rx_irq); in korina_open()
1012 ret = request_irq(lp->tx_irq, &korina_tx_dma_interrupt, in korina_open()
1016 dev->name, lp->tx_irq); in korina_open()
1021 ret = request_irq(lp->ovr_irq, &korina_ovr_interrupt, in korina_open()
1025 dev->name, lp->ovr_irq); in korina_open()
1030 ret = request_irq(lp->und_irq, &korina_und_interrupt, in korina_open()
1034 dev->name, lp->und_irq); in korina_open()
1041 free_irq(lp->ovr_irq, dev); in korina_open()
1043 free_irq(lp->tx_irq, dev); in korina_open()
1045 free_irq(lp->rx_irq, dev); in korina_open()
1053 struct korina_private *lp = netdev_priv(dev); in korina_close() local
1057 disable_irq(lp->rx_irq); in korina_close()
1058 disable_irq(lp->tx_irq); in korina_close()
1059 disable_irq(lp->ovr_irq); in korina_close()
1060 disable_irq(lp->und_irq); in korina_close()
1063 tmp = readl(&lp->tx_dma_regs->dmasm); in korina_close()
1065 writel(tmp, &lp->tx_dma_regs->dmasm); in korina_close()
1068 tmp = readl(&lp->rx_dma_regs->dmasm); in korina_close()
1070 writel(tmp, &lp->rx_dma_regs->dmasm); in korina_close()
1074 napi_disable(&lp->napi); in korina_close()
1076 free_irq(lp->rx_irq, dev); in korina_close()
1077 free_irq(lp->tx_irq, dev); in korina_close()
1078 free_irq(lp->ovr_irq, dev); in korina_close()
1079 free_irq(lp->und_irq, dev); in korina_close()
1087 struct korina_private *lp; in korina_probe() local
1098 lp = netdev_priv(dev); in korina_probe()
1103 lp->rx_irq = platform_get_irq_byname(pdev, "korina_rx"); in korina_probe()
1104 lp->tx_irq = platform_get_irq_byname(pdev, "korina_tx"); in korina_probe()
1105 lp->ovr_irq = platform_get_irq_byname(pdev, "korina_ovr"); in korina_probe()
1106 lp->und_irq = platform_get_irq_byname(pdev, "korina_und"); in korina_probe()
1110 lp->eth_regs = ioremap_nocache(r->start, r->end - r->start); in korina_probe()
1111 if (!lp->eth_regs) { in korina_probe()
1118 lp->rx_dma_regs = ioremap_nocache(r->start, r->end - r->start); in korina_probe()
1119 if (!lp->rx_dma_regs) { in korina_probe()
1126 lp->tx_dma_regs = ioremap_nocache(r->start, r->end - r->start); in korina_probe()
1127 if (!lp->tx_dma_regs) { in korina_probe()
1133 lp->td_ring = kmalloc(TD_RING_SIZE + RD_RING_SIZE, GFP_KERNEL); in korina_probe()
1134 if (!lp->td_ring) { in korina_probe()
1140 dma_cache_inv((unsigned long)(lp->td_ring), in korina_probe()
1144 lp->td_ring = (struct dma_desc *)KSEG1ADDR(lp->td_ring); in korina_probe()
1145 lp->rd_ring = &lp->td_ring[KORINA_NUM_TDS]; in korina_probe()
1147 spin_lock_init(&lp->lock); in korina_probe()
1149 dev->irq = lp->rx_irq; in korina_probe()
1150 lp->dev = dev; in korina_probe()
1163 netif_napi_add(dev, &lp->napi, korina_poll, 64); in korina_probe()
1165 lp->phy_addr = (((lp->rx_irq == 0x2c? 1:0) << 8) | 0x05); in korina_probe()
1166 lp->mii_if.dev = dev; in korina_probe()
1167 lp->mii_if.mdio_read = mdio_read; in korina_probe()
1168 lp->mii_if.mdio_write = mdio_write; in korina_probe()
1169 lp->mii_if.phy_id = lp->phy_addr; in korina_probe()
1170 lp->mii_if.phy_id_mask = 0x1f; in korina_probe()
1171 lp->mii_if.reg_num_mask = 0x1f; in korina_probe()
1183 kfree(lp->td_ring); in korina_probe()
1185 iounmap(lp->tx_dma_regs); in korina_probe()
1187 iounmap(lp->rx_dma_regs); in korina_probe()
1189 iounmap(lp->eth_regs); in korina_probe()
1198 struct korina_private *lp = netdev_priv(bif->dev); in korina_remove() local
1200 iounmap(lp->eth_regs); in korina_remove()
1201 iounmap(lp->rx_dma_regs); in korina_remove()
1202 iounmap(lp->tx_dma_regs); in korina_remove()