Commit 185ecb5f4fd43911c35956d4cc7d94a1da30417f

Authored by Alexandre Bounine
Committed by Vinod Koul
1 parent 16052827d9

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 <alexandre.bounine@idt.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>

Showing 19 changed files with 49 additions and 30 deletions Side-by-side Diff

drivers/dma/amba-pl08x.c
... ... @@ -1313,7 +1313,7 @@
1313 1313 static struct dma_async_tx_descriptor *pl08x_prep_slave_sg(
1314 1314 struct dma_chan *chan, struct scatterlist *sgl,
1315 1315 unsigned int sg_len, enum dma_transfer_direction direction,
1316   - unsigned long flags)
  1316 + unsigned long flags, void *context)
1317 1317 {
1318 1318 struct pl08x_dma_chan *plchan = to_pl08x_chan(chan);
1319 1319 struct pl08x_driver_data *pl08x = plchan->host;
drivers/dma/at_hdmac.c
... ... @@ -639,11 +639,12 @@
639 639 * @sg_len: number of entries in @scatterlist
640 640 * @direction: DMA direction
641 641 * @flags: tx descriptor status flags
  642 + * @context: transaction context (ignored)
642 643 */
643 644 static struct dma_async_tx_descriptor *
644 645 atc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
645 646 unsigned int sg_len, enum dma_transfer_direction direction,
646   - unsigned long flags)
  647 + unsigned long flags, void *context)
647 648 {
648 649 struct at_dma_chan *atchan = to_at_dma_chan(chan);
649 650 struct at_dma_slave *atslave = chan->private;
650 651  
... ... @@ -840,10 +841,12 @@
840 841 * @buf_len: total number of bytes for the entire buffer
841 842 * @period_len: number of bytes for each period
842 843 * @direction: transfer direction, to or from device
  844 + * @context: transfer context (ignored)
843 845 */
844 846 static struct dma_async_tx_descriptor *
845 847 atc_prep_dma_cyclic(struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len,
846   - size_t period_len, enum dma_transfer_direction direction)
  848 + size_t period_len, enum dma_transfer_direction direction,
  849 + void *context)
847 850 {
848 851 struct at_dma_chan *atchan = to_at_dma_chan(chan);
849 852 struct at_dma_slave *atslave = chan->private;
drivers/dma/coh901318.c
... ... @@ -1021,7 +1021,7 @@
1021 1021 static struct dma_async_tx_descriptor *
1022 1022 coh901318_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
1023 1023 unsigned int sg_len, enum dma_transfer_direction direction,
1024   - unsigned long flags)
  1024 + unsigned long flags, void *context)
1025 1025 {
1026 1026 struct coh901318_chan *cohc = to_coh901318_chan(chan);
1027 1027 struct coh901318_lli *lli;
drivers/dma/dw_dmac.c
... ... @@ -704,7 +704,7 @@
704 704 static struct dma_async_tx_descriptor *
705 705 dwc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
706 706 unsigned int sg_len, enum dma_transfer_direction direction,
707   - unsigned long flags)
  707 + unsigned long flags, void *context)
708 708 {
709 709 struct dw_dma_chan *dwc = to_dw_dma_chan(chan);
710 710 struct dw_dma_slave *dws = chan->private;
drivers/dma/ep93xx_dma.c
... ... @@ -975,13 +975,14 @@
975 975 * @sg_len: number of entries in @sgl
976 976 * @dir: direction of tha DMA transfer
977 977 * @flags: flags for the descriptor
  978 + * @context: operation context (ignored)
978 979 *
979 980 * Returns a valid DMA descriptor or %NULL in case of failure.
980 981 */
981 982 static struct dma_async_tx_descriptor *
982 983 ep93xx_dma_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
983 984 unsigned int sg_len, enum dma_transfer_direction dir,
984   - unsigned long flags)
  985 + unsigned long flags, void *context)
985 986 {
986 987 struct ep93xx_dma_chan *edmac = to_ep93xx_dma_chan(chan);
987 988 struct ep93xx_dma_desc *desc, *first;
... ... @@ -1048,6 +1049,7 @@
1048 1049 * @buf_len: length of the buffer (in bytes)
1049 1050 * @period_len: lenght of a single period
1050 1051 * @dir: direction of the operation
  1052 + * @context: operation context (ignored)
1051 1053 *
1052 1054 * Prepares a descriptor for cyclic DMA operation. This means that once the
1053 1055 * descriptor is submitted, we will be submitting in a @period_len sized
... ... @@ -1060,7 +1062,7 @@
1060 1062 static struct dma_async_tx_descriptor *
1061 1063 ep93xx_dma_prep_dma_cyclic(struct dma_chan *chan, dma_addr_t dma_addr,
1062 1064 size_t buf_len, size_t period_len,
1063   - enum dma_transfer_direction dir)
  1065 + enum dma_transfer_direction dir, void *context)
