From: Jelly Jia <Jelly.Jia@cixtech.com>
To: vkoul@kernel.org, robh@kernel.org, krzk+dt@kernel.org,
conor+dt@kernel.org, robin.murphy@arm.com, sboyd@kernel.org,
bmasney+clk@redhat.com, jbrunet+clk@baylibre.com
Cc: devicetree@vger.kernel.org, Frank.Li@kernel.org,
cix-kernel-upstream@cixtech.com, dmaengine@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, Jelly.Jia@cixtech.com,
linux-clk@vger.kernel.org, joakim.zhang@cixtech.com
Subject: [PATCH v1 4/5] dmaengine: arm-dma350: Honour dma-channel-mask
Date: Fri, 23 Oct 2026 17:30:44 +0800 [thread overview]
Message-ID: <20261023093045.3248630-5-Jelly.Jia@cixtech.com> (raw)
In-Reply-To: <20261023093045.3248630-1-Jelly.Jia@cixtech.com>
DMA-350 channels may be reserved for firmware or another processor.
Read the optional dma-channel-mask property and register only the channels
whose bits are set. If the property is absent, preserve the existing
behaviour and expose every hardware channel.
Skip masked channels before accessing their channel registers or
initializing their interrupts and virt-dma state. This avoids clearing
or configuring channels reserved for firmware or another processor.
Signed-off-by: Jelly Jia <Jelly.Jia@cixtech.com>
---
drivers/dma/arm-dma350.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/drivers/dma/arm-dma350.c b/drivers/dma/arm-dma350.c
index 9cb5b2f03113..32ec6f061ee9 100644
--- a/drivers/dma/arm-dma350.c
+++ b/drivers/dma/arm-dma350.c
@@ -1205,9 +1205,10 @@ static int d350_probe(struct platform_device *pdev)
struct clk *clk;
struct d350 *dmac;
void __iomem *base;
+ u32 chan_mask = U32_MAX;
u32 reg;
int ret, nchan, dw, aw, r, p;
- bool coherent, memset;
+ bool coherent, has_chan_mask, memset;
clk = devm_clk_get_optional_enabled(dev, NULL);
if (IS_ERR(clk))
@@ -1285,6 +1286,19 @@ static int d350_probe(struct platform_device *pdev)
dmac->dma.device_config = d350_config;
INIT_LIST_HEAD(&dmac->dma.channels);
+ /*
+ * dma-channel-mask is optional. Firmware-reserved channels stay
+ * clear; if the property is absent, Linux may use every channel.
+ */
+ has_chan_mask = device_property_present(dev, "dma-channel-mask");
+ if (has_chan_mask) {
+ ret = device_property_read_u32(dev, "dma-channel-mask",
+ &chan_mask);
+ if (ret)
+ return dev_err_probe(dev, ret,
+ "failed to read dma-channel-mask\n");
+ }
+
reg = readl_relaxed(base + DMANSECCTRL + NSEC_CTRL);
writel_relaxed(reg | INTREN_ANYCHINTR_EN,
base + DMANSECCTRL + NSEC_CTRL);
@@ -1294,6 +1308,10 @@ static int d350_probe(struct platform_device *pdev)
for (int i = 0; i < nchan; i++) {
struct d350_chan *dch = &dmac->channels[i];
+ if (has_chan_mask &&
+ (i >= 32 || !(chan_mask & BIT(i))))
+ continue;
+
dch->base = base + DMACH(i);
writel_relaxed(CH_CMD_CLEAR, dch->base + CH_CMD);
--
2.54.0
next prev parent reply other threads:[~2026-10-23 9:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-23 9:30 [PATCH v1 0/5] soc: cix: Add the Sky1 AUDSS DMA-350 interrupt path Jelly Jia
2026-10-23 9:30 ` [PATCH v1 1/5] dt-bindings: soc: cix: Describe the Sky1 AUDSS DMA IRQ controller Jelly Jia
2026-10-23 9:30 ` [PATCH v1 2/5] clk: cix: Handle Sky1 AUDSS DMA interrupt gates as an irqchip Jelly Jia
2026-10-23 9:30 ` [PATCH v1 3/5] dt-bindings: dma: arm,dma-350: Document dma-channel-mask Jelly Jia
2026-10-23 9:30 ` Jelly Jia [this message]
2026-10-23 9:30 ` [PATCH v1 5/5] arm64: dts: cix: Add the Sky1 AUDSS DMA-350 integration Jelly Jia
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261023093045.3248630-5-Jelly.Jia@cixtech.com \
--to=jelly.jia@cixtech.com \
--cc=Frank.Li@kernel.org \
--cc=bmasney+clk@redhat.com \
--cc=cix-kernel-upstream@cixtech.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dmaengine@vger.kernel.org \
--cc=jbrunet+clk@baylibre.com \
--cc=joakim.zhang@cixtech.com \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robh@kernel.org \
--cc=robin.murphy@arm.com \
--cc=sboyd@kernel.org \
--cc=vkoul@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®