Skip to content

Commit b6d19f4

Browse files
jailuthragregkh
authored andcommitted
dmaengine: ti: k3-udma: Report short packet errors
[ Upstream commit bc9847c ] Propagate the TR response status to the device using BCDMA split-channels. For example CSI-RX driver should be able to check if a frame was not transferred completely (short packet) and needs to be discarded. Fixes: 25dcb5d ("dmaengine: ti: New driver for K3 UDMA") Signed-off-by: Jai Luthra <j-luthra@ti.com> Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com> Link: https://lore.kernel.org/r/20240103-tr_resp_err-v1-1-2fdf6d48ab92@ti.com Signed-off-by: Vinod Koul <vkoul@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 90fa411 commit b6d19f4

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

drivers/dma/ti/k3-udma.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3968,6 +3968,7 @@ static void udma_desc_pre_callback(struct virt_dma_chan *vc,
39683968
{
39693969
struct udma_chan *uc = to_udma_chan(&vc->chan);
39703970
struct udma_desc *d;
3971+
u8 status;
39713972

39723973
if (!vd)
39733974
return;
@@ -3977,12 +3978,12 @@ static void udma_desc_pre_callback(struct virt_dma_chan *vc,
39773978
if (d->metadata_size)
39783979
udma_fetch_epib(uc, d);
39793980

3980-
/* Provide residue information for the client */
39813981
if (result) {
39823982
void *desc_vaddr = udma_curr_cppi5_desc_vaddr(d, d->desc_idx);
39833983

39843984
if (cppi5_desc_get_type(desc_vaddr) ==
39853985
CPPI5_INFO0_DESC_TYPE_VAL_HOST) {
3986+
/* Provide residue information for the client */
39863987
result->residue = d->residue -
39873988
cppi5_hdesc_get_pktlen(desc_vaddr);
39883989
if (result->residue)
@@ -3991,7 +3992,12 @@ static void udma_desc_pre_callback(struct virt_dma_chan *vc,
39913992
result->result = DMA_TRANS_NOERROR;
39923993
} else {
39933994
result->residue = 0;
3994-
result->result = DMA_TRANS_NOERROR;
3995+
/* Propagate TR Response errors to the client */
3996+
status = d->hwdesc[0].tr_resp_base->status;
3997+
if (status)
3998+
result->result = DMA_TRANS_ABORTED;
3999+
else
4000+
result->result = DMA_TRANS_NOERROR;
39954001
}
39964002
}
39974003
}

0 commit comments

Comments
 (0)