Skip to content

Commit a79f949

Browse files
nxpfranklivinodkoul
authored andcommitted
dmaengine: fsl-edma: correct max_segment_size setting
Correcting the previous setting of 0x3fff to the actual value of 0x7fff. Introduced new macro 'EDMA_TCD_ITER_MASK' for improved code clarity and utilization of FIELD_GET to obtain the accurate maximum value. Cc: stable@vger.kernel.org Fixes: e067485 ("dmaengine: fsl-edma: support edma memcpy") Signed-off-by: Frank Li <Frank.Li@nxp.com> Link: https://lore.kernel.org/r/20240207194733.2112870-1-Frank.Li@nxp.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
1 parent ecec7c9 commit a79f949

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

drivers/dma/fsl-edma-common.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@
3030
#define EDMA_TCD_ATTR_SSIZE(x) (((x) & GENMASK(2, 0)) << 8)
3131
#define EDMA_TCD_ATTR_SMOD(x) (((x) & GENMASK(4, 0)) << 11)
3232

33-
#define EDMA_TCD_CITER_CITER(x) ((x) & GENMASK(14, 0))
34-
#define EDMA_TCD_BITER_BITER(x) ((x) & GENMASK(14, 0))
33+
#define EDMA_TCD_ITER_MASK GENMASK(14, 0)
34+
#define EDMA_TCD_CITER_CITER(x) ((x) & EDMA_TCD_ITER_MASK)
35+
#define EDMA_TCD_BITER_BITER(x) ((x) & EDMA_TCD_ITER_MASK)
3536

3637
#define EDMA_TCD_CSR_START BIT(0)
3738
#define EDMA_TCD_CSR_INT_MAJOR BIT(1)

drivers/dma/fsl-edma-main.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
*/
1111

1212
#include <dt-bindings/dma/fsl-edma.h>
13+
#include <linux/bitfield.h>
1314
#include <linux/module.h>
1415
#include <linux/interrupt.h>
1516
#include <linux/clk.h>
@@ -582,7 +583,8 @@ static int fsl_edma_probe(struct platform_device *pdev)
582583
DMAENGINE_ALIGN_32_BYTES;
583584

584585
/* Per worst case 'nbytes = 1' take CITER as the max_seg_size */
585-
dma_set_max_seg_size(fsl_edma->dma_dev.dev, 0x3fff);
586+
dma_set_max_seg_size(fsl_edma->dma_dev.dev,
587+
FIELD_GET(EDMA_TCD_ITER_MASK, EDMA_TCD_ITER_MASK));
586588

587589
fsl_edma->dma_dev.residue_granularity = DMA_RESIDUE_GRANULARITY_SEGMENT;
588590

0 commit comments

Comments
 (0)