All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vignesh Raghavendra <vigneshr@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/6] dma: Introduce dma_get_cfg() interface
Date: Mon, 18 Nov 2019 16:29:05 +0530	[thread overview]
Message-ID: <20191118105910.14472-2-vigneshr@ti.com> (raw)
In-Reply-To: <20191118105910.14472-1-vigneshr@ti.com>

Sometimes, there would be a need to exchange data between DMA provider
and DMA client which are very specific to DMA driver of the SoC/platform
and are not generic enough to be put into struct dma. Therefore, introduce
dma_get_cfg() interface to get DMA provider specific data from client
device. Clients can use unique configuration ID flags to get different
configuration data from DMA driver.

Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
---
 drivers/dma/dma-uclass.c | 12 ++++++++++++
 include/dma-uclass.h     | 11 +++++++++++
 include/dma.h            | 11 +++++++++++
 3 files changed, 34 insertions(+)

diff --git a/drivers/dma/dma-uclass.c b/drivers/dma/dma-uclass.c
index 9c961cf1e2c7..2321fb513ba3 100644
--- a/drivers/dma/dma-uclass.c
+++ b/drivers/dma/dma-uclass.c
@@ -186,6 +186,18 @@ int dma_send(struct dma *dma, void *src, size_t len, void *metadata)
 
 	return ops->send(dma, src, len, metadata);
 }
+
+int dma_get_cfg(struct dma *dma, u32 cfg_id, void **cfg_data)
+{
+	struct dma_ops *ops = dma_dev_ops(dma->dev);
+
+	debug("%s(dma=%p)\n", __func__, dma);
+
+	if (!ops->get_cfg)
+		return -ENOSYS;
+
+	return ops->get_cfg(dma, cfg_id, cfg_data);
+}
 #endif /* CONFIG_DMA_CHANNELS */
 
 int dma_get_device(u32 transfer_type, struct udevice **devp)
diff --git a/include/dma-uclass.h b/include/dma-uclass.h
index 31b43fb4b98e..a1d9d26ac56f 100644
--- a/include/dma-uclass.h
+++ b/include/dma-uclass.h
@@ -108,6 +108,17 @@ struct dma_ops {
 	 * @return zero on success, or -ve error code.
 	 */
 	int (*send)(struct dma *dma, void *src, size_t len, void *metadata);
+	/**
+	 * get_cfg() - Get DMA channel configuration for client's use
+	 *
+	 * @dma:    The DMA Channel to manipulate
+	 * @cfg_id: DMA provider specific ID to identify what
+	 *          configuration data client needs
+	 * @data:   Pointer to store pointer to DMA driver specific
+	 *          configuration data for the given cfg_id (output param)
+	 * @return zero on success, or -ve error code.
+	 */
+	int (*get_cfg)(struct dma *dma, u32 cfg_id, void **data);
 #endif /* CONFIG_DMA_CHANNELS */
 	/**
 	 * transfer() - Issue a DMA transfer. The implementation must
diff --git a/include/dma.h b/include/dma.h
index 32885571f7d4..426617b34edf 100644
--- a/include/dma.h
+++ b/include/dma.h
@@ -290,6 +290,17 @@ int dma_receive(struct dma *dma, void **dst, void *metadata);
  * @return zero on success, or -ve error code.
  */
 int dma_send(struct dma *dma, void *src, size_t len, void *metadata);
+/**
+ * dma_get_cfg() - Get DMA channel configuration for client's use
+ *
+ * @dma:      The DMA Channel to manipulate
+ * @cfg_id:   DMA provider specific ID to identify what
+ *            configuration data client needs
+ * @cfg_data: Pointer to store pointer to DMA driver specific
+ *            configuration data for the given cfg_id (output param)
+ * @return zero on success, or -ve error code.
+ */
+int dma_get_cfg(struct dma *dma, u32 cfg_id, void **cfg_data);
 #endif /* CONFIG_DMA_CHANNELS */
 
 #if CONFIG_IS_ENABLED(DMA)
-- 
2.24.0

  reply	other threads:[~2019-11-18 10:59 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-18 10:59 [U-Boot] [PATCH 0/6] J721e: Add networking support Vignesh Raghavendra
2019-11-18 10:59 ` Vignesh Raghavendra [this message]
2019-11-20 22:24   ` [U-Boot] [PATCH 1/6] dma: Introduce dma_get_cfg() interface Joe Hershberger
2019-11-18 10:59 ` [U-Boot] [PATCH 2/6] dma: ti: k3-udma: Implement " Vignesh Raghavendra
2019-11-20 22:53   ` Joe Hershberger
2019-11-18 10:59 ` [U-Boot] [PATCH 3/6] net: ti: am65-cpsw-nuss: Rework RX flow ID handling Vignesh Raghavendra
2019-11-20 22:46   ` Joe Hershberger
2019-11-18 10:59 ` [U-Boot] [PATCH 4/6] net: ti: am65-cpsw-nuss: Add new compatible for J721e Vignesh Raghavendra
2019-11-20 22:46   ` Joe Hershberger
2019-11-18 10:59 ` [U-Boot] [PATCH 5/6] arm: dts: k3-j721e-common-proc-board: Add DMA and CPSW related DT nodes Vignesh Raghavendra
2019-11-20 22:47   ` Joe Hershberger
2019-11-18 10:59 ` [U-Boot] [PATCH 6/6] configs: j721e_evm_a72_defconfig: Enable DMA and Ethernet Vignesh Raghavendra
2019-11-20 22:53   ` Joe Hershberger
2019-11-21 12:32 ` [U-Boot] [PATCH 0/6] J721e: Add networking support Grygorii Strashko
2019-11-21 12:43   ` Vignesh Raghavendra

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=20191118105910.14472-2-vigneshr@ti.com \
    --to=vigneshr@ti.com \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.