[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250823154009.25992-10-jszhang@kernel.org>
Date: Sat, 23 Aug 2025 23:40:04 +0800
From: Jisheng Zhang <jszhang@...nel.org>
To: Vinod Koul <vkoul@...nel.org>,
Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>,
Robin Murphy <robin.murphy@....com>
Cc: dmaengine@...r.kernel.org,
devicetree@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org
Subject: [PATCH 09/14] dmaengine: dma350: Support dma-channel-mask
Not all channels are available to kernel, we need to support
dma-channel-mask.
Signed-off-by: Jisheng Zhang <jszhang@...nel.org>
---
drivers/dma/arm-dma350.c | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/drivers/dma/arm-dma350.c b/drivers/dma/arm-dma350.c
index 6a6d1c2a3ee6..72067518799e 100644
--- a/drivers/dma/arm-dma350.c
+++ b/drivers/dma/arm-dma350.c
@@ -534,7 +534,7 @@ static int d350_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev;
struct d350 *dmac;
void __iomem *base;
- u32 reg;
+ u32 reg, dma_chan_mask;
int ret, nchan, dw, aw, r, p;
bool coherent, memset;
@@ -563,6 +563,15 @@ static int d350_probe(struct platform_device *pdev)
dmac->nchan = nchan;
+ /* Enable all channels by default */
+ dma_chan_mask = nchan - 1;
+
+ ret = of_property_read_u32(dev->of_node, "dma-channel-mask", &dma_chan_mask);
+ if (ret < 0 && (ret != -EINVAL)) {
+ dev_err(&pdev->dev, "dma-channel-mask is not complete.\n");
+ return ret;
+ }
+
reg = readl_relaxed(base + DMAINFO + DMA_BUILDCFG1);
dmac->nreq = FIELD_GET(DMA_CFG_NUM_TRIGGER_IN, reg);
@@ -592,6 +601,11 @@ static int d350_probe(struct platform_device *pdev)
memset = true;
for (int i = 0; i < nchan; i++) {
struct d350_chan *dch = &dmac->channels[i];
+ char ch_irqname[8];
+
+ /* skip for reserved channels */
+ if (!test_bit(i, (unsigned long *)&dma_chan_mask))
+ continue;
dch->coherent = coherent;
dch->base = base + DMACH(i);
@@ -602,7 +616,9 @@ static int d350_probe(struct platform_device *pdev)
dev_warn(dev, "No command link support on channel %d\n", i);
continue;
}
- dch->irq = platform_get_irq(pdev, i);
+
+ snprintf(ch_irqname, sizeof(ch_irqname), "ch%d", i);
+ dch->irq = platform_get_irq_byname(pdev, ch_irqname);
if (dch->irq < 0)
return dch->irq;
--
2.50.0
Powered by blists - more mailing lists