mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Aatif Mushtaq <aatif4.m@samsung.com>
To: vkoul@kernel.org, dmaengine@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: pankaj.dubey@samsung.com, aswani.reddy@samsung.com,
	Aatif Mushtaq <aatif4.m@samsung.com>
Subject: [PATCH 1/3] dmaengine: Add support for 2D DMA operation
Date: Mon, 10 Feb 2025 11:49:13 +0530	[thread overview]
Message-ID: <20250210061915.26218-2-aatif4.m@samsung.com> (raw)
In-Reply-To: <20250210061915.26218-1-aatif4.m@samsung.com>

Add a new dma engine API to support 2D DMA operations.
The API will be used to get the descriptor for 2D transfer based on
the 16-bit immediate to define the stride length between consecuitive
source address or destination address after every DMA load and
store instruction is processed.

Signed-off-by: Aatif Mushtaq <aatif4.m@samsung.com>
---
 include/linux/dmaengine.h | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index b137fdb56093..8a73b2147983 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -833,6 +833,7 @@ struct dma_filter {
  *	be called after period_len bytes have been transferred.
  * @device_prep_interleaved_dma: Transfer expression in a generic way.
  * @device_prep_dma_imm_data: DMA's 8 byte immediate data to the dst address
+ * @device_prep_2d_dma_memcpy: prepares a 2D memcpy operation
  * @device_caps: May be used to override the generic DMA slave capabilities
  *	with per-channel specific ones
  * @device_config: Pushes a new configuration to a channel, return 0 or an error
@@ -938,6 +939,9 @@ struct dma_device {
 	struct dma_async_tx_descriptor *(*device_prep_dma_imm_data)(
 		struct dma_chan *chan, dma_addr_t dst, u64 data,
 		unsigned long flags);
+	struct dma_async_tx_descriptor *(*device_prep_2d_dma_memcpy)(
+		struct dma_chan *chan, dma_addr_t dest, dma_addr_t src,
+		size_t len, u16 src_imm, u16 dest_imm, unsigned long flags);
 
 	void (*device_caps)(struct dma_chan *chan, struct dma_slave_caps *caps);
 	int (*device_config)(struct dma_chan *chan, struct dma_slave_config *config);
@@ -1087,6 +1091,27 @@ static inline struct dma_async_tx_descriptor *dmaengine_prep_dma_memcpy(
 						    len, flags);
 }
 
+/**
+ * device_prep_2d_dma_memcpy() - Prepare a DMA 2D memcpy descriptor.
+ * @chan: The channel to be used for this descriptor
+ * @dest: Address of the destination data for a DMA channel
+ * @src: Address of the source data for a DMA channel
+ * @len: The total size of data
+ * @src_imm: The immediate value to be added to the src address register
+ * @dest_imm: The immediate value to be added to the dst address register
+ * @flags: DMA engine flags
+ */
+static inline struct dma_async_tx_descriptor *device_prep_2d_dma_memcpy(
+		struct dma_chan *chan, dma_addr_t dest, dma_addr_t src,
+		size_t len, u16 src_imm, u16 dest_imm, unsigned long flags)
+{
+	if (!chan || !chan->device || !chan->device->device_prep_2d_dma_memcpy)
+		return NULL;
+
+	return chan->device->device_prep_2d_dma_memcpy(chan, dest, src, len,
+						       src_imm, dest_imm, flags);
+}
+
 static inline bool dmaengine_is_metadata_mode_supported(struct dma_chan *chan,
 		enum dma_desc_metadata_mode mode)
 {
-- 
2.17.1


  parent reply	other threads:[~2025-02-10  6:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20250210062219epcas5p4695fe63e9ba36c19a640504f95dc3f12@epcas5p4.samsung.com>
2025-02-10  6:19 ` [PATCH 0/3] Add capability for 2D DMA transfer Aatif Mushtaq
     [not found]   ` <CGME20250210062247epcas5p4ce208ba2806454c48a68ef25d0a326cc@epcas5p4.samsung.com>
2025-02-10  6:19     ` Aatif Mushtaq [this message]
2025-02-10  7:50       ` [PATCH 1/3] dmaengine: Add support for 2D DMA operation Pankaj Dubey
2025-02-27  8:01       ` Vinod Koul
2025-02-28  9:32         ` Aatif Mushtaq/Aatif Mushtaq
2025-03-06  6:35         ` Aatif Mushtaq/Aatif Mushtaq
2025-03-24  7:34         ` Aatif Mushtaq/Aatif Mushtaq
     [not found]   ` <CGME20250210062254epcas5p1d463b3ce009ea29f5291fc27954103e7@epcas5p1.samsung.com>
2025-02-10  6:19     ` [PATCH 2/3] dmaengine: pl330: Add DMAADDH instruction Aatif Mushtaq
2025-02-10  7:53       ` Pankaj Dubey
     [not found]   ` <CGME20250210062258epcas5p195b96f374fa9ce1802ec4d1c1e73f69c@epcas5p1.samsung.com>
2025-02-10  6:19     ` [PATCH 3/3] dmaengine: pl330: Add DMA_2D capability Aatif Mushtaq
2025-02-10  7:54       ` Pankaj Dubey
     [not found]   ` <CGME20250210062219epcas5p4695fe63e9ba36c19a640504f95dc3f12@epcms5p5>
     [not found]     ` <20250224084948epcms5p57acb02e41b7626321d82c74569361be5@epcms5p5>
2025-02-27  8:00       ` FW: [PATCH 0/3] Add capability for 2D DMA transfer Vinod Koul
2025-02-28  9:28         ` Aatif Mushtaq/Aatif Mushtaq

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=20250210061915.26218-2-aatif4.m@samsung.com \
    --to=aatif4.m@samsung.com \
    --cc=aswani.reddy@samsung.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pankaj.dubey@samsung.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

all inboxes | Powered by JetHome®