diff mbox

[V2,4/6] dma: edma: Store transfer data in edma_desc and edma_pset

Message ID 20140428104643.110402274@linutronix.de (mailing list archive)
State Accepted
Delegated to: Vinod Koul
Headers show

Commit Message

Thomas Gleixner April 28, 2014, 10:49 a.m. UTC
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: Thomas Gleixner <tglx@linutronix.de>
---
 drivers/dma/edma.c |    9 +++++++++
 1 file changed, 9 insertions(+)



--
To unsubscribe from this list: send the line "unsubscribe dmaengine" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

Index: linux-2.6/drivers/dma/edma.c
===================================================================
--- linux-2.6.orig/drivers/dma/edma.c
+++ linux-2.6/drivers/dma/edma.c
@@ -58,12 +58,15 @@ 
 #define EDMA_DESCRIPTORS	16
 
 struct edma_pset {
+	u32				len;
+	dma_addr_t			addr;
 	struct edmacc_param		param;
 };
 
 struct edma_desc {
 	struct virt_dma_desc		vdesc;
 	struct list_head		node;
+	enum dma_transfer_direction	direction;
 	int				cyclic;
 	int				absync;
 	int				pset_nr;
@@ -343,16 +346,20 @@  static int edma_config_pset(struct dma_c
 		cidx = acnt * bcnt;
 	}
 
+	epset->len = dma_length;
+
 	if (direction == DMA_MEM_TO_DEV) {
 		src_bidx = acnt;
 		src_cidx = cidx;
 		dst_bidx = 0;
 		dst_cidx = 0;
+		epset->addr = src_addr;
 	} else if (direction == DMA_DEV_TO_MEM)  {
 		src_bidx = 0;
 		src_cidx = 0;
 		dst_bidx = acnt;
 		dst_cidx = cidx;
+		epset->addr = dst_addr;
 	} else {
 		dev_err(dev, "%s: direction not implemented yet\n", __func__);
 		return -EINVAL;
@@ -425,6 +432,7 @@  static struct dma_async_tx_descriptor *e
 
 	edesc->pset_nr = sg_len;
 	edesc->residue = 0;
+	edesc->direction = direction;
 
 	/* Allocate a PaRAM slot, if needed */
 	nslots = min_t(unsigned, MAX_NR_SG, sg_len);
@@ -538,6 +546,7 @@  static struct dma_async_tx_descriptor *e
 	edesc->cyclic = 1;
 	edesc->pset_nr = nslots;
 	edesc->residue = buf_len;
+	edesc->direction = direction;
 
 	dev_dbg(dev, "%s: nslots=%d\n", __func__, nslots);
 	dev_dbg(dev, "%s: period_len=%d\n", __func__, period_len);