linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] dmaengine: Add support for immediate commands
@ 2022-10-27  5:14 Sireesh Kodali
  2022-10-27  5:14 ` [PATCH v2 1/3] doc: dmaengine: client-api: Add immediate commands in the DMA client API Sireesh Kodali
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Sireesh Kodali @ 2022-10-27  5:14 UTC (permalink / raw)
  To: vkoul, linux-kernel, linux-doc, linux-arm-msm
  Cc: dmaengine, ~postmarketos/upstreaming, 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. Adding support for immediate commands is trivial, but requires
also adding Immediate Commands to the dmaengine API, which is what this
patch series 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: 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.38.1


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

* [PATCH v2 1/3] doc: dmaengine: client-api: Add immediate commands in the DMA client API
  2022-10-27  5:14 [PATCH v2 0/3] dmaengine: Add support for immediate commands Sireesh Kodali
@ 2022-10-27  5:14 ` Sireesh Kodali
  2022-10-27  5:14 ` [PATCH v2 2/3] dmaengine: Add support for immediate commands in the " Sireesh Kodali
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 9+ messages in thread
From: Sireesh Kodali @ 2022-10-27  5:14 UTC (permalink / raw)
  To: vkoul, linux-kernel, linux-doc, linux-arm-msm
  Cc: dmaengine, ~postmarketos/upstreaming, Sireesh Kodali, Jonathan Corbet

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 ceac2a300e32..5afe21191299 100644
--- a/Documentation/driver-api/dmaengine/provider.rst
+++ b/Documentation/driver-api/dmaengine/provider.rst
@@ -590,6 +590,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 should 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.38.1


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

* [PATCH v2 2/3] dmaengine: Add support for immediate commands in the client API
  2022-10-27  5:14 [PATCH v2 0/3] dmaengine: Add support for immediate commands Sireesh Kodali
  2022-10-27  5:14 ` [PATCH v2 1/3] doc: dmaengine: client-api: Add immediate commands in the DMA client API Sireesh Kodali
@ 2022-10-27  5:14 ` Sireesh Kodali
  2022-10-27  5:14 ` [PATCH v2 3/3] dmaengine: bam_dma: Add support for immediate commands Sireesh Kodali
  2022-11-04 12:40 ` [PATCH v2 0/3] dmaengine: " Vinod Koul
  3 siblings, 0 replies; 9+ messages in thread
From: Sireesh Kodali @ 2022-10-27  5:14 UTC (permalink / raw)
  To: vkoul, linux-kernel, linux-doc, linux-arm-msm
  Cc: dmaengine, ~postmarketos/upstreaming, Sireesh Kodali

Immediate commands are needed by the IPA network driver, so that it can
send commands via BAM to the IPA 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 c923f4e60f24..8da96bb50a63 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.38.1


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

* [PATCH v2 3/3] dmaengine: bam_dma: Add support for immediate commands
  2022-10-27  5:14 [PATCH v2 0/3] dmaengine: Add support for immediate commands Sireesh Kodali
  2022-10-27  5:14 ` [PATCH v2 1/3] doc: dmaengine: client-api: Add immediate commands in the DMA client API Sireesh Kodali
  2022-10-27  5:14 ` [PATCH v2 2/3] dmaengine: Add support for immediate commands in the " Sireesh Kodali
@ 2022-10-27  5:14 ` Sireesh Kodali
  2022-11-04 12:40 ` [PATCH v2 0/3] dmaengine: " Vinod Koul
  3 siblings, 0 replies; 9+ messages in thread
From: Sireesh Kodali @ 2022-10-27  5:14 UTC (permalink / raw)
  To: vkoul, linux-kernel, linux-doc, linux-arm-msm
  Cc: dmaengine, ~postmarketos/upstreaming, Sireesh Kodali, Andy Gross,
	Bjorn Andersson, Konrad Dybcio

Immediate commands are handled similar to regular commands that are sent
over BAM, only a different flag needs to be set. The immediate command
support is needed to implement support for IPA v2.x, which rely on BAM
immediate commands to send commands to the IPA microcontroller.

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 2ff787df513e..3135a3e4a167 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;
@@ -693,6 +694,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.38.1


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

* Re: [PATCH v2 0/3] dmaengine: Add support for immediate commands
  2022-10-27  5:14 [PATCH v2 0/3] dmaengine: Add support for immediate commands Sireesh Kodali
                   ` (2 preceding siblings ...)
  2022-10-27  5:14 ` [PATCH v2 3/3] dmaengine: bam_dma: Add support for immediate commands Sireesh Kodali
@ 2022-11-04 12:40 ` Vinod Koul
  2022-11-11  5:12   ` Sireesh Kodali
  3 siblings, 1 reply; 9+ messages in thread
From: Vinod Koul @ 2022-11-04 12:40 UTC (permalink / raw)
  To: Sireesh Kodali
  Cc: linux-kernel, linux-doc, linux-arm-msm, dmaengine,
	~postmarketos/upstreaming

On 27-10-22, 10:44, Sireesh Kodali wrote:
> 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. Adding support for immediate commands is trivial, but requires
> also adding Immediate Commands to the dmaengine API, which is what this
> patch series does.

Can you explain a bit more. I understand you need "Immediate Commands"
but am really reluctant to add another interface to support a specific
use case

> 
> 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: 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.38.1

-- 
~Vinod

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

* Re: [PATCH v2 0/3] dmaengine: Add support for immediate commands
  2022-11-04 12:40 ` [PATCH v2 0/3] dmaengine: " Vinod Koul
