瀏覽代碼

dmaengine: ti: k3-udma: Use different byte counters in tx_status

Swap the byte counters we use in UDMAP for position calculation:
MEM_TO_DEV - SBCNT (started byte counter)
DEV_TO_MEM - BCNT (completed byte counter)
MEM_TO_MEM - BCNT (completed byte counter)

In hw I have never seen a case when SBCNT != BCNT, but to be sure we are
reading the logically correct counter for the transfer direction.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>
Tested-by: Keerthy <j-keerthy@ti.com>
Peter Ujfalusi 6 年之前
父節點
當前提交
abcf024492
共有 1 個文件被更改,包括 3 次插入3 次删除
  1. 3 3
      drivers/dma/ti/k3-udma.c

+ 3 - 3
drivers/dma/ti/k3-udma.c

@@ -2632,7 +2632,7 @@ static enum dma_status udma_tx_status(struct dma_chan *chan,
 
 		if (uc->desc->dir == DMA_MEM_TO_DEV) {
 			bcnt = udma_tchanrt_read(uc->tchan,
-						 UDMA_TCHAN_RT_BCNT_REG);
+						 UDMA_TCHAN_RT_SBCNT_REG);
 			pdma_bcnt = udma_tchanrt_read(uc->tchan,
 						UDMA_TCHAN_RT_PEER_BCNT_REG);
 			pcnt = udma_tchanrt_read(uc->tchan,
@@ -2642,7 +2642,7 @@ static enum dma_status udma_tx_status(struct dma_chan *chan,
 				delay = bcnt - pdma_bcnt;
 		} else if (uc->desc->dir == DMA_DEV_TO_MEM) {
 			bcnt = udma_rchanrt_read(uc->rchan,
-						 UDMA_RCHAN_RT_SBCNT_REG);
+						 UDMA_RCHAN_RT_BCNT_REG);
 			pdma_bcnt = udma_rchanrt_read(uc->rchan,
 						UDMA_RCHAN_RT_PEER_BCNT_REG);
 			pcnt = udma_rchanrt_read(uc->rchan,
@@ -2654,7 +2654,7 @@ static enum dma_status udma_tx_status(struct dma_chan *chan,
 			u32 sbcnt;
 
 			sbcnt = udma_tchanrt_read(uc->tchan,
-						  UDMA_TCHAN_RT_SBCNT_REG);
+						  UDMA_TCHAN_RT_BCNT_REG);
 			bcnt = udma_tchanrt_read(uc->tchan,
 						 UDMA_TCHAN_RT_PEER_BCNT_REG);
 			pcnt = udma_tchanrt_read(uc->tchan,