1064 1066 {
1065 1067 struct ep93xx_dma_chan *edmac = to_ep93xx_dma_chan(chan);
1066 1068 struct ep93xx_dma_desc *desc, *first;
drivers/dma/fsldma.c
... ... @@ -759,6 +759,7 @@
759 759 * @sg_len: number of entries in @scatterlist
760 760 * @direction: DMA direction
761 761 * @flags: DMAEngine flags
  762 + * @context: transaction context (ignored)
762 763 *
763 764 * Prepare a set of descriptors for a DMA_SLAVE transaction. Following the
764 765 * DMA_SLAVE API, this gets the device-specific information from the
... ... @@ -766,7 +767,8 @@
766 767 */
767 768 static struct dma_async_tx_descriptor *fsl_dma_prep_slave_sg(
768 769 struct dma_chan *dchan, struct scatterlist *sgl, unsigned int sg_len,
769   - enum dma_transfer_direction direction, unsigned long flags)
  770 + enum dma_transfer_direction direction, unsigned long flags,
  771 + void *context)
770 772 {
771 773 /*
772 774 * This operation is not supported on the Freescale DMA controller
drivers/dma/imx-dma.c
... ... @@ -354,7 +354,7 @@
354 354 static struct dma_async_tx_descriptor *imxdma_prep_slave_sg(
355 355 struct dma_chan *chan, struct scatterlist *sgl,
356 356 unsigned int sg_len, enum dma_transfer_direction direction,
357   - unsigned long flags)
  357 + unsigned long flags, void *context)
358 358 {
359 359 struct imxdma_channel *imxdmac = to_imxdma_chan(chan);
360 360 struct scatterlist *sg;
... ... @@ -405,7 +405,8 @@
405 405  
406 406 static struct dma_async_tx_descriptor *imxdma_prep_dma_cyclic(
407 407 struct dma_chan *chan, dma_addr_t dma_addr, size_t buf_len,
408   - size_t period_len, enum dma_transfer_direction direction)
  408 + size_t period_len, enum dma_transfer_direction direction,
  409 + void *context)
409 410 {
410 411 struct imxdma_channel *imxdmac = to_imxdma_chan(chan);
411 412 struct imxdma_engine *imxdma = imxdmac->imxdma;
drivers/dma/imx-sdma.c
... ... @@ -903,7 +903,7 @@
903 903 static struct dma_async_tx_descriptor *sdma_prep_slave_sg(
904 904 struct dma_chan *chan, struct scatterlist *sgl,
905 905 unsigned int sg_len, enum dma_transfer_direction direction,
906   - unsigned long flags)
  906 + unsigned long flags, void *context)
907 907 {
908 908 struct sdma_channel *sdmac = to_sdma_chan(chan);
909 909 struct sdma_engine *sdma = sdmac->sdma;
... ... @@ -1001,7 +1001,8 @@
1001 1001  
1002 1002 static struct dma_async_tx_descriptor *sdma_prep_dma_cyclic(
1003 1003 struct dma_chan *chan, dma_addr_t dma_addr, size_t buf_len,
1004   - size_t period_len, enum dma_transfer_direction direction)
  1004 + size_t period_len, enum dma_transfer_direction direction,
  1005 + void *context)
1005 1006 {
1006 1007 struct sdma_channel *sdmac = to_sdma_chan(chan);
1007 1008 struct sdma_engine *sdma = sdmac->sdma;
drivers/dma/intel_mid_dma.c
... ... @@ -714,13 +714,14 @@
714 714 * @sg_len: length of sg txn
715 715 * @direction: DMA transfer dirtn
716 716 * @flags: DMA flags
  717 + * @context: transfer context (ignored)
717 718 *
718 719 * Prepares LLI based periphral transfer
719 720 */
720 721 static struct dma_async_tx_descriptor *intel_mid_dma_prep_slave_sg(
721 722 struct dma_chan *chan, struct scatterlist *sgl,
722 723 unsigned int sg_len, enum dma_transfer_direction direction,
723   - unsigned long flags)
  724 + unsigned long flags, void *context)
