From: Md Sadre Alam <mdalam@codeaurora.org>
To: vkoul@kernel.org, corbet@lwn.net, agross@kernel.org,
bjorn.andersson@linaro.org, dan.j.williams@intel.com,
dmaengine@vger.kernel.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org
Cc: mdalam@codeaurora.org, sricharan@codeaurora.org
Subject: [PATCH] dmaengine: qcom: bam_dma: Add LOCK and UNLOCK flag bit support
Date: Thu, 17 Dec 2020 20:07:22 +0530 [thread overview]
Message-ID: <1608215842-15381-1-git-send-email-mdalam@codeaurora.org> (raw)
This change will add support for LOCK & UNLOCK flag bit support
on CMD descriptor.
If DMA_PREP_LOCK flag passed in prep_slave_sg then requester of this
transaction wanted to lock the DMA controller for this transaction so
BAM driver should set LOCK bit for the HW descriptor.
If DMA_PREP_UNLOCK flag passed in prep_slave_sg then requester of this
transaction wanted to unlock the DMA controller.so BAM driver should set
UNLOCK bit for the HW descriptor.
Signed-off-by: Md Sadre Alam <mdalam@codeaurora.org>
---
Documentation/driver-api/dmaengine/provider.rst | 9 +++++++++
drivers/dma/qcom/bam_dma.c | 9 +++++++++
include/linux/dmaengine.h | 5 +++++
3 files changed, 23 insertions(+)
diff --git a/Documentation/driver-api/dmaengine/provider.rst b/Documentation/driver-api/dmaengine/provider.rst
index ddb0a81..d7516e2 100644
--- a/Documentation/driver-api/dmaengine/provider.rst
+++ b/Documentation/driver-api/dmaengine/provider.rst
@@ -599,6 +599,15 @@ DMA_CTRL_REUSE
- This flag is only supported if the channel reports the DMA_LOAD_EOT
capability.
+- DMA_PREP_LOCK
+
+ - If set , the client driver tells DMA controller I am locking you for
+ this transcation.
+
+- DMA_PREP_UNLOCK
+
+ - If set, the client driver will tells DMA controller I am releasing the lock
+
General Design Notes
====================
diff --git a/drivers/dma/qcom/bam_dma.c b/drivers/dma/qcom/bam_dma.c
index 4eeb8bb..cdbe395 100644
--- a/drivers/dma/qcom/bam_dma.c
+++ b/drivers/dma/qcom/bam_dma.c
@@ -58,6 +58,8 @@ struct bam_desc_hw {
#define DESC_FLAG_EOB BIT(13)
#define DESC_FLAG_NWD BIT(12)
#define DESC_FLAG_CMD BIT(11)
+#define DESC_FLAG_LOCK BIT(10)
+#define DESC_FLAG_UNLOCK BIT(9)
struct bam_async_desc {
struct virt_dma_desc vd;
@@ -644,6 +646,13 @@ static struct dma_async_tx_descriptor *bam_prep_slave_sg(struct dma_chan *chan,
/* fill in temporary descriptors */
desc = async_desc->desc;
+ if (flags & DMA_PREP_CMD) {
+ if (flags & DMA_PREP_LOCK)
+ desc->flags |= cpu_to_le16(DESC_FLAG_LOCK);
+ if (flags & DMA_PREP_UNLOCK)
+ desc->flags |= cpu_to_le16(DESC_FLAG_UNLOCK);
+ }
+
for_each_sg(sgl, sg, sg_len, i) {
unsigned int remainder = sg_dma_len(sg);
unsigned int curr_offset = 0;
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index dd357a7..79ccadb4 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -190,6 +190,9 @@ struct dma_interleaved_template {
* transaction is marked with DMA_PREP_REPEAT will cause the new transaction
* to never be processed and stay in the issued queue forever. The flag is
* ignored if the previous transaction is not a repeated transaction.
+ * @DMA_PREP_LOCK: tell the driver that DMA HW engine going to be locked for this
+ * transaction , until not seen DMA_PREP_UNLOCK flag set.
+ * @DMA_PREP_UNLOCK: tell the driver to unlock the DMA HW engine.
*/
enum dma_ctrl_flags {
DMA_PREP_INTERRUPT = (1 << 0),
@@ -202,6 +205,8 @@ enum dma_ctrl_flags {
DMA_PREP_CMD = (1 << 7),
DMA_PREP_REPEAT = (1 << 8),
DMA_PREP_LOAD_EOT = (1 << 9),
+ DMA_PREP_LOCK = (1 << 10),
+ DMA_PREP_UNLOCK = (1 << 11),
};
/**
--
2.7.4
next reply other threads:[~2020-12-17 14:38 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-17 14:37 Md Sadre Alam [this message]
2020-12-19 3:35 ` [PATCH] dmaengine: qcom: bam_dma: Add LOCK and UNLOCK flag bit support Thara Gopinath
2020-12-21 7:35 ` mdalam
2020-12-21 18:09 ` Thara Gopinath
2020-12-22 12:18 ` mdalam
2021-01-12 9:30 ` mdalam
2020-12-21 9:23 ` Vinod Koul
2020-12-21 17:33 ` mdalam
2021-01-12 9:31 ` mdalam
2021-01-12 10:10 ` Vinod Koul
2021-01-13 19:50 ` mdalam
2021-01-15 5:58 ` Vinod Koul
2021-01-18 3:51 ` mdalam
2021-01-19 16:45 ` Vinod Koul
2021-01-27 18:26 ` mdalam
2021-02-01 6:05 ` Vinod Koul
2021-02-01 6:22 ` mdalam
2021-02-01 6:43 ` Vinod Koul
2021-02-01 15:50 ` mdalam
2021-02-09 16:39 ` mdalam
2021-02-09 17:35 ` Bjorn Andersson
2021-02-11 4:01 ` mdalam
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=1608215842-15381-1-git-send-email-mdalam@codeaurora.org \
--to=mdalam@codeaurora.org \
--cc=agross@kernel.org \
--cc=bjorn.andersson@linaro.org \
--cc=corbet@lwn.net \
--cc=dan.j.williams@intel.com \
--cc=dmaengine@vger.kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sricharan@codeaurora.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;
as well as URLs for NNTP newsgroup(s).