Skip to content

Commit 9e006b2

Browse files
nxpfranklivinodkoul
authored andcommitted
dmaengine: fsl-edma: transition from bool fields to bitmask flags in drvdata
Replace individual bool fields with bitmask flags within drvdata. This will facilitate future extensions, making it easier to add more flags to accommodate new versions of the edma IP. Signed-off-by: Frank Li <Frank.Li@nxp.com> Reviewed-by: Peng Fan <peng.fan@nxp.com> Link: https://lore.kernel.org/r/20230821161617.2142561-4-Frank.Li@nxp.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
1 parent 66aac8e commit 9e006b2

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

drivers/dma/fsl-edma-common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ void fsl_edma_chan_mux(struct fsl_edma_chan *fsl_chan,
114114
chans_per_mux = fsl_chan->edma->n_chans / dmamux_nr;
115115
ch_off = fsl_chan->vchan.chan.chan_id % chans_per_mux;
116116

117-
if (fsl_chan->edma->drvdata->mux_swap)
117+
if (fsl_chan->edma->drvdata->flags & FSL_EDMA_DRV_MUX_SWAP)
118118
ch_off += endian_diff[ch_off % 4];
119119

120120
muxaddr = fsl_chan->edma->muxbase[ch / chans_per_mux];

drivers/dma/fsl-edma-common.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,12 @@ enum edma_version {
144144
v3, /* 32ch, i.mx7ulp */
145145
};
146146

147+
#define FSL_EDMA_DRV_HAS_DMACLK BIT(0)
148+
#define FSL_EDMA_DRV_MUX_SWAP BIT(1)
147149
struct fsl_edma_drvdata {
148150
enum edma_version version;
149151
u32 dmamuxs;
150-
bool has_dmaclk;
151-
bool mux_swap;
152+
u32 flags;
152153
int (*setup_irq)(struct platform_device *pdev,
153154
struct fsl_edma_engine *fsl_edma);
154155
};

drivers/dma/fsl-edma-main.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,14 +244,14 @@ static struct fsl_edma_drvdata vf610_data = {
244244
static struct fsl_edma_drvdata ls1028a_data = {
245245
.version = v1,
246246
.dmamuxs = DMAMUX_NR,
247-
.mux_swap = true,
247+
.flags = FSL_EDMA_DRV_MUX_SWAP,
248248
.setup_irq = fsl_edma_irq_init,
249249
};
250250

251251
static struct fsl_edma_drvdata imx7ulp_data = {
252252
.version = v3,
253253
.dmamuxs = 1,
254-
.has_dmaclk = true,
254+
.flags = FSL_EDMA_DRV_HAS_DMACLK,
255255
.setup_irq = fsl_edma2_irq_init,
256256
};
257257

@@ -303,7 +303,7 @@ static int fsl_edma_probe(struct platform_device *pdev)
303303
fsl_edma_setup_regs(fsl_edma);
304304
regs = &fsl_edma->regs;
305305

306-
if (drvdata->has_dmaclk) {
306+
if (drvdata->flags & FSL_EDMA_DRV_HAS_DMACLK) {
307307
fsl_edma->dmaclk = devm_clk_get(&pdev->dev, "dma");
308308
if (IS_ERR(fsl_edma->dmaclk)) {
309309
dev_err(&pdev->dev, "Missing DMA block clock.\n");

0 commit comments

Comments
 (0)