724 725 {
725 726 struct intel_mid_dma_chan *midc = NULL;
726 727 struct intel_mid_dma_slave *mids = NULL;
drivers/dma/ipu/ipu_idmac.c
... ... @@ -1335,7 +1335,8 @@
1335 1335 /* Allocate and initialise a transfer descriptor. */
1336 1336 static struct dma_async_tx_descriptor *idmac_prep_slave_sg(struct dma_chan *chan,
1337 1337 struct scatterlist *sgl, unsigned int sg_len,
1338   - enum dma_transfer_direction direction, unsigned long tx_flags)
  1338 + enum dma_transfer_direction direction, unsigned long tx_flags,
  1339 + void *context)
1339 1340 {
1340 1341 struct idmac_channel *ichan = to_idmac_chan(chan);
1341 1342 struct idmac_tx_desc *desc = NULL;
drivers/dma/mxs-dma.c
... ... @@ -340,7 +340,7 @@
340 340 static struct dma_async_tx_descriptor *mxs_dma_prep_slave_sg(
341 341 struct dma_chan *chan, struct scatterlist *sgl,
342 342 unsigned int sg_len, enum dma_transfer_direction direction,
343   - unsigned long append)
  343 + unsigned long append, void *context)
344 344 {
345 345 struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(chan);
346 346 struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma;
... ... @@ -435,7 +435,8 @@
435 435  
436 436 static struct dma_async_tx_descriptor *mxs_dma_prep_dma_cyclic(
437 437 struct dma_chan *chan, dma_addr_t dma_addr, size_t buf_len,
438   - size_t period_len, enum dma_transfer_direction direction)
  438 + size_t period_len, enum dma_transfer_direction direction,
  439 + void *context)
439 440 {
440 441 struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(chan);
441 442 struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma;
drivers/dma/pch_dma.c
... ... @@ -587,7 +587,8 @@
587 587  
588 588 static struct dma_async_tx_descriptor *pd_prep_slave_sg(struct dma_chan *chan,
589 589 struct scatterlist *sgl, unsigned int sg_len,
590   - enum dma_transfer_direction direction, unsigned long flags)
  590 + enum dma_transfer_direction direction, unsigned long flags,
  591 + void *context)
591 592 {
592 593 struct pch_dma_chan *pd_chan = to_pd_chan(chan);
593 594 struct pch_dma_slave *pd_slave = chan->private;
... ... @@ -2685,7 +2685,8 @@
2685 2685  
2686 2686 static struct dma_async_tx_descriptor *pl330_prep_dma_cyclic(
2687 2687 struct dma_chan *chan, dma_addr_t dma_addr, size_t len,
2688   - size_t period_len, enum dma_transfer_direction direction)
  2688 + size_t period_len, enum dma_transfer_direction direction,
  2689 + void *context)
2689 2690 {
2690 2691 struct dma_pl330_desc *desc;
2691 2692 struct dma_pl330_chan *pch = to_pchan(chan);
... ... @@ -2775,7 +2776,7 @@
2775 2776 static struct dma_async_tx_descriptor *
2776 2777 pl330_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
2777 2778 unsigned int sg_len, enum dma_transfer_direction direction,
2778   - unsigned long flg)
  2779 + unsigned long flg, void *context)
2779 2780 {
2780 2781 struct dma_pl330_desc *first, *desc = NULL;
2781 2782 struct dma_pl330_chan *pch = to_pchan(chan);
... ... @@ -669,7 +669,8 @@
669 669  
670 670 static struct dma_async_tx_descriptor *sh_dmae_prep_slave_sg(
671 671 struct dma_chan *chan, struct scatterlist *sgl, unsigned int sg_len,
672   - enum dma_transfer_direction direction, unsigned long flags)
  672 + enum dma_transfer_direction direction, unsigned long flags,
  673 + void *context)
673 674 {
674 675 struct sh_dmae_slave *param;
675 676 struct sh_dmae_chan *sh_chan;
drivers/dma/sirf-dma.c
... ... @@ -489,7 +489,7 @@
489 489 static struct dma_async_tx_descriptor *
490 490 sirfsoc_dma_prep_cyclic(struct dma_chan *chan, dma_addr_t addr,
491 491 size_t buf_len, size_t period_len,
492   - enum dma_transfer_direction direction)
  492 + enum dma_transfer_direction direction, void *context)
