Skip to content

Commit 84b798f

Browse files
Radhey Shyam Pandeyvinodkoul
authored andcommitted
dmaengine: xilinx_dma: Program interrupt delay timeout
Program IRQDelay for AXI DMA. The interrupt timeout mechanism causes the DMA engine to generate an interrupt after the delay time period has expired. It enables dmaengine to respond in real-time even though interrupt coalescing is configured. It also remove the placeholder for delay interrupt and merge it with frame completion interrupt. Since by default interrupt delay timeout is disabled this feature addition has no functional impact on VDMA, MCDMA and CDMA IP's. Signed-off-by: Radhey Shyam Pandey <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent c77d4c5 commit 84b798f

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

drivers/dma/xilinx/xilinx_dma.c

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,10 @@
173173
#define XILINX_DMA_MAX_TRANS_LEN_MAX 23
174174
#define XILINX_DMA_V2_MAX_TRANS_LEN_MAX 26
175175
#define XILINX_DMA_CR_COALESCE_MAX GENMASK(23, 16)
176+
#define XILINX_DMA_CR_DELAY_MAX GENMASK(31, 24)
176177
#define XILINX_DMA_CR_CYCLIC_BD_EN_MASK BIT(4)
177178
#define XILINX_DMA_CR_COALESCE_SHIFT 16
179+
#define XILINX_DMA_CR_DELAY_SHIFT 24
178180
#define XILINX_DMA_BD_SOP BIT(27)
179181
#define XILINX_DMA_BD_EOP BIT(26)
180182
#define XILINX_DMA_BD_COMP_MASK BIT(31)
@@ -411,6 +413,7 @@ struct xilinx_dma_tx_descriptor {
411413
* @stop_transfer: Differentiate b/w DMA IP's quiesce
412414
* @tdest: TDEST value for mcdma
413415
* @has_vflip: S2MM vertical flip
416+
* @irq_delay: Interrupt delay timeout
414417
*/
415418
struct xilinx_dma_chan {
416419
struct xilinx_dma_device *xdev;
@@ -449,6 +452,7 @@ struct xilinx_dma_chan {
449452
int (*stop_transfer)(struct xilinx_dma_chan *chan);
450453
u16 tdest;
451454
bool has_vflip;
455+
u8 irq_delay;
452456
};
453457

454458
/**
@@ -1561,6 +1565,9 @@ static void xilinx_dma_start_transfer(struct xilinx_dma_chan *chan)
15611565
if (chan->has_sg)
15621566
xilinx_write(chan, XILINX_DMA_REG_CURDESC,
15631567
head_desc->async_tx.phys);
1568+
reg &= ~XILINX_DMA_CR_DELAY_MAX;
1569+
reg |= chan->irq_delay << XILINX_DMA_CR_DELAY_SHIFT;
1570+
dma_ctrl_write(chan, XILINX_DMA_REG_DMACR, reg);
15641571

15651572
xilinx_dma_start(chan);
15661573

@@ -1898,15 +1905,8 @@ static irqreturn_t xilinx_dma_irq_handler(int irq, void *data)
18981905
}
18991906
}
19001907

1901-
if (status & XILINX_DMA_DMASR_DLY_CNT_IRQ) {
1902-
/*
1903-
* Device takes too long to do the transfer when user requires
1904-
* responsiveness.
1905-
*/
1906-
dev_dbg(chan->dev, "Inter-packet latency too long\n");
1907-
}
1908-
1909-
if (status & XILINX_DMA_DMASR_FRM_CNT_IRQ) {
1908+
if (status & (XILINX_DMA_DMASR_FRM_CNT_IRQ |
1909+
XILINX_DMA_DMASR_DLY_CNT_IRQ)) {
19101910
spin_lock(&chan->lock);
19111911
xilinx_dma_complete_descriptor(chan);
19121912
chan->idle = true;
@@ -2833,6 +2833,8 @@ static int xilinx_dma_chan_probe(struct xilinx_dma_device *xdev,
28332833
/* Retrieve the channel properties from the device tree */
28342834
has_dre = of_property_read_bool(node, "xlnx,include-dre");
28352835

2836+
of_property_read_u8(node, "xlnx,irq-delay", &chan->irq_delay);
2837+
28362838
chan->genlock = of_property_read_bool(node, "xlnx,genlock-mode");
28372839

28382840
err = of_property_read_u32(node, "xlnx,datawidth", &value);

0 commit comments

Comments
 (0)