Skip to content

Commit 465e7b5

Browse files
1991Joyzouopsiff
authored andcommitted
dmaengine: fsl-edma: fix channel parameter config for fixed channel requests
[ Upstream commit 2e7b5cf72e51c9cf9c8b75190189c757df31ddd9 ] Configure only the requested channel when a fixed channel is specified to avoid modifying other channels unintentionally. Fix parameter configuration when a fixed DMA channel is requested on i.MX9 AON domain and i.MX8QM/QXP/DXL platforms. When a client requests a fixed channel (e.g., channel 6), the driver traverses channels 0-5 and may unintentionally modify their configuration if they are unused. This leads to issues such as setting the `is_multi_fifo` flag unexpectedly, causing memcpy tests to fail when using the dmatest tool. Only affect edma memcpy test when the channel is fixed. Fixes: 72f5801 ("dmaengine: fsl-edma: integrate v3 support") Signed-off-by: Joy Zou <joy.zou@nxp.com> Cc: stable@vger.kernel.org Reviewed-by: Frank Li <Frank.Li@nxp.com> Link: https://patch.msgid.link/20250917-b4-edma-chanconf-v1-1-886486e02e91@nxp.com Signed-off-by: Vinod Koul <vkoul@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cherry picked from commit e2316c5d759d3beaef3e7fb2eb7fc22da5dd3f9f) Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
1 parent 095dc01 commit 465e7b5

1 file changed

Lines changed: 11 additions & 15 deletions

File tree

drivers/dma/fsl-edma-main.c

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -152,28 +152,24 @@ static struct dma_chan *fsl_edma3_xlate(struct of_phandle_args *dma_spec,
152152
fsl_chan = to_fsl_edma_chan(chan);
153153
i = fsl_chan - fsl_edma->chans;
154154

155-
fsl_chan->priority = dma_spec->args[1];
156-
fsl_chan->is_rxchan = dma_spec->args[2] & FSL_EDMA_RX;
157-
fsl_chan->is_remote = dma_spec->args[2] & FSL_EDMA_REMOTE;
158-
fsl_chan->is_multi_fifo = dma_spec->args[2] & FSL_EDMA_MULTI_FIFO;
155+
if (!b_chmux && i != dma_spec->args[0])
156+
continue;
159157

160158
if ((dma_spec->args[2] & FSL_EDMA_EVEN_CH) && (i & 0x1))
161159
continue;
162160

163161
if ((dma_spec->args[2] & FSL_EDMA_ODD_CH) && !(i & 0x1))
164162
continue;
165163

166-
if (!b_chmux && i == dma_spec->args[0]) {
167-
chan = dma_get_slave_channel(chan);
168-
chan->device->privatecnt++;
169-
return chan;
170-
} else if (b_chmux && !fsl_chan->srcid) {
171-
/* if controller support channel mux, choose a free channel */
172-
chan = dma_get_slave_channel(chan);
173-
chan->device->privatecnt++;
174-
fsl_chan->srcid = dma_spec->args[0];
175-
return chan;
176-
}
164+
fsl_chan->srcid = dma_spec->args[0];
165+
fsl_chan->priority = dma_spec->args[1];
166+
fsl_chan->is_rxchan = dma_spec->args[2] & FSL_EDMA_RX;
167+
fsl_chan->is_remote = dma_spec->args[2] & FSL_EDMA_REMOTE;
168+
fsl_chan->is_multi_fifo = dma_spec->args[2] & FSL_EDMA_MULTI_FIFO;
169+
170+
chan = dma_get_slave_channel(chan);
171+
chan->device->privatecnt++;
172+
return chan;
177173
}
178174
return NULL;
179175
}

0 commit comments

Comments
 (0)