Skip to content

Commit 9f007e7

Browse files
pinchartlvinodkoul
authored andcommitted
dmaengine: xilinx: dpdma: Limit descriptor IDs to 16 bits
While the descriptor ID is stored in a 32-bit field in the hardware descriptor, only 16 bits are used by the hardware and are reported through the XILINX_DPDMA_CH_DESC_ID register. Failure to handle the wrap-around results in a descriptor ID mismatch after 65536 frames. Fix it. Signed-off-by: Laurent Pinchart <[email protected]> Tested-by: Jianqiang Chen <[email protected]> Reviewed-by: Jianqiang Chen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent 32828b8 commit 9f007e7

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

drivers/dma/xilinx/xilinx_dpdma.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@
113113
#define XILINX_DPDMA_CH_VDO 0x020
114114
#define XILINX_DPDMA_CH_PYLD_SZ 0x024
115115
#define XILINX_DPDMA_CH_DESC_ID 0x028
116+
#define XILINX_DPDMA_CH_DESC_ID_MASK GENMASK(15, 0)
116117

117118
/* DPDMA descriptor fields */
118119
#define XILINX_DPDMA_DESC_CONTROL_PREEMBLE 0xa5
@@ -866,7 +867,8 @@ static void xilinx_dpdma_chan_queue_transfer(struct xilinx_dpdma_chan *chan)
866867
* will be used, but it should be enough.
867868
*/
868869
list_for_each_entry(sw_desc, &desc->descriptors, node)
869-
sw_desc->hw.desc_id = desc->vdesc.tx.cookie;
870+
sw_desc->hw.desc_id = desc->vdesc.tx.cookie
871+
& XILINX_DPDMA_CH_DESC_ID_MASK;
870872

871873
sw_desc = list_first_entry(&desc->descriptors,
872874
struct xilinx_dpdma_sw_desc, node);
@@ -1086,7 +1088,8 @@ static void xilinx_dpdma_chan_vsync_irq(struct xilinx_dpdma_chan *chan)
10861088
if (!chan->running || !pending)
10871089
goto out;
10881090

1089-
desc_id = dpdma_read(chan->reg, XILINX_DPDMA_CH_DESC_ID);
1091+
desc_id = dpdma_read(chan->reg, XILINX_DPDMA_CH_DESC_ID)
1092+
& XILINX_DPDMA_CH_DESC_ID_MASK;
10901093

10911094
/* If the retrigger raced with vsync, retry at the next frame. */
10921095
sw_desc = list_first_entry(&pending->descriptors,

0 commit comments

Comments
 (0)