phone-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 0/3] DMAengine: Add support for Immediate commands
@ 2021-09-19 14:43 Sireesh Kodali
  2021-09-19 14:43 ` [PATCH 1/3] doc: dmaengine: client-api: Add immediate commands in the DMA client API Sireesh Kodali
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Sireesh Kodali @ 2021-09-19 14:43 UTC (permalink / raw)
  To: phone-devel, ~postmarketos/upstreaming, dmaengine, linux-kernel,
	linux-arm-msm
  Cc: Sireesh Kodali

The IPA v2.x block, found on some older Qualcomm SoCs, uses BAM DMA to
send and receive packets from the AP. It also uses BAM to receive
commands from the AP (and possibly the modem). These commands are
encoded as "Immediate Commands". They vary from regular BAM DMA
commands, although I'm not sure as to exactly how they vary. Adding
support for immediate commands is trivial, but requires also adding
Immediate Commands to the dmaengine API, which is what this patch does.

Sireesh Kodali (3):
  doc: dmaengine: client-api: Add immediate commands in the DMA client
    API
  dmaengine: Add support for immediate commands in the client API
  dmaengine: qcom: bam_dma: Add support for immediate commands

 Documentation/driver-api/dmaengine/provider.rst | 10 ++++++++++
 drivers/dma/qcom/bam_dma.c                      |  3 +++
 include/linux/dmaengine.h                       |  4 ++++
 3 files changed, 17 insertions(+)

-- 
2.33.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/3] doc: dmaengine: client-api: Add immediate commands in the DMA client API
  2021-09-19 14:43 [RFC PATCH 0/3] DMAengine: Add support for Immediate commands Sireesh Kodali
@ 2021-09-19 14:43 ` Sireesh Kodali
  2021-09-19 14:43 ` [PATCH 2/3] dmaengine: Add support for immediate commands in the " Sireesh Kodali
  2021-09-19 14:43 ` [PATCH 3/3] dmaengine: qcom: bam_dma: Add support for immediate commands Sireesh Kodali
  2 siblings, 0 replies; 4+ messages in thread
From: Sireesh Kodali @ 2021-09-19 14:43 UTC (permalink / raw)
  To: phone-devel, ~postmarketos/upstreaming, dmaengine, linux-kernel,
	linux-arm-msm
  Cc: Sireesh Kodali, Vinod Koul, Jonathan Corbet, open list:DOCUMENTATION

Immediate commands are used by the IPA driver to send commands to the
microcontroller over BAM. These are different from PREP_CMD.

Signed-off-by: Sireesh Kodali <sireeshkodali1@gmail.com>
---
 Documentation/driver-api/dmaengine/provider.rst | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/Documentation/driver-api/dmaengine/provider.rst b/Documentation/driver-api/dmaengine/provider.rst
index ddb0a81a796c..f92a0bae06a0 100644
--- a/Documentation/driver-api/dmaengine/provider.rst
+++ b/Documentation/driver-api/dmaengine/provider.rst
@@ -571,6 +571,16 @@ DMA_CTRL_REUSE
     writes for which the descriptor should be in different format from
     normal data descriptors.
 
