From: Koichiro Den <den@valinux.co.jp>
To: Vinod Koul <vkoul@kernel.org>, Frank Li <Frank.Li@kernel.org>,
Manivannan Sadhasivam <mani@kernel.org>
Cc: Marek Vasut <marek.vasut+renesas@mailbox.org>,
Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>,
dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 02/12] dmaengine: dw-edma: Add channel lookup helper
Date: Thu, 21 May 2026 15:31:05 +0900 [thread overview]
Message-ID: <20260521063115.2842238-3-den@valinux.co.jp> (raw)
In-Reply-To: <20260521063115.2842238-1-den@valinux.co.jp>
Add a helper that maps a DesignWare eDMA write/read hardware channel
number to its DMAengine channel.
PCI endpoint resource enumeration uses the pointer only for later
ownership reservation.
Signed-off-by: Koichiro Den <den@valinux.co.jp>
---
drivers/dma/dw-edma/dw-edma-core.c | 32 ++++++++++++++++++++++++++++++
include/linux/dma/edma.h | 8 ++++++++
2 files changed, 40 insertions(+)
diff --git a/drivers/dma/dw-edma/dw-edma-core.c b/drivers/dma/dw-edma/dw-edma-core.c
index c2feb3adc79f..6660380a1bbc 100644
--- a/drivers/dma/dw-edma/dw-edma-core.c
+++ b/drivers/dma/dw-edma/dw-edma-core.c
@@ -1189,6 +1189,38 @@ int dw_edma_remove(struct dw_edma_chip *chip)
}
EXPORT_SYMBOL_GPL(dw_edma_remove);
+struct dma_chan *dw_edma_find_channel(struct dw_edma_chip *chip, bool write,
+ u16 id)
+{
+ struct dw_edma_chan *chan;
+ struct dw_edma *dw;
+
+ if (!chip)
+ return NULL;
+
+ dw = chip->dw;
+
+ if (!dw)
+ return NULL;
+
+ if (write) {
+ if (id >= dw->wr_ch_cnt)
+ return NULL;
+ chan = &dw->chan[id];
+ if (chan->dir != EDMA_DIR_WRITE)
+ return NULL;
+ } else {
+ if (id >= dw->rd_ch_cnt)
+ return NULL;
+ chan = &dw->chan[dw->wr_ch_cnt + id];
+ if (chan->dir != EDMA_DIR_READ)
+ return NULL;
+ }
+
+ return &chan->vc.chan;
+}
+EXPORT_SYMBOL_GPL(dw_edma_find_channel);
+
MODULE_LICENSE("GPL v2");
MODULE_DESCRIPTION("Synopsys DesignWare eDMA controller core driver");
MODULE_AUTHOR("Gustavo Pimentel <gustavo.pimentel@synopsys.com>");
diff --git a/include/linux/dma/edma.h b/include/linux/dma/edma.h
index 1fafd5b0e315..b4b42b2278f3 100644
--- a/include/linux/dma/edma.h
+++ b/include/linux/dma/edma.h
@@ -110,6 +110,8 @@ struct dw_edma_chip {
#if IS_REACHABLE(CONFIG_DW_EDMA)
int dw_edma_probe(struct dw_edma_chip *chip);
int dw_edma_remove(struct dw_edma_chip *chip);
+struct dma_chan *dw_edma_find_channel(struct dw_edma_chip *chip, bool write,
+ u16 id);
#else
static inline int dw_edma_probe(struct dw_edma_chip *chip)
{
@@ -120,6 +122,12 @@ static inline int dw_edma_remove(struct dw_edma_chip *chip)
{
return 0;
}
+
+static inline struct dma_chan *dw_edma_find_channel(struct dw_edma_chip *chip,
+ bool write, u16 id)
+{
+ return NULL;
+}
#endif /* CONFIG_DW_EDMA */
#endif /* _DW_EDMA_H */
--
2.51.0
next prev parent reply other threads:[~2026-05-21 6:31 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-21 6:31 [PATCH 00/12] dmaengine: dw-edma: Prepare for PCI EP DMA (part 1/3) Koichiro Den
2026-05-21 6:31 ` [PATCH 01/12] dmaengine: Make dma_get_slave_channel() public Koichiro Den
2026-05-21 6:31 ` Koichiro Den [this message]
2026-05-21 15:50 ` [PATCH 02/12] dmaengine: dw-edma: Add channel lookup helper Frank Li
2026-05-21 6:31 ` [PATCH 03/12] dmaengine: dw-edma: Add per-channel interrupt routing control Koichiro Den
2026-05-21 6:31 ` [PATCH 04/12] dmaengine: dw-edma: Add partial channel ownership mode Koichiro Den
2026-05-21 6:31 ` [PATCH 05/12] dmaengine: dw-edma-pcie: Add capability match data Koichiro Den
2026-05-21 16:06 ` Frank Li
2026-05-22 14:38 ` Koichiro Den
2026-05-22 20:54 ` Frank Li
2026-05-21 6:31 ` [PATCH 06/12] dmaengine: dw-edma-pcie: Rename DMA data copy Koichiro Den
2026-05-21 16:10 ` Frank Li
2026-05-22 14:41 ` Koichiro Den
2026-05-21 6:31 ` [PATCH 07/12] dmaengine: dw-edma-pcie: Add default IRQ match data Koichiro Den
2026-05-21 16:12 ` Frank Li
2026-05-21 6:31 ` [PATCH 08/12] dmaengine: dw-edma-pcie: Add raw slave address match flag Koichiro Den
2026-05-21 16:15 ` Frank Li
2026-05-22 14:45 ` Koichiro Den
2026-05-21 6:31 ` [PATCH 09/12] dmaengine: dw-edma-pcie: Add register offset " Koichiro Den
2026-05-21 16:17 ` Frank Li
2026-05-22 14:57 ` Koichiro Den
2026-05-22 20:51 ` Frank Li
2026-05-21 6:31 ` [PATCH 10/12] dmaengine: dw-edma-pcie: Factor descriptor block addresses Koichiro Den
2026-05-21 16:21 ` Frank Li
2026-05-21 6:31 ` [PATCH 11/12] dmaengine: dw-edma-pcie: Handle optional data blocks Koichiro Den
2026-05-21 16:25 ` Frank Li
2026-05-21 6:31 ` [PATCH 12/12] dmaengine: dw-edma-pcie: Add chip flags match data Koichiro Den
2026-05-21 16:26 ` Frank Li
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=20260521063115.2842238-3-den@valinux.co.jp \
--to=den@valinux.co.jp \
--cc=Frank.Li@kernel.org \
--cc=dmaengine@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mani@kernel.org \
--cc=marek.vasut+renesas@mailbox.org \
--cc=vkoul@kernel.org \
--cc=yoshihiro.shimoda.uh@renesas.com \
/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®