Skip to content

Commit 00ff4d6

Browse files
Ben Collinsvinodkoul
authored andcommitted
fsldma: Set correct dma_mask based on hw capability
The driver currently hardcodes DMA_BIT_MASK to 36-bits, which is only correct on eloplus: elo3 supports 40-bits eloplus supports 36-bits elo supports 32-bits This is based on 0x08 cdar register documention in the respective reference manuals. Set the dma mask accordingly. Feedback from Arnd Bergmann: - Use match data to set address bit mask Signed-off-by: Ben Collins <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Vinod Koul <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Link: https://lore.kernel.org/r/2025050513-complex-crane-2babb6@boujee-and-buff Signed-off-by: Vinod Koul <[email protected]>
1 parent 17502e7 commit 00ff4d6

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

drivers/dma/fsldma.c

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,6 +1226,8 @@ static int fsldma_of_probe(struct platform_device *op)
12261226

12271227
fdev->dev = &op->dev;
12281228
INIT_LIST_HEAD(&fdev->common.channels);
1229+
/* The DMA address bits supported for this device. */
1230+
fdev->addr_bits = (long)device_get_match_data(fdev->dev);
12291231

12301232
/* ioremap the registers for use */
12311233
fdev->regs = of_iomap(op->dev.of_node, 0);
@@ -1254,7 +1256,7 @@ static int fsldma_of_probe(struct platform_device *op)
12541256
fdev->common.directions = BIT(DMA_DEV_TO_MEM) | BIT(DMA_MEM_TO_DEV);
12551257
fdev->common.residue_granularity = DMA_RESIDUE_GRANULARITY_DESCRIPTOR;
12561258

1257-
dma_set_mask(&(op->dev), DMA_BIT_MASK(36));
1259+
dma_set_mask(&(op->dev), DMA_BIT_MASK(fdev->addr_bits));
12581260

12591261
platform_set_drvdata(op, fdev);
12601262

@@ -1387,10 +1389,20 @@ static const struct dev_pm_ops fsldma_pm_ops = {
13871389
};
13881390
#endif
13891391

1392+
/* The .data field is used for dma-bit-mask. */
13901393
static const struct of_device_id fsldma_of_ids[] = {
1391-
{ .compatible = "fsl,elo3-dma", },
1392-
{ .compatible = "fsl,eloplus-dma", },
1393-
{ .compatible = "fsl,elo-dma", },
1394+
{
1395+
.compatible = "fsl,elo3-dma",
1396+
.data = (void *)40,
1397+
},
1398+
{
1399+
.compatible = "fsl,eloplus-dma",
1400+
.data = (void *)36,
1401+
},
1402+
{
1403+
.compatible = "fsl,elo-dma",
1404+
.data = (void *)32,
1405+
},
13941406
{}
13951407
};
13961408
MODULE_DEVICE_TABLE(of, fsldma_of_ids);

drivers/dma/fsldma.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ struct fsldma_device {
124124
struct fsldma_chan *chan[FSL_DMA_MAX_CHANS_PER_DEVICE];
125125
u32 feature; /* The same as DMA channels */
126126
int irq; /* Channel IRQ */
127+
int addr_bits; /* DMA addressing bits supported */
127128
};
128129

129130
/* Define macros for fsldma_chan->feature property */

0 commit comments

Comments
 (0)