Commit c2da2340 authored by Thomas Gleixner's avatar Thomas Gleixner Committed by Vinod Koul

dmaengine: edma: Store transfer data in edma_desc and edma_pset

For granular accounting we need to store the direction and the
information for the individual psets:

- source or destination address, depending on direction
- length
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarJoel Fernandes <joelf@ti.com>
Signed-off-by: default avatarVinod Koul <vinod.koul@intel.com>
parent b5088ad9
...@@ -58,12 +58,15 @@ ...@@ -58,12 +58,15 @@
#define EDMA_DESCRIPTORS 16 #define EDMA_DESCRIPTORS 16
struct edma_pset { struct edma_pset {
u32 len;
dma_addr_t addr;
struct edmacc_param param; struct edmacc_param param;
}; };
struct edma_desc { struct edma_desc {
struct virt_dma_desc vdesc; struct virt_dma_desc vdesc;
struct list_head node; struct list_head node;
enum dma_transfer_direction direction;
int cyclic; int cyclic;
int absync; int absync;
int pset_nr; int pset_nr;
...@@ -376,16 +379,20 @@ static int edma_config_pset(struct dma_chan *chan, struct edma_pset *epset, ...@@ -376,16 +379,20 @@ static int edma_config_pset(struct dma_chan *chan, struct edma_pset *epset,
cidx = acnt * bcnt; cidx = acnt * bcnt;
} }
epset->len = dma_length;
if (direction == DMA_MEM_TO_DEV) { if (direction == DMA_MEM_TO_DEV) {
src_bidx = acnt; src_bidx = acnt;
src_cidx = cidx; src_cidx = cidx;
dst_bidx = 0; dst_bidx = 0;
dst_cidx = 0; dst_cidx = 0;
epset->addr = src_addr;
} else if (direction == DMA_DEV_TO_MEM) { } else if (direction == DMA_DEV_TO_MEM) {
src_bidx = 0; src_bidx = 0;
src_cidx = 0; src_cidx = 0;
dst_bidx = acnt; dst_bidx = acnt;
dst_cidx = cidx; dst_cidx = cidx;
epset->addr = dst_addr;
} else if (direction == DMA_MEM_TO_MEM) { } else if (direction == DMA_MEM_TO_MEM) {
src_bidx = acnt; src_bidx = acnt;
src_cidx = cidx; src_cidx = cidx;
...@@ -463,6 +470,7 @@ static struct dma_async_tx_descriptor *edma_prep_slave_sg( ...@@ -463,6 +470,7 @@ static struct dma_async_tx_descriptor *edma_prep_slave_sg(
edesc->pset_nr = sg_len; edesc->pset_nr = sg_len;
edesc->residue = 0; edesc->residue = 0;
edesc->direction = direction;
/* Allocate a PaRAM slot, if needed */ /* Allocate a PaRAM slot, if needed */
nslots = min_t(unsigned, MAX_NR_SG, sg_len); nslots = min_t(unsigned, MAX_NR_SG, sg_len);
...@@ -615,6 +623,7 @@ static struct dma_async_tx_descriptor *edma_prep_dma_cyclic( ...@@ -615,6 +623,7 @@ static struct dma_async_tx_descriptor *edma_prep_dma_cyclic(
edesc->cyclic = 1; edesc->cyclic = 1;
edesc->pset_nr = nslots; edesc->pset_nr = nslots;
edesc->residue = buf_len; edesc->residue = buf_len;
edesc->direction = direction;
dev_dbg(dev, "%s: channel=%d nslots=%d period_len=%zu buf_len=%zu\n", dev_dbg(dev, "%s: channel=%d nslots=%d period_len=%zu buf_len=%zu\n",
__func__, echan->ch_num, nslots, period_len, buf_len); __func__, echan->ch_num, nslots, period_len, buf_len);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment