dmaengine: sprd: Fix the right place to configure 2-stage transfer [Linux 5.2]

dmaengine: sprd: Fix the right place to configure 2-stage transfer [Linux 5.2]

This Linux kernel change "dmaengine: sprd: Fix the right place to configure 2-stage transfer" is included in the Linux 5.2 release. This change is authored by Eric Long <eric.long [at] unisoc.com> on Mon May 6 15:28:32 2019 +0800. The commit for this change in Linux stable tree is c434e37 (patch).

dmaengine: sprd: Fix the right place to configure 2-stage transfer

Move the 2-stage configuration before configuring the link-list mode,
since we will use some 2-stage configuration to fill the link-list
configuration.

Signed-off-by: Eric Long <[email protected]>
Signed-off-by: Baolin Wang <[email protected]>
Signed-off-by: Vinod Koul <[email protected]>

There are 12 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 drivers/dma/sprd-dma.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/dma/sprd-dma.c b/drivers/dma/sprd-dma.c
index a01c232..01abed5 100644
--- a/drivers/dma/sprd-dma.c
+++ b/drivers/dma/sprd-dma.c
@@ -911,6 +911,12 @@ static int sprd_dma_fill_linklist_desc(struct dma_chan *chan,
        schan->linklist.virt_addr = 0;
    }

+   /* Set channel mode and trigger mode for 2-stage transfer */
+   schan->chn_mode =
+       (flags >> SPRD_DMA_CHN_MODE_SHIFT) & SPRD_DMA_CHN_MODE_MASK;
+   schan->trg_mode =
+       (flags >> SPRD_DMA_TRG_MODE_SHIFT) & SPRD_DMA_TRG_MODE_MASK;
+
    sdesc = kzalloc(sizeof(*sdesc), GFP_NOWAIT);
    if (!sdesc)
        return NULL;
@@ -944,12 +950,6 @@ static int sprd_dma_fill_linklist_desc(struct dma_chan *chan,
        }
    }

-   /* Set channel mode and trigger mode for 2-stage transfer */
-   schan->chn_mode =
-       (flags >> SPRD_DMA_CHN_MODE_SHIFT) & SPRD_DMA_CHN_MODE_MASK;
-   schan->trg_mode =
-       (flags >> SPRD_DMA_TRG_MODE_SHIFT) & SPRD_DMA_TRG_MODE_MASK;
-
    ret = sprd_dma_fill_desc(chan, &sdesc->chn_hw, 0, 0, src, dst, len,
                 dir, flags, slave_cfg);
    if (ret) {

Leave a Reply

Your email address will not be published. Required fields are marked *