Skip to content

Commit 0db2b67

Browse files
miquelraynalvinodkoul
authored andcommitted
dmaengine: xilinx: xdma: Prepare the introduction of cyclic transfers
In order to reduce and clarify the diff when introducing cyclic transfers support, let's first prepare the driver a bit. There is no functional change. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/r/20231005160237.2804238-3-miquel.raynal@bootlin.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
1 parent c48de45 commit 0db2b67

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

drivers/dma/xilinx/xdma.c

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,10 @@ static inline void *xdma_blk_last_desc(struct xdma_desc_block *block)
137137
}
138138

139139
/**
140-
* xdma_link_desc_blocks - Link descriptor blocks for DMA transfer
140+
* xdma_link_sg_desc_blocks - Link SG descriptor blocks for DMA transfer
141141
* @sw_desc: Tx descriptor pointer
142142
*/
143-
static void xdma_link_desc_blocks(struct xdma_desc *sw_desc)
143+
static void xdma_link_sg_desc_blocks(struct xdma_desc *sw_desc)
144144
{
145145
struct xdma_desc_block *block;
146146
u32 last_blk_desc, desc_control;
@@ -239,6 +239,7 @@ xdma_alloc_desc(struct xdma_chan *chan, u32 desc_num)
239239
struct xdma_hw_desc *desc;
240240
dma_addr_t dma_addr;
241241
u32 dblk_num;
242+
u32 control;
242243
void *addr;
243244
int i, j;
244245

@@ -254,6 +255,8 @@ xdma_alloc_desc(struct xdma_chan *chan, u32 desc_num)
254255
if (!sw_desc->desc_blocks)
255256
goto failed;
256257

258+
control = XDMA_DESC_CONTROL(1, 0);
259+
257260
sw_desc->dblk_num = dblk_num;
258261
for (i = 0; i < sw_desc->dblk_num; i++) {
259262
addr = dma_pool_alloc(chan->desc_pool, GFP_NOWAIT, &dma_addr);
@@ -263,10 +266,10 @@ xdma_alloc_desc(struct xdma_chan *chan, u32 desc_num)
263266
sw_desc->desc_blocks[i].virt_addr = addr;
264267
sw_desc->desc_blocks[i].dma_addr = dma_addr;
265268
for (j = 0, desc = addr; j < XDMA_DESC_ADJACENT; j++)
266-
desc[j].control = cpu_to_le32(XDMA_DESC_CONTROL(1, 0));
269+
desc[j].control = cpu_to_le32(control);
267270
}
268271

269-
xdma_link_desc_blocks(sw_desc);
272+
xdma_link_sg_desc_blocks(sw_desc);
270273

271274
return sw_desc;
272275

@@ -577,6 +580,12 @@ static int xdma_alloc_chan_resources(struct dma_chan *chan)
577580
return 0;
578581
}
579582

583+
static enum dma_status xdma_tx_status(struct dma_chan *chan, dma_cookie_t cookie,
584+
struct dma_tx_state *state)
585+
{
586+
return dma_cookie_status(chan, cookie, state);
587+
}
588+
580589
/**
581590
* xdma_channel_isr - XDMA channel interrupt handler
582591
* @irq: IRQ number
@@ -923,7 +932,7 @@ static int xdma_probe(struct platform_device *pdev)
923932
xdev->dma_dev.dev = &pdev->dev;
924933
xdev->dma_dev.device_free_chan_resources = xdma_free_chan_resources;
925934
xdev->dma_dev.device_alloc_chan_resources = xdma_alloc_chan_resources;
926-
xdev->dma_dev.device_tx_status = dma_cookie_status;
935+
xdev->dma_dev.device_tx_status = xdma_tx_status;
927936
xdev->dma_dev.device_prep_slave_sg = xdma_prep_device_sg;
928937
xdev->dma_dev.device_config = xdma_device_config;
929938
xdev->dma_dev.device_issue_pending = xdma_issue_pending;

0 commit comments

Comments
 (0)