dmaengine: Add support for immediate commands
Subsystems (3)
v2 cover dmaengine: Add support for immediate commands
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(+)
Signature · 1 line
2.38.1
PATCH v2 1/3 doc: dmaengine: client-api: Add immediate commands in the DMA client API
Immediate commands are used by the IPA driver to send commands to the microcontroller over BAM. These are different from PREP_CMD.
--- Documentation/driver-api/dmaengine/provider.rst | 10 ++++++++++ 1 file changed, 10 insertions(+)
Documentation/driver-api/dmaengine/provider.rst +10 -0
@@ -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
Signature · 1 line
2.38.1
PATCH v2 2/3 dmaengine: Add support for immediate commands in the client API
In reply to Sireesh KodaliImmediate commands are needed by the IPA network driver, so that it can send commands via BAM to the IPA microcontroller.
--- include/linux/dmaengine.h | 4 ++++ 1 file changed, 4 insertions(+)
include/linux/dmaengine.h +4 -0
@@ -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), };/**
Signature · 1 line
2.38.1
PATCH v2 3/3 dmaengine: bam_dma: Add support for immediate commands
In reply to Sireesh KodaliImmediate 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.
--- drivers/dma/qcom/bam_dma.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/dma/qcom/bam_dma.c +3 -0
@@ -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);
Signature · 1 line
2.38.1
Vinod Koul
maintainerQuoted 7 lines · 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.
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
Quoted 14 lines
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 commandsDocumentation/driver-api/dmaengine/provider.rst | 10 ++++++++++ drivers/dma/qcom/bam_dma.c | 3 +++ include/linux/dmaengine.h | 4 ++++ 3 files changed, 17 insertions(+)Signature · 1 line
2.38.1
Signature · 1 line
~Vinod
Quoted 9 lines · Vinod Koul
Quoted 7 lines · 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.
Quoted 4 lines
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
Quoted 17 lines
Quoted 14 lines
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 commandsDocumentation/driver-api/dmaengine/provider.rst | 10 ++++++++++ drivers/dma/qcom/bam_dma.c | 3 +++ include/linux/dmaengine.h | 4 ++++ 3 files changed, 17 insertions(+)Signature · 1 line
2.38.1Signature · 1 line
~Vinod
Vinod Koul
maintainerQuoted 17 lines · Sireesh Kodali
Quoted 9 lines · Vinod Koul
Quoted 7 lines · 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.
Quoted 4 lines
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
Quoted 9 lines
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
Signature · 1 line
~Vinod
Quoted 28 lines · Vinod Koul
Quoted 17 lines · Sireesh Kodali
Quoted 9 lines · Vinod Koul
Quoted 7 lines · 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.
Quoted 4 lines
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
Quoted 9 lines
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.
Quoted 2 lines
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
Quoted 3 lines
Signature · 2 lines
-- ~Vinod
Quoted 28 lines · Vinod Koul
Quoted 17 lines · Sireesh Kodali
Quoted 9 lines · Vinod Koul
Quoted 7 lines · 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.
Quoted 4 lines
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
Quoted 9 lines
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.
Quoted 2 lines
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:
Quoted 14 lines
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_NDPfetches 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.
Quoted 4 lines
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
Quoted 3 lines
Signature · 2 lines
-- ~Vinod