@ 2022-11-11  5:12   ` Sireesh Kodali
  2022-11-13 22:23     ` Vinod Koul
  0 siblings, 1 reply; 9+ messages in thread
From: Sireesh Kodali @ 2022-11-11  5:12 UTC (permalink / raw)
  To: Vinod Koul
  Cc: linux-kernel, linux-doc, linux-arm-msm, dmaengine,
	~postmarketos/upstreaming

On Fri Nov 4, 2022 at 6:10 PM IST, Vinod Koul wrote:
> On 27-10-22, 10:44, Sireesh Kodali wrote:
> > 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. Adding support for immediate commands is trivial, but requires
> > also adding Immediate Commands to the dmaengine API, which is what this
> > patch series does.
>
> Can you explain a bit more. I understand you need "Immediate Commands"
> but am really reluctant to add another interface to support a specific
> use case
>

Apologies for the delayed response

BAM supports both regular commands, and "immediate commands". Currently,
commands are used by the Qualcom NAND chip driver, while "immediate
commands" are intended to be used by the (yet to be mainlined) IPA
driver. From the BAM driver perspective, both immediate and regular
commands are simply a matter of setting the appropriate flag in the
descriptor. I don't have access to the documentation on BAM to know
exactly how these two modes differ, however I do know they are not
interchangable. If a different API is suggested, I can change the
implementation as needed.

Regards,
Sireesh Kodali
> > 
> > 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: 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.38.1
>
> -- 
> ~Vinod


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

* Re: [PATCH v2 0/3] dmaengine: Add support for immediate commands
  2022-11-11  5:12   ` Sireesh Kodali
@ 2022-11-13 22:23     ` Vinod Koul
  2022-11-24  3:14       ` Sireesh Kodali
  2022-11-25 16:50       ` Sireesh Kodali
  0 siblings, 2 replies; 9+ messages in thread
From: Vinod Koul @ 2022-11-13 22:23 UTC (permalink / raw)
  To: Sireesh Kodali
  Cc: linux-kernel, linux-doc, linux-arm-msm, dmaengine,
	~postmarketos/upstreaming

On 11-11-22, 10:42, Sireesh Kodali wrote:
> On Fri Nov 4, 2022 at 6:10 PM IST, Vinod Koul wrote:
> > On 27-10-22, 10:44, Sireesh Kodali wrote:
> > > 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. Adding support for immediate commands is trivial, but requires
> > > also adding Immediate Commands to the dmaengine API, which is what this
> > > patch series does.
> >
> > Can you explain a bit more. I understand you need "Immediate Commands"
> > but am really reluctant to add another interface to support a specific
> > use case
> >
> 
> Apologies for the delayed response
> 
> BAM supports both regular commands, and "immediate commands". Currently,
> commands are used by the Qualcom NAND chip driver, while "immediate
> commands" are intended to be used by the (yet to be mainlined) IPA
> driver. From the BAM driver perspective, both immediate and regular
> commands are simply a matter of setting the appropriate flag in the
> descriptor. I don't have access to the documentation on BAM to know
> exactly how these two modes differ, however I do know they are not
> interchangable. If a different API is suggested, I can change the
> implementation as needed.

Ok, can you please explain what is meant by 'regular' cmd and
'immediate', lets see what is required here

-- 
~Vinod

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

* Re: [PATCH v2 0/3] dmaengine: Add support for immediate commands
  2022-11-13 22:23     ` Vinod Koul
@ 2022-11-24  3:14       ` Sireesh Kodali
  2022-11-25 16:50       ` Sireesh Kodali
  1 sibling, 0 replies; 9+ messages in thread
From: Sireesh Kodali @ 2022-11-24  3:14 UTC (permalink / raw)
  To: Vinod Koul
  Cc: linux-kernel, linux-doc, linux-arm-msm, dmaengine,
	~postmarketos/upstreaming

On Mon Nov 14, 2022 at 3:53 AM IST, Vinod Koul wrote:
> On 11-11-22, 10:42, Sireesh Kodali wrote:
> > On Fri Nov 4, 2022 at 6:10 PM IST, Vinod Koul wrote:
> > > On 27-10-22, 10:44, Sireesh Kodali wrote:
> > > > 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. Adding support for immediate commands is trivial, but requires
> > > > also adding Immediate Commands to the dmaengine API, which is what this
> > > > patch series does.
> > >
> > > Can you explain a bit more. I understand you need "Immediate Commands"
> > > but am really reluctant to add another interface to support a specific
> > > use case
> > >
> > 
> > Apologies for the delayed response
> > 
> > BAM supports both regular commands, and "immediate commands". Currently,
> > commands are used by the Qualcom NAND chip driver, while "immediate
> > commands" are intended to be used by the (yet to be mainlined) IPA
> > driver. From the BAM driver perspective, both immediate and regular
> > commands are simply a matter of setting the appropriate flag in the
> > descriptor. I don't have access to the documentation on BAM to know
> > exactly how these two modes differ, however I do know they are not
> > interchangable. If a different API is suggested, I can change the
> > implementation as needed.
>
> Ok, can you please explain what is meant by 'regular' cmd and
> 'immediate', lets see what is required here

I unfortunately don't have access to any documentation that explains the
difference between the two. All I know is that IPA requires using
immediate commands, while the QCOM NAND driver requires using 'regular'
commands.

Regards,
Sireesh
>
> -- 
> ~Vinod


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

* Re: [PATCH v2 0/3] dmaengine: Add support for immediate commands
  2022-11-13 22:23     ` Vinod Koul
  2022-11-24  3:14       ` Sireesh Kodali
@ 2022-11-25 16:50       ` Sireesh Kodali
  1 sibling, 0 replies; 9+ messages in thread