493 493 {
494 494 struct sirfsoc_dma_chan *schan = dma_chan_to_sirfsoc_dma_chan(chan);
495 495 struct sirfsoc_dma_desc *sdesc = NULL;
drivers/dma/ste_dma40.c
... ... @@ -2289,7 +2289,8 @@
2289 2289 struct scatterlist *sgl,
2290 2290 unsigned int sg_len,
2291 2291 enum dma_transfer_direction direction,
2292   - unsigned long dma_flags)
  2292 + unsigned long dma_flags,
  2293 + void *context)
2293 2294 {
2294 2295 if (direction != DMA_DEV_TO_MEM && direction != DMA_MEM_TO_DEV)
2295 2296 return NULL;
... ... @@ -2300,7 +2301,7 @@
2300 2301 static struct dma_async_tx_descriptor *
2301 2302 dma40_prep_dma_cyclic(struct dma_chan *chan, dma_addr_t dma_addr,
2302 2303 size_t buf_len, size_t period_len,
2303   - enum dma_transfer_direction direction)
  2304 + enum dma_transfer_direction direction, void *context)
2304 2305 {
2305 2306 unsigned int periods = buf_len / period_len;
2306 2307 struct dma_async_tx_descriptor *txd;
drivers/dma/timb_dma.c
... ... @@ -542,7 +542,8 @@
542 542  
543 543 static struct dma_async_tx_descriptor *td_prep_slave_sg(struct dma_chan *chan,
544 544 struct scatterlist *sgl, unsigned int sg_len,
545   - enum dma_transfer_direction direction, unsigned long flags)
  545 + enum dma_transfer_direction direction, unsigned long flags,
  546 + void *context)
546 547 {
547 548 struct timb_dma_chan *td_chan =
548 549 container_of(chan, struct timb_dma_chan, chan);
drivers/dma/txx9dmac.c
... ... @@ -833,7 +833,7 @@
833 833 static struct dma_async_tx_descriptor *
834 834 txx9dmac_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
835 835 unsigned int sg_len, enum dma_transfer_direction direction,
836   - unsigned long flags)
  836 + unsigned long flags, void *context)
837 837 {
838 838 struct txx9dmac_chan *dc = to_txx9dmac_chan(chan);
839 839 struct txx9dmac_dev *ddev = dc->ddev;
include/linux/dmaengine.h
... ... @@ -582,10 +582,11 @@
582 582 struct dma_async_tx_descriptor *(*device_prep_slave_sg)(
583 583 struct dma_chan *chan, struct scatterlist *sgl,
584 584 unsigned int sg_len, enum dma_transfer_direction direction,
585   - unsigned long flags);
  585 + unsigned long flags, void *context);
586 586 struct dma_async_tx_descriptor *(*device_prep_dma_cyclic)(
587 587 struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len,
588   - size_t period_len, enum dma_transfer_direction direction);
  588 + size_t period_len, enum dma_transfer_direction direction,
  589 + void *context);
589 590 struct dma_async_tx_descriptor *(*device_prep_interleaved_dma)(
590 591 struct dma_chan *chan, struct dma_interleaved_template *xt,
591 592 unsigned long flags);
... ... @@ -619,7 +620,8 @@
619 620 struct scatterlist sg;
620 621 sg_init_one(&sg, buf, len);
621 622  
622   - return chan->device->device_prep_slave_sg(chan, &sg, 1, dir, flags);
  623 + return chan->device->device_prep_slave_sg(chan, &sg, 1,
  624 + dir, flags, NULL);
623 625 }
624 626  
625 627 static inline struct dma_async_tx_descriptor *dmaengine_prep_slave_sg(
... ... @@ -627,7 +629,7 @@
627 629 enum dma_transfer_direction dir, unsigned long flags)
628 630 {
629 631 return chan->device->device_prep_slave_sg(chan, sgl, sg_len,
630   - dir, flags);
  632 + dir, flags, NULL);
631 633 }
632 634  
633 635 static inline struct dma_async_tx_descriptor *dmaengine_prep_dma_cyclic(
... ... @@ -635,7 +637,7 @@
635 637 size_t period_len, enum dma_transfer_direction dir)
636 638 {
637 639 return chan->device->device_prep_dma_cyclic(chan, buf_addr, buf_len,
638   - period_len, dir);
  640 + period_len, dir, NULL);
639 641 }
640 642  
641 643 static inline int dmaengine_terminate_all(struct dma_chan *chan)