From: Frank Li <Frank.li@nxp.com>
To: Sai Sree Kartheek Adivi <s-adivi@ti.com>
Cc: peter.ujfalusi@gmail.com, vkoul@kernel.org, robh@kernel.org,
krzk+dt@kernel.org, conor+dt@kernel.org, nm@ti.com,
ssantosh@kernel.org, dmaengine@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, vigneshr@ti.com,
r-sharma3@ti.com, gehariprasath@ti.com
Subject: Re: [PATCH v4 06/19] dmaengine: ti: k3-udma: Add variant-specific function pointers to udma_dev
Date: Fri, 30 Jan 2026 10:52:25 -0500 [thread overview]
Message-ID: <aXzTubDlsQDIgLGM@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <20260130110159.359501-7-s-adivi@ti.com>
On Fri, Jan 30, 2026 at 04:31:46PM +0530, Sai Sree Kartheek Adivi wrote:
> Introduce function pointers in the udma_dev structure to allow
> variant-specific implementations for certain operations.
> This prepares the driver for supporting multiple K3 UDMA variants,
> such as UDMA v2, with minimal code duplication.
>
> No functional changes intended in this commit.
>
> Signed-off-by: Sai Sree Kartheek Adivi <s-adivi@ti.com>
> ---
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> drivers/dma/ti/k3-udma-private.c | 10 +++++--
> drivers/dma/ti/k3-udma.c | 46 +++++++++++++++++++-------------
> drivers/dma/ti/k3-udma.h | 12 +++++++++
> 3 files changed, 47 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/dma/ti/k3-udma-private.c b/drivers/dma/ti/k3-udma-private.c
> index 624360423ef17..44c097fff5ee6 100644
> --- a/drivers/dma/ti/k3-udma-private.c
> +++ b/drivers/dma/ti/k3-udma-private.c
> @@ -8,13 +8,19 @@
>
> int xudma_navss_psil_pair(struct udma_dev *ud, u32 src_thread, u32 dst_thread)
> {
> - return navss_psil_pair(ud, src_thread, dst_thread);
> + if (ud->psil_pair)
> + return ud->psil_pair(ud, src_thread, dst_thread);
> +
> + return 0;
> }
> EXPORT_SYMBOL(xudma_navss_psil_pair);
>
> int xudma_navss_psil_unpair(struct udma_dev *ud, u32 src_thread, u32 dst_thread)
> {
> - return navss_psil_unpair(ud, src_thread, dst_thread);
> + if (ud->psil_unpair)
> + return ud->psil_unpair(ud, src_thread, dst_thread);
> +
> + return 0;
> }
> EXPORT_SYMBOL(xudma_navss_psil_unpair);
>
> diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c
> index 214a1ca1e1776..397e890283eaa 100644
> --- a/drivers/dma/ti/k3-udma.c
> +++ b/drivers/dma/ti/k3-udma.c
> @@ -40,7 +40,7 @@ static const char * const mmr_names[] = {
> [MMR_TCHANRT] = "tchanrt",
> };
>
> -static int navss_psil_pair(struct udma_dev *ud, u32 src_thread, u32 dst_thread)
> +int navss_psil_pair(struct udma_dev *ud, u32 src_thread, u32 dst_thread)
> {
> struct udma_tisci_rm *tisci_rm = &ud->tisci_rm;
>
> @@ -50,8 +50,8 @@ static int navss_psil_pair(struct udma_dev *ud, u32 src_thread, u32 dst_thread)
> src_thread, dst_thread);
> }
>
> -static int navss_psil_unpair(struct udma_dev *ud, u32 src_thread,
> - u32 dst_thread)
> +int navss_psil_unpair(struct udma_dev *ud, u32 src_thread,
> + u32 dst_thread)
> {
> struct udma_tisci_rm *tisci_rm = &ud->tisci_rm;
>
> @@ -329,7 +329,7 @@ static int udma_start(struct udma_chan *uc)
> }
>
> /* Make sure that we clear the teardown bit, if it is set */
> - udma_reset_chan(uc, false);
> + uc->ud->reset_chan(uc, false);
>
> /* Push descriptors before we start the channel */
> udma_start_desc(uc);
> @@ -521,8 +521,8 @@ static void udma_check_tx_completion(struct work_struct *work)
> if (uc->desc) {
> struct udma_desc *d = uc->desc;
>
> - udma_decrement_byte_counters(uc, d->residue);
> - udma_start(uc);
> + uc->ud->decrement_byte_counters(uc, d->residue);
> + uc->ud->start(uc);
> vchan_cookie_complete(&d->vd);
> break;
> }
> @@ -554,7 +554,7 @@ static irqreturn_t udma_ring_irq_handler(int irq, void *data)
> }
>
> if (!uc->desc)
> - udma_start(uc);
> + uc->ud->start(uc);
>
> goto out;
> }
> @@ -576,8 +576,8 @@ static irqreturn_t udma_ring_irq_handler(int irq, void *data)
> vchan_cyclic_callback(&d->vd);
> } else {
> if (udma_is_desc_really_done(uc, d)) {
> - udma_decrement_byte_counters(uc, d->residue);
> - udma_start(uc);
> + uc->ud->decrement_byte_counters(uc, d->residue);
> + uc->ud->start(uc);
> vchan_cookie_complete(&d->vd);
> } else {
> schedule_delayed_work(&uc->tx_drain.work,
> @@ -612,8 +612,8 @@ static irqreturn_t udma_udma_irq_handler(int irq, void *data)
> vchan_cyclic_callback(&d->vd);
> } else {
> /* TODO: figure out the real amount of data */
> - udma_decrement_byte_counters(uc, d->residue);
> - udma_start(uc);
> + uc->ud->decrement_byte_counters(uc, d->residue);
> + uc->ud->start(uc);
> vchan_cookie_complete(&d->vd);
> }
> }
> @@ -1654,7 +1654,7 @@ static int udma_alloc_chan_resources(struct dma_chan *chan)
>
> if (udma_is_chan_running(uc)) {
> dev_warn(ud->dev, "chan%d: is running!\n", uc->id);
> - udma_reset_chan(uc, false);
> + ud->reset_chan(uc, false);
> if (udma_is_chan_running(uc)) {
> dev_err(ud->dev, "chan%d: won't stop!\n", uc->id);
> ret = -EBUSY;
> @@ -1821,7 +1821,7 @@ static int bcdma_alloc_chan_resources(struct dma_chan *chan)
>
> if (udma_is_chan_running(uc)) {
> dev_warn(ud->dev, "chan%d: is running!\n", uc->id);
> - udma_reset_chan(uc, false);
> + ud->reset_chan(uc, false);
> if (udma_is_chan_running(uc)) {
> dev_err(ud->dev, "chan%d: won't stop!\n", uc->id);
> ret = -EBUSY;
> @@ -2014,7 +2014,7 @@ static int pktdma_alloc_chan_resources(struct dma_chan *chan)
>
> if (udma_is_chan_running(uc)) {
> dev_warn(ud->dev, "chan%d: is running!\n", uc->id);
> - udma_reset_chan(uc, false);
> + ud->reset_chan(uc, false);
> if (udma_is_chan_running(uc)) {
> dev_err(ud->dev, "chan%d: won't stop!\n", uc->id);
> ret = -EBUSY;
> @@ -2123,7 +2123,7 @@ static void udma_issue_pending(struct dma_chan *chan)
> */
> if (!(uc->state == UDMA_CHAN_IS_TERMINATING &&
> udma_is_chan_running(uc)))
> - udma_start(uc);
> + uc->ud->start(uc);
> }
>
> spin_unlock_irqrestore(&uc->vc.lock, flags);
> @@ -2265,7 +2265,7 @@ static int udma_terminate_all(struct dma_chan *chan)
> spin_lock_irqsave(&uc->vc.lock, flags);
>
> if (udma_is_chan_running(uc))
> - udma_stop(uc);
> + uc->ud->stop(uc);
>
> if (uc->desc) {
> uc->terminated_desc = uc->desc;
> @@ -2297,11 +2297,11 @@ static void udma_synchronize(struct dma_chan *chan)
> dev_warn(uc->ud->dev, "chan%d teardown timeout!\n",
> uc->id);
> udma_dump_chan_stdata(uc);
> - udma_reset_chan(uc, true);
> + uc->ud->reset_chan(uc, true);
> }
> }
>
> - udma_reset_chan(uc, false);
> + uc->ud->reset_chan(uc, false);
> if (udma_is_chan_running(uc))
> dev_warn(uc->ud->dev, "chan%d refused to stop!\n", uc->id);
>
> @@ -2355,7 +2355,7 @@ static void udma_free_chan_resources(struct dma_chan *chan)
>
> udma_terminate_all(chan);
> if (uc->terminated_desc) {
> - udma_reset_chan(uc, false);
> + ud->reset_chan(uc, false);
> udma_reset_rings(uc);
> }
>
> @@ -3694,6 +3694,14 @@ static int udma_probe(struct platform_device *pdev)
> ud->soc_data = soc->data;
> }
>
> + // Setup function pointers
> + ud->start = udma_start;
> + ud->stop = udma_stop;
> + ud->reset_chan = udma_reset_chan;
> + ud->decrement_byte_counters = udma_decrement_byte_counters;
> + ud->psil_pair = navss_psil_pair;
> + ud->psil_unpair = navss_psil_unpair;
> +
> ret = udma_get_mmrs(pdev, ud);
> if (ret)
> return ret;
> diff --git a/drivers/dma/ti/k3-udma.h b/drivers/dma/ti/k3-udma.h
> index 4c6e5b946d5cf..2f5fbea446fed 100644
> --- a/drivers/dma/ti/k3-udma.h
> +++ b/drivers/dma/ti/k3-udma.h
> @@ -344,6 +344,15 @@ struct udma_dev {
> u32 psil_base;
> u32 atype;
> u32 asel;
> +
> + int (*start)(struct udma_chan *uc);
> + int (*stop)(struct udma_chan *uc);
> + int (*reset_chan)(struct udma_chan *uc, bool hard);
> + void (*decrement_byte_counters)(struct udma_chan *uc, u32 val);
> + int (*psil_pair)(struct udma_dev *ud, u32 src_thread,
> + u32 dst_thread);
> + int (*psil_unpair)(struct udma_dev *ud, u32 src_thread,
> + u32 dst_thread);
> };
>
> struct udma_desc {
> @@ -614,6 +623,9 @@ int udma_push_to_ring(struct udma_chan *uc, int idx);
> int udma_pop_from_ring(struct udma_chan *uc, dma_addr_t *addr);
> void udma_reset_rings(struct udma_chan *uc);
>
> +int navss_psil_pair(struct udma_dev *ud, u32 src_thread, u32 dst_thread);
> +int navss_psil_unpair(struct udma_dev *ud, u32 src_thread, u32 dst_thread);
> +
> /* Direct access to UDMA low lever resources for the glue layer */
> int xudma_navss_psil_pair(struct udma_dev *ud, u32 src_thread, u32 dst_thread);
> int xudma_navss_psil_unpair(struct udma_dev *ud, u32 src_thread,
> --
> 2.34.1
>
next prev parent reply other threads:[~2026-01-30 15:52 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-30 11:01 [PATCH v4 00/19] dmaengine: ti: Add support for BCDMA v2 and PKTDMA v2 Sai Sree Kartheek Adivi
2026-01-30 11:01 ` [PATCH v4 01/19] dmaengine: ti: k3-udma: move macros to header file Sai Sree Kartheek Adivi
2026-01-30 15:36 ` Frank Li
2026-01-30 11:01 ` [PATCH v4 02/19] dmaengine: ti: k3-udma: move structs and enums " Sai Sree Kartheek Adivi
2026-01-30 15:37 ` Frank Li
2026-01-30 11:01 ` [PATCH v4 03/19] dmaengine: ti: k3-udma: move static inline helper functions " Sai Sree Kartheek Adivi
2026-01-30 15:38 ` Frank Li
2026-01-30 11:01 ` [PATCH v4 04/19] dmaengine: ti: k3-udma: move descriptor management to k3-udma-common.c Sai Sree Kartheek Adivi
2026-01-30 15:43 ` Frank Li
2026-01-30 11:01 ` [PATCH v4 05/19] dmaengine: ti: k3-udma: move ring management functions " Sai Sree Kartheek Adivi
2026-01-30 15:46 ` Frank Li
2026-01-30 11:01 ` [PATCH v4 06/19] dmaengine: ti: k3-udma: Add variant-specific function pointers to udma_dev Sai Sree Kartheek Adivi
2026-01-30 15:52 ` Frank Li [this message]
2026-01-30 11:01 ` [PATCH v4 07/19] dmaengine: ti: k3-udma: move udma utility functions to k3-udma-common.c Sai Sree Kartheek Adivi
2026-01-30 15:58 ` Frank Li
2026-01-30 11:01 ` [PATCH v4 08/19] dmaengine: ti: k3-udma: move resource management " Sai Sree Kartheek Adivi
2026-01-30 11:01 ` [PATCH v4 09/19] dmaengine: ti: k3-udma: refactor resource setup functions Sai Sree Kartheek Adivi
2026-01-30 11:01 ` [PATCH v4 10/19] dmaengine: ti: k3-udma: move inclusion of k3-udma-private.c to k3-udma-common.c Sai Sree Kartheek Adivi
2026-01-30 11:01 ` [PATCH v4 11/19] drivers: soc: ti: k3-ringacc: handle absence of tisci Sai Sree Kartheek Adivi
2026-01-30 18:40 ` kernel test robot
2026-01-30 18:40 ` kernel test robot
2026-02-03 6:05 ` Péter Ujfalusi
2026-01-30 11:01 ` [PATCH v4 12/19] dt-bindings: dma: ti: Add K3 BCDMA V2 Sai Sree Kartheek Adivi
2026-01-30 15:35 ` Frank Li
2026-02-05 9:04 ` Krzysztof Kozlowski
2026-01-30 11:01 ` [PATCH v4 13/19] dt-bindings: dma: ti: Add K3 PKTDMA V2 Sai Sree Kartheek Adivi
2026-01-30 12:44 ` Rob Herring (Arm)
2026-01-30 15:34 ` Frank Li
2026-02-05 9:06 ` Krzysztof Kozlowski
2026-01-30 11:01 ` [PATCH v4 14/19] dmaengine: ti: k3-psil-am62l: Add AM62Lx PSIL and PDMA data Sai Sree Kartheek Adivi
2026-01-30 11:01 ` [PATCH v4 15/19] dmaengine: ti: k3-udma-v2: New driver for K3 BCDMA_V2 Sai Sree Kartheek Adivi
2026-01-30 16:08 ` Frank Li
2026-02-03 6:37 ` Péter Ujfalusi
2026-02-03 8:22 ` Sai Sree Kartheek Adivi
2026-02-03 18:14 ` Péter Ujfalusi
2026-01-30 11:01 ` [PATCH v4 16/19] dmaengine: ti: k3-udma-v2: Add support for PKTDMA V2 Sai Sree Kartheek Adivi
2026-02-03 6:25 ` Péter Ujfalusi
2026-02-03 7:51 ` Sai Sree Kartheek Adivi
2026-01-30 11:01 ` [PATCH v4 17/19] dmaengine: ti: k3-udma-v2: Update glue layer to support " Sai Sree Kartheek Adivi
2026-01-30 11:01 ` [PATCH v4 18/19] dmaengine: ti: k3-udma: Validate resource ID and fix logging in reservation Sai Sree Kartheek Adivi
2026-01-30 11:01 ` [PATCH v4 19/19] dmaengine: ti: k3-udma: switch to synchronous descriptor freeing Sai Sree Kartheek Adivi
2026-01-30 20:37 ` kernel test robot
2026-02-05 9:07 ` Krzysztof Kozlowski
2026-02-11 7:42 ` Sai Sree Kartheek Adivi
2026-02-03 6:42 ` [PATCH v4 00/19] dmaengine: ti: Add support for BCDMA v2 and PKTDMA v2 Péter Ujfalusi
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=aXzTubDlsQDIgLGM@lizhi-Precision-Tower-5810 \
--to=frank.li@nxp.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dmaengine@vger.kernel.org \
--cc=gehariprasath@ti.com \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nm@ti.com \
--cc=peter.ujfalusi@gmail.com \
--cc=r-sharma3@ti.com \
--cc=robh@kernel.org \
--cc=s-adivi@ti.com \
--cc=ssantosh@kernel.org \
--cc=vigneshr@ti.com \
--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