+- DMA_PREP_IMM_CMD
+
+  - If set, the client driver tells DMA controller that passed data in DMA
+    API is immediate command data.
+
+  - Interpretation of command data is DMA controller specific. It can be
+    used for issuing immediate commands to other peripherals/register
+    reads/register writes for which the descriptor shoudl be in a
+    different format from normal data descriptors.
+
 - DMA_PREP_REPEAT
 
   - If set, the transfer will be automatically repeated when it ends until a
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] dmaengine: Add support for immediate commands in the client API
  2021-09-19 14:43 [RFC PATCH 0/3] DMAengine: Add support for Immediate commands Sireesh Kodali
  2021-09-19 14:43 ` [PATCH 1/3] doc: dmaengine: client-api: Add immediate commands in the DMA client API Sireesh Kodali
@ 2021-09-19 14:43 ` Sireesh Kodali
  2021-09-19 14:43 ` [PATCH 3/3] dmaengine: qcom: bam_dma: Add support for immediate commands Sireesh Kodali
  2 siblings, 0 replies; 4+ messages in thread
From: Sireesh Kodali @ 2021-09-19 14:43 UTC (permalink / raw)
  To: phone-devel, ~postmarketos/upstreaming, dmaengine, linux-kernel,
	linux-arm-msm
  Cc: Sireesh Kodali, Vinod Koul

Immediate commands are needed by the IPA network driver, so that it can
send commands via BAM to the microcontroller

Signed-off-by: Sireesh Kodali <sireeshkodali1@gmail.com>
---
 include/linux/dmaengine.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index e5c2c9e71bf1..9bac959b34a8 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_IMM_CMD: tell the driver that the data passed to the DMA API is
+ *  immediate command data and the descriptor should be in a different format
+ *  from the normal data and descriptor
  */
 enum dma_ctrl_flags {
 	DMA_PREP_INTERRUPT = (1 << 0),
@@ -202,6 +205,7 @@ enum dma_ctrl_flags {
 	DMA_PREP_CMD = (1 << 7),
 	DMA_PREP_REPEAT = (1 << 8),
 	DMA_PREP_LOAD_EOT = (1 << 9),
+	DMA_PREP_IMM_CMD = (1 << 10),
 };
 
 /**
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] dmaengine: qcom: bam_dma: Add support for immediate commands
  2021-09-19 14:43 [RFC PATCH 0/3] DMAengine: Add support for Immediate commands Sireesh Kodali
  2021-09-19 14:43 ` [PATCH 1/3] doc: dmaengine: client-api: Add immediate commands in the DMA client API Sireesh Kodali
  2021-09-19 14:43 ` [PATCH 2/3] dmaengine: Add support for immediate commands in the " Sireesh Kodali
@ 2021-09-19 14:43 ` Sireesh Kodali
  2 siblings, 0 replies; 4+ messages in thread
From: Sireesh Kodali @ 2021-09-19 14:43 UTC (permalink / raw)
  To: phone-devel, ~postmarketos/upstreaming, dmaengine, linux-kernel,
	linux-arm-msm
  Cc: Sireesh Kodali, Andy Gross, Bjorn Andersson, Vinod Koul

Immediate commands are needed by the IPA driver to send commands to the
IPA controller over BAM. To support immediate commands, all we need to
do is set the relevant flag in the descriptor.

Signed-off-by: Sireesh Kodali <sireeshkodali1@gmail.com>
---
 drivers/dma/qcom/bam_dma.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/dma/qcom/bam_dma.c b/drivers/dma/qcom/bam_dma.c
index c8a77b428b52..cebec638a994 100644
--- a/drivers/dma/qcom/bam_dma.c
+++ b/drivers/dma/qcom/bam_dma.c
@@ -58,6 +58,7 @@ 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_IMM BIT(8)
 
 struct bam_async_desc {
 	struct virt_dma_desc vd;
@@ -651,6 +652,8 @@ static struct dma_async_tx_descriptor *bam_prep_slave_sg(struct dma_chan *chan,
 		do {
 			if (flags & DMA_PREP_CMD)
 				desc->flags |= cpu_to_le16(DESC_FLAG_CMD);
+			else if (flags & DMA_PREP_IMM_CMD)
+				desc->flags |= cpu_to_le16(DESC_FLAG_IMM);
 
 			desc->addr = cpu_to_le32(sg_dma_address(sg) +
 						 curr_offset);
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-09-19 14:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-19 14:43 [RFC PATCH 0/3] DMAengine: Add support for Immediate commands Sireesh Kodali
2021-09-19 14:43 ` [PATCH 1/3] doc: dmaengine: client-api: Add immediate commands in the DMA client API Sireesh Kodali
2021-09-19 14:43 ` [PATCH 2/3] dmaengine: Add support for immediate commands in the " Sireesh Kodali
2021-09-19 14:43 ` [PATCH 3/3] dmaengine: qcom: bam_dma: Add support for immediate commands Sireesh Kodali

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).