Lines Matching full:fdma
3 * Microsemi SoCs FDMA driver
24 regmap_write(ocelot->targets[FDMA], reg, data); in ocelot_fdma_writel()
31 regmap_read(ocelot->targets[FDMA], reg, &retval); in ocelot_fdma_readl()
56 static int ocelot_fdma_rx_ring_free(struct ocelot_fdma *fdma) in ocelot_fdma_rx_ring_free() argument
58 struct ocelot_fdma_rx_ring *rx_ring = &fdma->rx_ring; in ocelot_fdma_rx_ring_free()
67 static int ocelot_fdma_tx_ring_free(struct ocelot_fdma *fdma) in ocelot_fdma_tx_ring_free() argument
69 struct ocelot_fdma_tx_ring *tx_ring = &fdma->tx_ring; in ocelot_fdma_tx_ring_free()
78 static bool ocelot_fdma_tx_ring_empty(struct ocelot_fdma *fdma) in ocelot_fdma_tx_ring_empty() argument
80 struct ocelot_fdma_tx_ring *tx_ring = &fdma->tx_ring; in ocelot_fdma_tx_ring_empty()
148 struct ocelot_fdma *fdma = ocelot->fdma; in ocelot_fdma_alloc_rx_buffs() local
156 rx_ring = &fdma->rx_ring; in ocelot_fdma_alloc_rx_buffs()
212 /* Check if the FDMA hits the DCB with LLP == NULL */ in ocelot_fdma_check_stop_rx()
236 struct ocelot_fdma *fdma = ocelot->fdma; in ocelot_fdma_rx_restart() local
244 rx_ring = &fdma->rx_ring; in ocelot_fdma_rx_restart()
254 /* FDMA stopped on the last DCB that contained a NULL LLP, since in ocelot_fdma_rx_restart()
298 struct ocelot_fdma_rx_ring *rx_ring = &ocelot->fdma->rx_ring; in ocelot_fdma_reuse_rx_page()
391 struct ocelot_fdma *fdma = ocelot->fdma; in ocelot_fdma_rx_get() local
401 cleaned_cnt = ocelot_fdma_rx_ring_free(fdma); in ocelot_fdma_rx_get()
402 rx_ring = &fdma->rx_ring; in ocelot_fdma_rx_get()
483 struct ocelot_fdma *fdma = ocelot->fdma; in ocelot_fdma_tx_cleanup() local
495 tx_ring = &fdma->tx_ring; in ocelot_fdma_tx_cleanup()
500 while (!ocelot_fdma_tx_ring_empty(fdma)) { in ocelot_fdma_tx_cleanup()
517 /* If we hit the NULL LLP, stop, we might need to reload FDMA */ in ocelot_fdma_tx_cleanup()
525 if (ocelot_fdma_tx_ring_free(fdma)) in ocelot_fdma_tx_cleanup()
528 /* If there is still some DCBs to be processed by the FDMA or if the in ocelot_fdma_tx_cleanup()
529 * pending list is empty, there is no need to restart the FDMA. in ocelot_fdma_tx_cleanup()
531 if (!end_of_list || ocelot_fdma_tx_ring_empty(fdma)) in ocelot_fdma_tx_cleanup()
553 struct ocelot_fdma *fdma = container_of(napi, struct ocelot_fdma, napi); in ocelot_fdma_napi_poll() local
554 struct ocelot *ocelot = fdma->ocelot; in ocelot_fdma_napi_poll()
568 napi_complete_done(&fdma->napi, work_done); in ocelot_fdma_napi_poll()
590 napi_schedule(&ocelot->fdma->napi); in ocelot_fdma_interrupt()
608 struct ocelot_fdma *fdma, struct sk_buff *skb) in ocelot_fdma_send_skb() argument
610 struct ocelot_fdma_tx_ring *tx_ring = &fdma->tx_ring; in ocelot_fdma_send_skb()
627 /* If the FDMA TX chan is empty, then enqueue the DCB directly */ in ocelot_fdma_send_skb()
628 if (ocelot_fdma_tx_ring_empty(fdma)) { in ocelot_fdma_send_skb()
676 struct ocelot_fdma *fdma = ocelot->fdma; in ocelot_fdma_inject_frame() local
679 spin_lock(&fdma->tx_ring.xmit_lock); in ocelot_fdma_inject_frame()
681 if (ocelot_fdma_tx_ring_free(fdma) == 0) { in ocelot_fdma_inject_frame()
690 ocelot_fdma_send_skb(ocelot, fdma, skb); in ocelot_fdma_inject_frame()
693 spin_unlock(&fdma->tx_ring.xmit_lock); in ocelot_fdma_inject_frame()
700 struct ocelot_fdma *fdma = ocelot->fdma; in ocelot_fdma_free_rx_ring() local
705 rx_ring = &fdma->rx_ring; in ocelot_fdma_free_rx_ring()
717 if (fdma->rx_ring.skb) in ocelot_fdma_free_rx_ring()
718 dev_kfree_skb_any(fdma->rx_ring.skb); in ocelot_fdma_free_rx_ring()
723 struct ocelot_fdma *fdma = ocelot->fdma; in ocelot_fdma_free_tx_ring() local
729 tx_ring = &fdma->tx_ring; in ocelot_fdma_free_tx_ring()
744 struct ocelot_fdma *fdma = ocelot->fdma; in ocelot_fdma_rings_alloc() local
751 fdma->dcbs_base = dmam_alloc_coherent(ocelot->dev, in ocelot_fdma_rings_alloc()
753 &fdma->dcbs_dma_base, GFP_KERNEL); in ocelot_fdma_rings_alloc()
754 if (!fdma->dcbs_base) in ocelot_fdma_rings_alloc()
758 dcbs = fdma->dcbs_base; in ocelot_fdma_rings_alloc()
759 dcbs_dma = fdma->dcbs_dma_base; in ocelot_fdma_rings_alloc()
767 fdma->tx_ring.dcbs = dcbs; in ocelot_fdma_rings_alloc()
768 fdma->tx_ring.dcbs_dma = dcbs_dma; in ocelot_fdma_rings_alloc()
769 spin_lock_init(&fdma->tx_ring.xmit_lock); in ocelot_fdma_rings_alloc()
772 fdma->rx_ring.dcbs = dcbs + OCELOT_FDMA_TX_RING_SIZE; in ocelot_fdma_rings_alloc()
773 fdma->rx_ring.dcbs_dma = dcbs_dma + OCELOT_FDMA_TX_DCB_SIZE; in ocelot_fdma_rings_alloc()
775 ocelot_fdma_tx_ring_free(fdma)); in ocelot_fdma_rings_alloc()
784 ocelot_fdma_rx_set_llp(&fdma->rx_ring); in ocelot_fdma_rings_alloc()
791 struct ocelot_fdma *fdma = ocelot->fdma; in ocelot_fdma_netdev_init() local
796 if (fdma->ndev) in ocelot_fdma_netdev_init()
799 fdma->ndev = dev; in ocelot_fdma_netdev_init()
800 netif_napi_add_weight(dev, &fdma->napi, ocelot_fdma_napi_poll, in ocelot_fdma_netdev_init()
806 struct ocelot_fdma *fdma = ocelot->fdma; in ocelot_fdma_netdev_deinit() local
808 if (fdma->ndev == dev) { in ocelot_fdma_netdev_deinit()
809 netif_napi_del(&fdma->napi); in ocelot_fdma_netdev_deinit()
810 fdma->ndev = NULL; in ocelot_fdma_netdev_deinit()
817 struct ocelot_fdma *fdma; in ocelot_fdma_init() local
820 fdma = devm_kzalloc(dev, sizeof(*fdma), GFP_KERNEL); in ocelot_fdma_init()
821 if (!fdma) in ocelot_fdma_init()
824 ocelot->fdma = fdma; in ocelot_fdma_init()
829 fdma->ocelot = ocelot; in ocelot_fdma_init()
830 fdma->irq = platform_get_irq_byname(pdev, "fdma"); in ocelot_fdma_init()
831 ret = devm_request_irq(dev, fdma->irq, ocelot_fdma_interrupt, 0, in ocelot_fdma_init()
845 devm_free_irq(dev, fdma->irq, fdma); in ocelot_fdma_init()
847 devm_kfree(dev, fdma); in ocelot_fdma_init()
849 ocelot->fdma = NULL; in ocelot_fdma_init()
854 struct ocelot_fdma *fdma = ocelot->fdma; in ocelot_fdma_start() local
872 napi_enable(&fdma->napi); in ocelot_fdma_start()
874 ocelot_fdma_activate_chan(ocelot, ocelot->fdma->rx_ring.dcbs_dma, in ocelot_fdma_start()
880 struct ocelot_fdma *fdma = ocelot->fdma; in ocelot_fdma_deinit() local
887 napi_synchronize(&fdma->napi); in ocelot_fdma_deinit()
888 napi_disable(&fdma->napi); in ocelot_fdma_deinit()