Skip to content

Commit f1ac572

Browse files
Alexandre BounineRohan Somvanshi
authored andcommitted
dmaengine: add context parameter to prep_slave_sg and prep_dma_cyclic
Add context parameter to device_prep_slave_sg() and device_prep_dma_cyclic() interfaces to allow passing client/target specific information associated with the data transfer. Modify all affected DMA engine drivers. Signed-off-by: Alexandre Bounine <[email protected]> Acked-by: Linus Walleij <[email protected]> Acked-by: Felipe Balbi <[email protected]> Signed-off-by: Vinod Koul <[email protected]> Cherry-picked from mainline 185ecb5 Change-Id: Ief79d20f6e9d367ee2b530d08df72864fb16895a Signed-off-by: Laxman Dewangan <[email protected]> Reviewed-on: http://git-master/r/94464 Reviewed-by: Automatic_Commit_Validation_User
1 parent a9eb124 commit f1ac572

19 files changed

+106
-74
lines changed

drivers/dma/amba-pl08x.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1346,8 +1346,7 @@ static struct dma_async_tx_descriptor *pl08x_prep_dma_memcpy(
13461346

13471347
static struct dma_async_tx_descriptor *pl08x_prep_slave_sg(
13481348
struct dma_chan *chan, struct scatterlist *sgl,
1349-
unsigned int sg_len, enum dma_data_direction direction,
1350-
unsigned long flags)
1349+
unsigned long flags, void *context)
13511350
{
13521351
struct pl08x_dma_chan *plchan = to_pl08x_chan(chan);
13531352
struct pl08x_driver_data *pl08x = plchan->host;

drivers/dma/at_hdmac.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -633,11 +633,12 @@ atc_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dest, dma_addr_t src,
633633
* @sg_len: number of entries in @scatterlist
634634
* @direction: DMA direction
635635
* @flags: tx descriptor status flags
636+
* @context: transaction context (ignored)
636637
*/
637638
static struct dma_async_tx_descriptor *
638639
atc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
639-
unsigned int sg_len, enum dma_data_direction direction,
640-
unsigned long flags)
640+
unsigned int sg_len, enum dma_transfer_direction direction,
641+
unsigned long flags, void *context)
641642
{
642643
struct at_dma_chan *atchan = to_at_dma_chan(chan);
643644
struct at_dma_slave *atslave = chan->private;
@@ -834,10 +835,12 @@ atc_dma_cyclic_fill_desc(struct at_dma_slave *atslave, struct at_desc *desc,
834835
* @buf_len: total number of bytes for the entire buffer
835836
* @period_len: number of bytes for each period
836837
* @direction: transfer direction, to or from device
838+
* @context: transfer context (ignored)
837839
*/
838840
static struct dma_async_tx_descriptor *
839841
atc_prep_dma_cyclic(struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len,
840-
size_t period_len, enum dma_data_direction direction)
842+
size_t period_len, enum dma_transfer_direction direction,
843+
void *context)
841844
{
842845
struct at_dma_chan *atchan = to_at_dma_chan(chan);
843846
struct at_dma_slave *atslave = chan->private;

drivers/dma/coh901318.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,8 +1020,8 @@ coh901318_prep_memcpy(struct dma_chan *chan, dma_addr_t dest, dma_addr_t src,
10201020

10211021
static struct dma_async_tx_descriptor *
10221022
coh901318_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
1023-
unsigned int sg_len, enum dma_data_direction direction,
1024-
unsigned long flags)
1023+
unsigned int sg_len, enum dma_transfer_direction direction,
1024+
unsigned long flags, void *context)
10251025
{
10261026
struct coh901318_chan *cohc = to_coh901318_chan(chan);
10271027
struct coh901318_lli *lli;

drivers/dma/dw_dmac.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -716,8 +716,8 @@ dwc_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dest, dma_addr_t src,
716716

717717
static struct dma_async_tx_descriptor *
718718
dwc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
719-
unsigned int sg_len, enum dma_data_direction direction,
720-
unsigned long flags)
719+
unsigned int sg_len, enum dma_transfer_direction direction,
720+
unsigned long flags, void *context)
721721
{
722722
struct dw_dma_chan *dwc = to_dw_dma_chan(chan);
723723
struct dw_dma_slave *dws = chan->private;

drivers/dma/ep93xx_dma.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -942,13 +942,14 @@ ep93xx_dma_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dest,
942942
* @sg_len: number of entries in @sgl
943943
* @dir: direction of tha DMA transfer
944944
* @flags: flags for the descriptor
945+
* @context: operation context (ignored)
945946
*
946947
* Returns a valid DMA descriptor or %NULL in case of failure.
947948
*/
948949
static struct dma_async_tx_descriptor *
949950
ep93xx_dma_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
950-
unsigned int sg_len, enum dma_data_direction dir,
951-
unsigned long flags)
951+
unsigned int sg_len, enum dma_transfer_direction dir,
952+
unsigned long flags, void *context)
952953
{
953954
struct ep93xx_dma_chan *edmac = to_ep93xx_dma_chan(chan);
954955
struct ep93xx_dma_desc *desc, *first;
@@ -1015,6 +1016,7 @@ ep93xx_dma_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
10151016
* @buf_len: length of the buffer (in bytes)
10161017
* @period_len: lenght of a single period
10171018
* @dir: direction of the operation
1019+
* @context: operation context (ignored)
10181020
*
10191021
* Prepares a descriptor for cyclic DMA operation. This means that once the
10201022
* descriptor is submitted, we will be submitting in a @period_len sized
@@ -1027,7 +1029,7 @@ ep93xx_dma_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
10271029
static struct dma_async_tx_descriptor *
10281030
ep93xx_dma_prep_dma_cyclic(struct dma_chan *chan, dma_addr_t dma_addr,
10291031
size_t buf_len, size_t period_len,
1030-
enum dma_data_direction dir)
1032+
enum dma_transfer_direction dir, void *context)
10311033
{
10321034
struct ep93xx_dma_chan *edmac = to_ep93xx_dma_chan(chan);
10331035
struct ep93xx_dma_desc *desc, *first;

drivers/dma/fsldma.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -759,14 +759,16 @@ static struct dma_async_tx_descriptor *fsl_dma_prep_sg(struct dma_chan *dchan,
759759
* @sg_len: number of entries in @scatterlist
760760
* @direction: DMA direction
761761
* @flags: DMAEngine flags
762+
* @context: transaction context (ignored)
762763
*
763764
* Prepare a set of descriptors for a DMA_SLAVE transaction. Following the
764765
* DMA_SLAVE API, this gets the device-specific information from the
765766
* chan->private variable.
766767
*/
767768
static struct dma_async_tx_descriptor *fsl_dma_prep_slave_sg(
768769
struct dma_chan *dchan, struct scatterlist *sgl, unsigned int sg_len,
769-
enum dma_data_direction direction, unsigned long flags)
770+
enum dma_transfer_direction direction, unsigned long flags,
771+
void *context)
770772
{
771773
/*
772774
* This operation is not supported on the Freescale DMA controller

drivers/dma/imx-dma.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,8 @@ static void imxdma_free_chan_resources(struct dma_chan *chan)
201201

202202
static struct dma_async_tx_descriptor *imxdma_prep_slave_sg(
203203
struct dma_chan *chan, struct scatterlist *sgl,
204-
unsigned int sg_len, enum dma_data_direction direction,
205-
unsigned long flags)
204+
unsigned int sg_len, enum dma_transfer_direction direction,
205+
unsigned long flags, void *context)
206206
{
207207
struct imxdma_channel *imxdmac = to_imxdma_chan(chan);
208208
struct scatterlist *sg;
@@ -248,7 +248,8 @@ static struct dma_async_tx_descriptor *imxdma_prep_slave_sg(
248248

249249
static struct dma_async_tx_descriptor *imxdma_prep_dma_cyclic(
250250
struct dma_chan *chan, dma_addr_t dma_addr, size_t buf_len,
251-
size_t period_len, enum dma_data_direction direction)
251+
size_t period_len, enum dma_transfer_direction direction,
252+
void *context)
252253
{
253254
struct imxdma_channel *imxdmac = to_imxdma_chan(chan);
254255
struct imxdma_engine *imxdma = imxdmac->imxdma;

drivers/dma/imx-sdma.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -886,8 +886,8 @@ static void sdma_free_chan_resources(struct dma_chan *chan)
886886

887887
static struct dma_async_tx_descriptor *sdma_prep_slave_sg(
888888
struct dma_chan *chan, struct scatterlist *sgl,
889-
unsigned int sg_len, enum dma_data_direction direction,
890-
unsigned long flags)
889+
unsigned int sg_len, enum dma_transfer_direction direction,
890+
unsigned long flags, void *context)
891891
{
892892
struct sdma_channel *sdmac = to_sdma_chan(chan);
893893
struct sdma_engine *sdma = sdmac->sdma;
@@ -983,7 +983,8 @@ static struct dma_async_tx_descriptor *sdma_prep_slave_sg(
983983

984984
static struct dma_async_tx_descriptor *sdma_prep_dma_cyclic(
985985
struct dma_chan *chan, dma_addr_t dma_addr, size_t buf_len,
986-
size_t period_len, enum dma_data_direction direction)
986+
size_t period_len, enum dma_transfer_direction direction,
987+
void *context)
987988
{
988989
struct sdma_channel *sdmac = to_sdma_chan(chan);
989990
struct sdma_engine *sdma = sdmac->sdma;
@@ -1094,12 +1095,8 @@ static enum dma_status sdma_tx_status(struct dma_chan *chan,
10941095

10951096
last_used = chan->cookie;
10961097

1097-
<<<<<<< HEAD
1098-
dma_set_tx_state(txstate, sdmac->last_completed, last_used, 0);
1099-
=======
11001098
dma_set_tx_state(txstate, chan->completed_cookie, last_used,
11011099
sdmac->chn_count - sdmac->chn_real_count);
1102-
>>>>>>> 4d4e58d... dmaengine: move last completed cookie into generic dma_chan structure
11031100

11041101
return sdmac->status;
11051102
}

drivers/dma/intel_mid_dma.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -708,13 +708,14 @@ static struct dma_async_tx_descriptor *intel_mid_dma_prep_memcpy(
708708
* @sg_len: length of sg txn
709709
* @direction: DMA transfer dirtn
710710
* @flags: DMA flags
711+
* @context: transfer context (ignored)
711712
*
712713
* Prepares LLI based periphral transfer
713714
*/
714715
static struct dma_async_tx_descriptor *intel_mid_dma_prep_slave_sg(
715716
struct dma_chan *chan, struct scatterlist *sgl,
716-
unsigned int sg_len, enum dma_data_direction direction,
717-
unsigned long flags)
717+
unsigned int sg_len, enum dma_transfer_direction direction,
718+
unsigned long flags, void *context)
718719
{
719720
struct intel_mid_dma_chan *midc = NULL;
720721
struct intel_mid_dma_slave *mids = NULL;
@@ -1093,12 +1094,8 @@ static int mid_setup_dma(struct pci_dev *pdev)
10931094
struct intel_mid_dma_chan *midch = &dma->ch[i];
10941095

10951096
midch->chan.device = &dma->common;
1096-
<<<<<<< HEAD
1097-
midch->chan.cookie = 1;
10981097
midch->chan.chan_id = i;
1099-
=======
11001098
dma_cookie_init(&midch->chan);
1101-
>>>>>>> d3ee98cdc... dmaengine: consolidate initialization of cookies
11021099
midch->ch_id = dma->chan_base + i;
11031100
pr_debug("MDMA:Init CH %d, ID %d\n", i, midch->ch_id);
11041101

drivers/dma/ipu/ipu_idmac.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1356,7 +1356,8 @@ static void ipu_gc_tasklet(unsigned long arg)
13561356
/* Allocate and initialise a transfer descriptor. */
13571357
static struct dma_async_tx_descriptor *idmac_prep_slave_sg(struct dma_chan *chan,
13581358
struct scatterlist *sgl, unsigned int sg_len,
1359-
enum dma_data_direction direction, unsigned long tx_flags)
1359+
enum dma_transfer_direction direction, unsigned long tx_flags,
1360+
void *context)
13601361
{
13611362
struct idmac_channel *ichan = to_idmac_chan(chan);
13621363
struct idmac_tx_desc *desc = NULL;
@@ -1634,15 +1635,7 @@ static int __init ipu_idmac_init(struct ipu *ipu)
16341635
snprintf(ichan->eof_name, sizeof(ichan->eof_name), "IDMAC EOF %d", i);
16351636

16361637
dma_chan->device = &idmac->dma;
1637-
<<<<<<< HEAD
1638-
dma_chan->cookie = 1;
1639-
<<<<<<< HEAD
1640-
dma_chan->completed_cookie = -ENXIO;
1641-
=======
1642-
=======
16431638
dma_cookie_init(dma_chan);
1644-
>>>>>>> d3ee98cdc... dmaengine: consolidate initialization of cookies
1645-
>>>>>>> 1e15982... dmaengine: consolidate initialization of cookies
16461639
dma_chan->chan_id = i;
16471640
list_add_tail(&dma_chan->device_node, &dma->channels);
16481641
}

0 commit comments

Comments
 (0)