Lines Matching refs:xdev
415 struct xilinx_dma_device *xdev; member
522 readl_poll_timeout_atomic(chan->xdev->regs + chan->ctrl_offset + reg, \
528 return ioread32(chan->xdev->regs + reg); in dma_read()
533 iowrite32(value, chan->xdev->regs + reg); in dma_write()
580 writel(value_lsb, chan->xdev->regs + chan->desc_offset + reg); in vdma_desc_write_64()
583 writel(value_msb, chan->xdev->regs + chan->desc_offset + reg + 4); in vdma_desc_write_64()
588 lo_hi_writeq(value, chan->xdev->regs + chan->ctrl_offset + reg); in dma_writeq()
831 if (chan->xdev->dma_config->dmatype == XDMA_TYPE_VDMA) { in xilinx_dma_free_tx_descriptor()
836 } else if (chan->xdev->dma_config->dmatype == XDMA_TYPE_CDMA) { in xilinx_dma_free_tx_descriptor()
842 } else if (chan->xdev->dma_config->dmatype == XDMA_TYPE_AXIDMA) { in xilinx_dma_free_tx_descriptor()
907 if (chan->xdev->dma_config->dmatype == XDMA_TYPE_AXIDMA) { in xilinx_dma_free_chan_resources()
922 if (chan->xdev->dma_config->dmatype == XDMA_TYPE_AXIMCDMA) { in xilinx_dma_free_chan_resources()
933 if (chan->xdev->dma_config->dmatype != XDMA_TYPE_AXIDMA && in xilinx_dma_free_chan_resources()
934 chan->xdev->dma_config->dmatype != XDMA_TYPE_AXIMCDMA) { in xilinx_dma_free_chan_resources()
961 if (chan->xdev->dma_config->dmatype == XDMA_TYPE_CDMA) { in xilinx_dma_get_residue()
967 chan->xdev->max_buffer_len; in xilinx_dma_get_residue()
968 } else if (chan->xdev->dma_config->dmatype == in xilinx_dma_get_residue()
975 chan->xdev->max_buffer_len; in xilinx_dma_get_residue()
984 chan->xdev->max_buffer_len; in xilinx_dma_get_residue()
1094 if (chan->xdev->dma_config->dmatype == XDMA_TYPE_AXIDMA) { in xilinx_dma_alloc_chan_resources()
1137 } else if (chan->xdev->dma_config->dmatype == XDMA_TYPE_AXIMCDMA) { in xilinx_dma_alloc_chan_resources()
1161 } else if (chan->xdev->dma_config->dmatype == XDMA_TYPE_CDMA) { in xilinx_dma_alloc_chan_resources()
1176 ((chan->xdev->dma_config->dmatype != XDMA_TYPE_AXIDMA) && in xilinx_dma_alloc_chan_resources()
1177 chan->xdev->dma_config->dmatype != XDMA_TYPE_AXIMCDMA)) { in xilinx_dma_alloc_chan_resources()
1186 if (chan->xdev->dma_config->dmatype == XDMA_TYPE_AXIDMA) { in xilinx_dma_alloc_chan_resources()
1194 if ((chan->xdev->dma_config->dmatype == XDMA_TYPE_CDMA) && chan->has_sg) in xilinx_dma_alloc_chan_resources()
1215 chan->xdev->max_buffer_len); in xilinx_dma_calc_copysize()
1218 chan->xdev->common.copy_align) { in xilinx_dma_calc_copysize()
1224 (1 << chan->xdev->common.copy_align)); in xilinx_dma_calc_copysize()
1259 if (chan->has_sg && chan->xdev->dma_config->dmatype != XDMA_TYPE_VDMA) in xilinx_dma_tx_status()
1492 hw->control & chan->xdev->max_buffer_len); in xilinx_cdma_start_transfer()
1566 hw->control & chan->xdev->max_buffer_len); in xilinx_dma_start_transfer()
1684 if (chan->has_sg && chan->xdev->dma_config->dmatype != in xilinx_dma_complete_descriptor()
1778 chan_offset = chan->xdev->dma_config->max_channels / 2; in xilinx_mcdma_irq_handler()
1781 chan = chan->xdev->chan[chan_offset]; in xilinx_mcdma_irq_handler()
1908 if (chan->xdev->dma_config->dmatype == XDMA_TYPE_VDMA) { in append_desc_queue()
1913 } else if (chan->xdev->dma_config->dmatype == XDMA_TYPE_CDMA) { in append_desc_queue()
1918 } else if (chan->xdev->dma_config->dmatype == XDMA_TYPE_AXIDMA) { in append_desc_queue()
1939 if (chan->has_sg && (chan->xdev->dma_config->dmatype == XDMA_TYPE_VDMA) in append_desc_queue()
2093 if (!len || len > chan->xdev->max_buffer_len) in xilinx_cdma_prep_memcpy()
2391 chan->xdev->max_buffer_len); in xilinx_mcdma_prep_slave_sg()
2469 if ((chan->xdev->dma_config->dmatype == XDMA_TYPE_CDMA) && chan->has_sg) in xilinx_dma_terminate_all()
2745 static void xdma_disable_allclks(struct xilinx_dma_device *xdev) in xdma_disable_allclks() argument
2747 clk_disable_unprepare(xdev->rxs_clk); in xdma_disable_allclks()
2748 clk_disable_unprepare(xdev->rx_clk); in xdma_disable_allclks()
2749 clk_disable_unprepare(xdev->txs_clk); in xdma_disable_allclks()
2750 clk_disable_unprepare(xdev->tx_clk); in xdma_disable_allclks()
2751 clk_disable_unprepare(xdev->axi_clk); in xdma_disable_allclks()
2764 static int xilinx_dma_chan_probe(struct xilinx_dma_device *xdev, in xilinx_dma_chan_probe() argument
2773 chan = devm_kzalloc(xdev->dev, sizeof(*chan), GFP_KERNEL); in xilinx_dma_chan_probe()
2777 chan->dev = xdev->dev; in xilinx_dma_chan_probe()
2778 chan->xdev = xdev; in xilinx_dma_chan_probe()
2780 chan->ext_addr = xdev->ext_addr; in xilinx_dma_chan_probe()
2801 dev_err(xdev->dev, "missing xlnx,datawidth property\n"); in xilinx_dma_chan_probe()
2811 xdev->common.copy_align = (enum dmaengine_alignment)fls(width - 1); in xilinx_dma_chan_probe()
2817 chan->id = xdev->mm2s_chan_id++; in xilinx_dma_chan_probe()
2821 if (xdev->dma_config->dmatype == XDMA_TYPE_VDMA) { in xilinx_dma_chan_probe()
2825 if (xdev->flush_on_fsync == XILINX_DMA_FLUSH_BOTH || in xilinx_dma_chan_probe()
2826 xdev->flush_on_fsync == XILINX_DMA_FLUSH_MM2S) in xilinx_dma_chan_probe()
2834 chan->id = xdev->s2mm_chan_id++; in xilinx_dma_chan_probe()
2835 chan->tdest = chan->id - xdev->dma_config->max_channels / 2; in xilinx_dma_chan_probe()
2844 if (xdev->dma_config->dmatype == XDMA_TYPE_AXIMCDMA) in xilinx_dma_chan_probe()
2849 if (xdev->dma_config->dmatype == XDMA_TYPE_VDMA) { in xilinx_dma_chan_probe()
2853 if (xdev->flush_on_fsync == XILINX_DMA_FLUSH_BOTH || in xilinx_dma_chan_probe()
2854 xdev->flush_on_fsync == XILINX_DMA_FLUSH_S2MM) in xilinx_dma_chan_probe()
2858 dev_err(xdev->dev, "Invalid channel compatible node\n"); in xilinx_dma_chan_probe()
2864 err = request_irq(chan->irq, xdev->dma_config->irq_handler, in xilinx_dma_chan_probe()
2867 dev_err(xdev->dev, "unable to request IRQ %d\n", chan->irq); in xilinx_dma_chan_probe()
2871 if (xdev->dma_config->dmatype == XDMA_TYPE_AXIDMA) { in xilinx_dma_chan_probe()
2874 } else if (xdev->dma_config->dmatype == XDMA_TYPE_AXIMCDMA) { in xilinx_dma_chan_probe()
2877 } else if (xdev->dma_config->dmatype == XDMA_TYPE_CDMA) { in xilinx_dma_chan_probe()
2886 if (xdev->dma_config->dmatype != XDMA_TYPE_VDMA) { in xilinx_dma_chan_probe()
2887 if (xdev->dma_config->dmatype == XDMA_TYPE_AXIMCDMA || in xilinx_dma_chan_probe()
2902 chan->common.device = &xdev->common; in xilinx_dma_chan_probe()
2904 list_add_tail(&chan->common.device_node, &xdev->common.channels); in xilinx_dma_chan_probe()
2905 xdev->chan[chan->id] = chan; in xilinx_dma_chan_probe()
2910 dev_err(xdev->dev, "Reset channel failed\n"); in xilinx_dma_chan_probe()
2927 static int xilinx_dma_child_probe(struct xilinx_dma_device *xdev, in xilinx_dma_child_probe() argument
2934 if (xdev->dma_config->dmatype == XDMA_TYPE_AXIMCDMA && ret < 0) in xilinx_dma_child_probe()
2935 dev_warn(xdev->dev, "missing dma-channels property\n"); in xilinx_dma_child_probe()
2938 xilinx_dma_chan_probe(xdev, node); in xilinx_dma_child_probe()
2953 struct xilinx_dma_device *xdev = ofdma->of_dma_data; in of_dma_xilinx_xlate() local
2956 if (chan_id >= xdev->dma_config->max_channels || !xdev->chan[chan_id]) in of_dma_xilinx_xlate()
2959 return dma_get_slave_channel(&xdev->chan[chan_id]->common); in of_dma_xilinx_xlate()
3010 struct xilinx_dma_device *xdev; in xilinx_dma_probe() local
3016 xdev = devm_kzalloc(&pdev->dev, sizeof(*xdev), GFP_KERNEL); in xilinx_dma_probe()
3017 if (!xdev) in xilinx_dma_probe()
3020 xdev->dev = &pdev->dev; in xilinx_dma_probe()
3026 xdev->dma_config = match->data; in xilinx_dma_probe()
3027 clk_init = xdev->dma_config->clk_init; in xilinx_dma_probe()
3031 err = clk_init(pdev, &xdev->axi_clk, &xdev->tx_clk, &xdev->txs_clk, in xilinx_dma_probe()
3032 &xdev->rx_clk, &xdev->rxs_clk); in xilinx_dma_probe()
3037 xdev->regs = devm_platform_ioremap_resource(pdev, 0); in xilinx_dma_probe()
3038 if (IS_ERR(xdev->regs)) in xilinx_dma_probe()
3039 return PTR_ERR(xdev->regs); in xilinx_dma_probe()
3042 xdev->max_buffer_len = GENMASK(XILINX_DMA_MAX_TRANS_LEN_MAX - 1, 0); in xilinx_dma_probe()
3043 xdev->s2mm_chan_id = xdev->dma_config->max_channels / 2; in xilinx_dma_probe()
3045 if (xdev->dma_config->dmatype == XDMA_TYPE_AXIDMA || in xilinx_dma_probe()
3046 xdev->dma_config->dmatype == XDMA_TYPE_AXIMCDMA) { in xilinx_dma_probe()
3051 dev_warn(xdev->dev, in xilinx_dma_probe()
3055 dev_warn(xdev->dev, "Please ensure that IP supports buffer length > 23 bits\n"); in xilinx_dma_probe()
3056 xdev->max_buffer_len = in xilinx_dma_probe()
3062 if (xdev->dma_config->dmatype == XDMA_TYPE_VDMA) { in xilinx_dma_probe()
3066 dev_err(xdev->dev, in xilinx_dma_probe()
3072 &xdev->flush_on_fsync); in xilinx_dma_probe()
3074 dev_warn(xdev->dev, in xilinx_dma_probe()
3080 dev_warn(xdev->dev, "missing xlnx,addrwidth property\n"); in xilinx_dma_probe()
3083 xdev->ext_addr = true; in xilinx_dma_probe()
3085 xdev->ext_addr = false; in xilinx_dma_probe()
3088 dma_set_mask_and_coherent(xdev->dev, DMA_BIT_MASK(addr_width)); in xilinx_dma_probe()
3091 xdev->common.dev = &pdev->dev; in xilinx_dma_probe()
3093 INIT_LIST_HEAD(&xdev->common.channels); in xilinx_dma_probe()
3094 if (!(xdev->dma_config->dmatype == XDMA_TYPE_CDMA)) { in xilinx_dma_probe()
3095 dma_cap_set(DMA_SLAVE, xdev->common.cap_mask); in xilinx_dma_probe()
3096 dma_cap_set(DMA_PRIVATE, xdev->common.cap_mask); in xilinx_dma_probe()
3099 xdev->common.device_alloc_chan_resources = in xilinx_dma_probe()
3101 xdev->common.device_free_chan_resources = in xilinx_dma_probe()
3103 xdev->common.device_terminate_all = xilinx_dma_terminate_all; in xilinx_dma_probe()
3104 xdev->common.device_synchronize = xilinx_dma_synchronize; in xilinx_dma_probe()
3105 xdev->common.device_tx_status = xilinx_dma_tx_status; in xilinx_dma_probe()
3106 xdev->common.device_issue_pending = xilinx_dma_issue_pending; in xilinx_dma_probe()
3107 xdev->common.device_config = xilinx_dma_device_config; in xilinx_dma_probe()
3108 if (xdev->dma_config->dmatype == XDMA_TYPE_AXIDMA) { in xilinx_dma_probe()
3109 dma_cap_set(DMA_CYCLIC, xdev->common.cap_mask); in xilinx_dma_probe()
3110 xdev->common.device_prep_slave_sg = xilinx_dma_prep_slave_sg; in xilinx_dma_probe()
3111 xdev->common.device_prep_dma_cyclic = in xilinx_dma_probe()
3114 xdev->common.residue_granularity = in xilinx_dma_probe()
3116 } else if (xdev->dma_config->dmatype == XDMA_TYPE_CDMA) { in xilinx_dma_probe()
3117 dma_cap_set(DMA_MEMCPY, xdev->common.cap_mask); in xilinx_dma_probe()
3118 xdev->common.device_prep_dma_memcpy = xilinx_cdma_prep_memcpy; in xilinx_dma_probe()
3120 xdev->common.residue_granularity = in xilinx_dma_probe()
3122 } else if (xdev->dma_config->dmatype == XDMA_TYPE_AXIMCDMA) { in xilinx_dma_probe()
3123 xdev->common.device_prep_slave_sg = xilinx_mcdma_prep_slave_sg; in xilinx_dma_probe()
3125 xdev->common.device_prep_interleaved_dma = in xilinx_dma_probe()
3129 platform_set_drvdata(pdev, xdev); in xilinx_dma_probe()
3133 err = xilinx_dma_child_probe(xdev, child); in xilinx_dma_probe()
3138 if (xdev->dma_config->dmatype == XDMA_TYPE_VDMA) { in xilinx_dma_probe()
3139 for (i = 0; i < xdev->dma_config->max_channels; i++) in xilinx_dma_probe()
3140 if (xdev->chan[i]) in xilinx_dma_probe()
3141 xdev->chan[i]->num_frms = num_frames; in xilinx_dma_probe()
3145 err = dma_async_device_register(&xdev->common); in xilinx_dma_probe()
3147 dev_err(xdev->dev, "failed to register the dma device\n"); in xilinx_dma_probe()
3152 xdev); in xilinx_dma_probe()
3155 dma_async_device_unregister(&xdev->common); in xilinx_dma_probe()
3159 if (xdev->dma_config->dmatype == XDMA_TYPE_AXIDMA) in xilinx_dma_probe()
3161 else if (xdev->dma_config->dmatype == XDMA_TYPE_CDMA) in xilinx_dma_probe()
3163 else if (xdev->dma_config->dmatype == XDMA_TYPE_AXIMCDMA) in xilinx_dma_probe()
3171 xdma_disable_allclks(xdev); in xilinx_dma_probe()
3173 for (i = 0; i < xdev->dma_config->max_channels; i++) in xilinx_dma_probe()
3174 if (xdev->chan[i]) in xilinx_dma_probe()
3175 xilinx_dma_chan_remove(xdev->chan[i]); in xilinx_dma_probe()
3188 struct xilinx_dma_device *xdev = platform_get_drvdata(pdev); in xilinx_dma_remove() local
3193 dma_async_device_unregister(&xdev->common); in xilinx_dma_remove()
3195 for (i = 0; i < xdev->dma_config->max_channels; i++) in xilinx_dma_remove()
3196 if (xdev->chan[i]) in xilinx_dma_remove()
3197 xilinx_dma_chan_remove(xdev->chan[i]); in xilinx_dma_remove()
3199 xdma_disable_allclks(xdev); in xilinx_dma_remove()