diff options
author | jiaheng.fan <jiaheng.fan@nxp.com> | 2017-04-25 06:40:08 (GMT) |
---|---|---|
committer | Xie Xiaobo <xiaobo.xie@nxp.com> | 2017-09-25 07:25:39 (GMT) |
commit | e0d9e327f74866861daacb049b91e5ebfa5aea1e (patch) | |
tree | 6e7945e9141e227b56113e3cd9360b36b88a60dd /drivers/dma/fsl-qdma.c | |
parent | d5e693ce5d05ce42a1230e3046f687f2bfee33e2 (diff) | |
download | linux-e0d9e327f74866861daacb049b91e5ebfa5aea1e.tar.xz |
dma: fsl-qdma: Pre-request full command descriptor for enqueue.
Signed-off-by: jiaheng.fan <jiaheng.fan@nxp.com>
Diffstat (limited to 'drivers/dma/fsl-qdma.c')
-rw-r--r-- | drivers/dma/fsl-qdma.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/dma/fsl-qdma.c b/drivers/dma/fsl-qdma.c index 5428400..ad1ce74 100644 --- a/drivers/dma/fsl-qdma.c +++ b/drivers/dma/fsl-qdma.c @@ -424,6 +424,28 @@ static void fsl_qdma_comp_fill_sg( } /* + * Prei-request full command descriptor for enqueue. + */ +static int fsl_qdma_pre_request_enqueue_desc(struct fsl_qdma_queue *queue) +{ + struct fsl_qdma_comp *comp_temp; + int i; + + for (i = 0; i < queue->n_cq; i++) { + comp_temp = kzalloc(sizeof(*comp_temp), GFP_KERNEL); + if (!comp_temp) + return -1; + comp_temp->virt_addr = dma_pool_alloc(queue->comp_pool, + GFP_NOWAIT, + &comp_temp->bus_addr); + if (!comp_temp->virt_addr) + return -1; + list_add_tail(&comp_temp->list, &queue->comp_free); + } + return 0; +} + +/* * Request a command descriptor for enqueue. */ static struct fsl_qdma_comp *fsl_qdma_request_enqueue_desc( @@ -1066,6 +1088,8 @@ static int fsl_qdma_probe(struct platform_device *pdev) INIT_LIST_HEAD(&fsl_chan->qcomp); vchan_init(&fsl_chan->vchan, &fsl_qdma->dma_dev); } + for (i = 0; i < fsl_qdma->n_queues; i++) + fsl_qdma_pre_request_enqueue_desc(fsl_qdma->queue + i); dma_cap_set(DMA_MEMCPY, fsl_qdma->dma_dev.cap_mask); dma_cap_set(DMA_SG, fsl_qdma->dma_dev.cap_mask); |