From: Sireesh Kodali @ 2022-11-25 16:50 UTC (permalink / raw)
  To: Vinod Koul
  Cc: linux-kernel, linux-doc, linux-arm-msm, dmaengine,
	~postmarketos/upstreaming

On Mon Nov 14, 2022 at 3:53 AM IST, Vinod Koul wrote:
> On 11-11-22, 10:42, Sireesh Kodali wrote:
> > On Fri Nov 4, 2022 at 6:10 PM IST, Vinod Koul wrote:
> > > On 27-10-22, 10:44, Sireesh Kodali wrote:
> > > > 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. Adding support for immediate commands is trivial, but requires
> > > > also adding Immediate Commands to the dmaengine API, which is what this
> > > > patch series does.
> > >
> > > Can you explain a bit more. I understand you need "Immediate Commands"
> > > but am really reluctant to add another interface to support a specific
> > > use case
> > >
> > 
> > Apologies for the delayed response
> > 
> > BAM supports both regular commands, and "immediate commands". Currently,
> > commands are used by the Qualcom NAND chip driver, while "immediate
> > commands" are intended to be used by the (yet to be mainlined) IPA
> > driver. From the BAM driver perspective, both immediate and regular
> > commands are simply a matter of setting the appropriate flag in the
> > descriptor. I don't have access to the documentation on BAM to know
> > exactly how these two modes differ, however I do know they are not
> > interchangable. If a different API is suggested, I can change the
> > implementation as needed.
>
> Ok, can you please explain what is meant by 'regular' cmd and
> 'immediate', lets see what is required here

Stephan pointed out the APQ8016E TRM has details on BAM. As I understand
it, 'regular' commands are queued register read/writes for the
peripheral. Immediate commands on the other hand seem to be interpreted
by the peripheral's firmware, and don't involve any register
writes/reads from BAM's perspective.

This is what the TRM has to say:

> Immediate (IMM) (only for BAM-NDP): Allows the software to create
> descriptors of type immediate, which does not generate any data
> transmissions or registers configuration, it is simply supplied to the
> peripheral, the peripheral then parses its fields (which are
> irrelevant to the BAM). Only the flags of this descriptor are relevant
> to the BAM, address and size are irrelevant, and BAM simply passes
> them as is to the peripheral. This can be used for the software to
> operate peripheral-specific operations within regular data operations.
> Immediate descriptors are published on the sidebands as 1 byte size
> descriptor, once BAM_NDP fetches an immediate descriptor, it publishes
> all recently fetched descriptors including the immediate descriptor
> with immediate indication, to inform the peripheral that the last
> published descriptor was immediate descriptor.

> Command (CMD) (only for BAM-lite and BAM-NDP): Allows the software to
> create descriptors of type command. Descriptors of type command do not
> generate any data transmissions but configure registers in the
> peripheral (write and read registers operations)

Regards,
Sireesh
>
> -- 
> ~Vinod


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

end of thread, other threads:[~2022-11-25 16:51 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-27  5:14 [PATCH v2 0/3] dmaengine: Add support for immediate commands Sireesh Kodali
2022-10-27  5:14 ` [PATCH v2 1/3] doc: dmaengine: client-api: Add immediate commands in the DMA client API Sireesh Kodali
2022-10-27  5:14 ` [PATCH v2 2/3] dmaengine: Add support for immediate commands in the " Sireesh Kodali
2022-10-27  5:14 ` [PATCH v2 3/3] dmaengine: bam_dma: Add support for immediate commands Sireesh Kodali
2022-11-04 12:40 ` [PATCH v2 0/3] dmaengine: " Vinod Koul
2022-11-11  5:12   ` Sireesh Kodali
2022-11-13 22:23     ` Vinod Koul
2022-11-24  3:14       ` Sireesh Kodali
2022-11-25 16:50       ` 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).