Support for QCOM BAM DMA command descriptor
Subsystems (2)
v2 cover Support for QCOM BAM DMA command descriptor
v2:
1. Added DMA_PREP_CMD flag and used the same for BAM DMA command descriptor
2. Removed custom mapping API patches
v1:
https://www.spinics.net/lists/dmaengine/msg12009.html
These patches mainly add the support for QCOM BAM command descriptor implementing BAM DMA support for some QCOM peripherals like QPIC NAND/LCD.
The BAM command descriptors perform all register reads and writes while data descriptors do the actual data transfer. The QPIC NAND forms the chain of command and data descriptors for full page read/write and submit it to BAM DMA.
Currently there is no flag in DMA API which tells the DMA controller that the passed data is in command descriptor format so added the flag in DMA API for this.
Abhishek Sahu (3):
dmaengine: add DMA_PREP_CMD for non-Data descriptors.
dmaengine: qcom: bam_dma: wrapper functions for command descriptor
dmaengine: qcom: bam_dma: add command descriptor flag
drivers/dma/qcom/bam_dma.c | 6 ++- include/linux/dma/qcom_bam_dma.h | 79 ++++++++++++++++++++++++++++++++++++++++ include/linux/dmaengine.h | 3 ++ 3 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 include/linux/dma/qcom_bam_dma.h
Signature · 1 line
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
PATCH v2 1/3 dmaengine: add DMA_PREP_CMD for non-Data descriptors.
Some of the DMA controllers are capable of issuing the commands to peripheral by the DMA. These commands can be list of register reads/writes and its different from normal data reads/writes. This patch adds new flag DMA_PREP_CMD in DMA API which tells the driver that the data passed to DMA API is in command format and DMA driver will form descriptor in the required format.
This flag can be used by any DMA controller driver which requires special handling for non-Data descriptors.
--- include/linux/dmaengine.h | 3 +++ 1 file changed, 3 insertions(+)
include/linux/dmaengine.h +3 -0
@@ -186,6 +186,8 @@ struct dma_interleaved_template {* on the result of this operation * @DMA_CTRL_REUSE: client can reuse the descriptor and submit again till * cleared or freed +* @DMA_PREP_CMD: tell the driver that the data passed to DMA API is in command +* format and it will be used for configuring the peripheral registers. */ enum dma_ctrl_flags {DMA_PREP_INTERRUPT = (1 <<0 ),
@@ -195,6 +197,7 @@ enum dma_ctrl_flags {DMA_PREP_CONTINUE = (1 <<4 ),DMA_PREP_FENCE = (1 <<5 ),DMA_CTRL_REUSE = (1 <<6 ), + DMA_PREP_CMD = (1 << 7), };/**
Signature · 1 line
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Re: [PATCH v2 1/3] dmaengine: add DMA_PREP_CMD for non-Data descriptors.
Quoted 32 lines · Abhishek Sahu
Some of the DMA controllers are capable of issuing the commands to peripheral by the DMA. These commands can be list of register reads/writes and its different from normal data reads/writes. This patch adds new flag
DMA_PREP_CMDin DMA API which tells the driver that the data passed to DMA API is in command format and DMA driver will form descriptor in the required format.This flag can be used by any DMA controller driver which requires special handling for non-Data descriptors.
Signed-off-by Abhishek Sahu <[email protected]>--- include/linux/dmaengine.h | 3 +++ 1 file changed, 3 insertions(+)include/linux/dmaengine.h +0
-0@@ -186,6 +186,8 @@ struct dma_interleaved_template {* on the result of this operation * @DMA_CTRL_REUSE: client can reuse the descriptor and submit again till
* cleared or freed
+ * @DMA_PREP_CMD: tell the driver that the data passed to DMA API is in command
+ * format and it will be used for configuring the peripheral registers.
*/
enumdma_ctrl_flags{include/linux/dmaengine.h +0
-0DMA_PREP_INTERRUPT = (1 << 0),
include/linux/dmaengine.h enum dma_ctrl_flags { · line 200
Quoted 4 lines
include/linux/dmaengine.h +1
-0@@ -195,6 +197,7 @@ enum dma_ctrl_flags {DMA_PREP_CONTINUE = (1 <<4 ),DMA_PREP_FENCE = (1 <<5 ),DMA_CTRL_REUSE = (1 <<6 ), + DMA_PREP_CMD = (1 << 7),
Hi Vinod/Dan,
Could you please help in reviewing these DMA patches. I have posted QPIC NAND support patches which are dependent upon these DMA patches.
Quoted 3 lines
include/linux/dmaengine.h +0
-0};/**
Signature · 1 line
Abhishek Sahu
Re: [PATCH v2 1/3] dmaengine: add DMA_PREP_CMD for non-Data descriptors.
Quoted 38 lines · Abhishek Sahu
Quoted 30 lines · Abhishek Sahu
Some of the DMA controllers are capable of issuing the commands to peripheral by the DMA. These commands can be list of register reads/writes and its different from normal data reads/writes. This patch adds new flag
DMA_PREP_CMDin DMA API which tells the driver that the data passed to DMA API is in command format and DMA driver will form descriptor in the required format.This flag can be used by any DMA controller driver which requires special handling for non-Data descriptors.
Signed-off-by Abhishek Sahu <[email protected]>---
include/linux/dmaengine.h| 3 +++1 file changed, 3 insertions(+)include/linux/dmaengine.h +1
-0@@ -186,6 +186,8 @@ struct dma_interleaved_template {* on the result of this operation * @DMA_CTRL_REUSE: client can reuse the descriptor and submit again till * cleared or freed +* @DMA_PREP_CMD: tell the driver that the data passed to DMA API is in command
+ * format and it will be used for configuring the peripheral registers. */enum dma_ctrl_flags { DMA_PREP_INTERRUPT = (1 << 0),include/linux/dmaengine.h enum dma_ctrl_flags { · line 200
Quoted 4 lines
include/linux/dmaengine.h +1
-0@@ -195,6 +197,7 @@ enum dma_ctrl_flags {DMA_PREP_CONTINUE = (1 <<4 ),DMA_PREP_FENCE = (1 <<5 ),DMA_CTRL_REUSE = (1 <<6 ), + DMA_PREP_CMD = (1 << 7),Hi Vinod/Dan,
Quoted 3 lines
Could you please help in reviewing these DMA patches. I have posted QPIC NAND support patches which are dependent upon these DMA patches.
Please allow reasonable time for review! This patch series was sent just before the merge window and it closed couple of days back!!
Quoted 10 lines
https://www.spinics.net/lists/kernel/msg2545386.html
Quoted 3 lines
include/linux/dmaengine.h +0
-0};/** Signature · 1 line
Abhishek Sahu
Signature · 1 line
~Vinod
Re: [PATCH v2 1/3] dmaengine: add DMA_PREP_CMD for non-Data descriptors.
Quoted 39 lines · Vinod Koul
Quoted 38 lines · Abhishek Sahu
Quoted 30 lines · Abhishek Sahu
Some of the DMA controllers are capable of issuing the commands to peripheral by the DMA. These commands can be list of register reads/writes and its different from normal data reads/writes. This patch adds new flag
DMA_PREP_CMDin DMA API which tells the driver that the data passed to DMA API is in command format and DMA driver will form descriptor in the required format.This flag can be used by any DMA controller driver which requires special handling for non-Data descriptors.
Signed-off-by Abhishek Sahu <[email protected]>---
include/linux/dmaengine.h| 3 +++1 file changed, 3 insertions(+)include/linux/dmaengine.h +1
-0@@ -186,6 +186,8 @@ struct dma_interleaved_template {* on the result of this operation * @DMA_CTRL_REUSE: client can reuse the descriptor and submit again till * cleared or freed +* @DMA_PREP_CMD: tell the driver that the data passed to DMA API is in command
+ * format and it will be used for configuring the peripheral registers. */enum dma_ctrl_flags { DMA_PREP_INTERRUPT = (1 << 0),include/linux/dmaengine.h enum dma_ctrl_flags { · line 200
Quoted 4 lines
include/linux/dmaengine.h +1
-0@@ -195,6 +197,7 @@ enum dma_ctrl_flags {DMA_PREP_CONTINUE = (1 <<4 ),DMA_PREP_FENCE = (1 <<5 ),DMA_CTRL_REUSE = (1 <<6 ), + DMA_PREP_CMD = (1 << 7),Hi Vinod/Dan,
Quoted 7 lines
Quoted 3 lines
Could you please help in reviewing these DMA patches. I have posted QPIC NAND support patches which are dependent upon these DMA patches.
Please allow reasonable time for review! This patch series was sent just before the merge window and it closed couple of days back!!
Sure Vinod and extremely sorry for my ping.
Since we are adding the flag in generic DMA engine and the complete QPIC NAND support patch series dependent upon this so we were bit concerned about this patch.
Quoted 8 lines
Quoted 8 lines
https://www.spinics.net/lists/kernel/msg2545386.html
Quoted 3 lines
include/linux/dmaengine.h +0
-0};/**
Signature · 1 line
Abhishek Sahu
Re: [PATCH v2 1/3] dmaengine: add DMA_PREP_CMD for non-Data descriptors.
In reply to Abhishek SahuQuoted 9 lines · Abhishek Sahu
Some of the DMA controllers are capable of issuing the commands to peripheral by the DMA. These commands can be list of register reads/writes and its different from normal data reads/writes. This patch adds new flag
DMA_PREP_CMDin DMA API which tells the driver that the data passed to DMA API is in command format and DMA driver will form descriptor in the required format.This flag can be used by any DMA controller driver which requires special handling for non-Data descriptors.
Please add Documentation for this new flag in Documentation/dmaengine/provider.txt
Quoted 11 lines
Signed-off-by Abhishek Sahu <[email protected]>--- include/linux/dmaengine.h | 3 +++ 1 file changed, 3 insertions(+)include/linux/dmaengine.h +0
-0
include/linux/dmaengine.h struct dma_interleaved_template { · line 190
Quoted 5 lines
include/linux/dmaengine.h +2
-0@@ -186,6 +186,8 @@ struct dma_interleaved_template {* on the result of this operation * @DMA_CTRL_REUSE: client can reuse the descriptor and submit again till * cleared or freed +* @DMA_PREP_CMD: tell the driver that the data passed to DMA API is in command +* format and it will be used for configuring the peripheral registers.
Can you explain what is command format..?
Quoted 14 lines
include/linux/dmaengine.h +1
-0*/ enum dma_ctrl_flags {DMA_PREP_INTERRUPT = (1 <<0 ),@@ -195,6 +197,7 @@ enum dma_ctrl_flags {DMA_PREP_CONTINUE = (1 <<4 ),DMA_PREP_FENCE = (1 <<5 ),DMA_CTRL_REUSE = (1 <<6 ), + DMA_PREP_CMD = (1 << 7), };/** Signature · 1 line
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Signature · 1 line
~Vinod
Re: [PATCH v2 1/3] dmaengine: add DMA_PREP_CMD for non-Data descriptors.
Quoted 8 lines · Vinod Koul
Quoted 7 lines · Abhishek Sahu
Some of the DMA controllers are capable of issuing the commands to peripheral by the DMA. These commands can be list of register reads/writes and its different from normal data reads/writes. This patch adds new flag
DMA_PREP_CMDin DMA API which tells the driver that the data passed to DMA API is in command format and DMA driver will form descriptor in the required format.
Quoted 6 lines
Quoted 2 lines
This flag can be used by any DMA controller driver which requires special handling for non-Data descriptors.
Please add Documentation for this new flag in
Documentation/dmaengine/provider.txt
Sure. I will add update the documentation in v3.
Quoted 6 lines
Quoted 6 lines
Signed-off-by Abhishek Sahu <[email protected]>--- include/linux/dmaengine.h | 3 +++ 1 file changed, 3 insertions(+)
Quoted 16 lines
Quoted 7 lines
include/linux/dmaengine.h +0
-0@@ -186,6 +186,8 @@ struct dma_interleaved_template {* on the result of this operation * @DMA_CTRL_REUSE: client can reuse the descriptor and submit again Quoted 6 lines
till
* cleared or freed
+ * @DMA_PREP_CMD: tell the driver that the data passed to DMA API is in command
+ * format and it will be used for configuring the peripheral registers.Can you explain what is command format..?
The command format is not generic and its format will be dependent upon DMA engine. The client drivers will give data in its own command formats and this flag will be passed to DMA API’s to do the parsing according to its own command format.
Currently this flag description and name is inclined towards Qualcomm BAM DMA command flag. We want to make this flag as generic one so require your suggestion regarding this. Will renaming this flag as DMA_PREP_NON_DATA or DMA_PREP_CUSTOM make it more generic?
Quoted 14 lines
Quoted 14 lines
*/
enumdma_ctrl_flags{include/linux/dmaengine.h +1
-1DMA_PREP_INTERRUPT = (1 << 0),@@ -195,6 +197,7 @@ enum dma_ctrl_flags {DMA_PREP_CONTINUE = (1 <<4 ),DMA_PREP_FENCE = (1 <<5 ),DMA_CTRL_REUSE = (1 <<6 ), + DMA_PREP_CMD = (1 << 7), };/** -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Signature · 1 line
Abhishek Sahu
Re: [PATCH v2 1/3] dmaengine: add DMA_PREP_CMD for non-Data descriptors.
Quoted 46 lines · Abhishek Sahu
Quoted 8 lines · Vinod Koul
Quoted 7 lines · Abhishek Sahu
Some of the DMA controllers are capable of issuing the commands to peripheral by the DMA. These commands can be list of register reads/writes and its different from normal data reads/writes. This patch adds new flag
DMA_PREP_CMDin DMA API which tells the driver that the data passed to DMA API is in command format and DMA driver will form descriptor in the required format.Quoted 6 lines
Quoted 2 lines
This flag can be used by any DMA controller driver which requires special handling for non-Data descriptors.
Please add Documentation for this new flag in
Documentation/dmaengine/provider.txtSure. I will add update the documentation in v3.
Quoted 6 lines
Quoted 6 lines
Signed-off-by Abhishek Sahu <[email protected]>--- include/linux/dmaengine.h | 3 +++ 1 file changed, 3 insertions(+)Quoted 16 lines
Quoted 7 lines
include/linux/dmaengine.h +0
-0@@ -186,6 +186,8 @@ struct dma_interleaved_template {* on the result of this operation * @DMA_CTRL_REUSE: client can reuse the descriptor and submit again Quoted 6 lines
till
* cleared or freed
+ * @DMA_PREP_CMD: tell the driver that the data passed to DMA API is in command
+ * format and it will be used for configuring the peripheral registers.Can you explain what is command format..?
The command format is not generic and its format will be dependent upon DMA engine. The client drivers will give data in its own command formats and this flag will be passed to DMA API’s to do the parsing according to its own command format.
Quoted 6 lines
Currently this flag description and name is inclined towards Qualcomm BAM DMA command flag. We want to make this flag as generic one so require your suggestion regarding this. Will renaming this flag as
DMA_PREP_NON_DATAorDMA_PREP_CUSTOMmake it more generic?
can we use same flag name DMA_PREP_CMD or should we go for some other name?
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
*/
enumdma_ctrl_flags{include/linux/dmaengine.h +1
-0DMA_PREP_INTERRUPT = (1 << 0),@@ -195,6 +197,7 @@ enum dma_ctrl_flags {DMA_PREP_CONTINUE = (1 <<4 ),DMA_PREP_FENCE = (1 <<5 ),DMA_CTRL_REUSE = (1 <<6 ), + DMA_PREP_CMD = (1 << 7), };
Signature · 1 line
Abhishek Sahu
Re: [PATCH v2 1/3] dmaengine: add DMA_PREP_CMD for non-Data descriptors.
Quoted 54 lines · Abhishek Sahu
Quoted 46 lines · Abhishek Sahu
Quoted 8 lines · Vinod Koul
Quoted 7 lines · Abhishek Sahu
Some of the DMA controllers are capable of issuing the commands to peripheral by the DMA. These commands can be list of register reads/writes and its different from normal data reads/writes. This patch adds new flag
DMA_PREP_CMDin DMA API which tells the driver that the data passed to DMA API is in command format and DMA driver will form descriptor in the required format.Quoted 6 lines
Quoted 2 lines
This flag can be used by any DMA controller driver which requires special handling for non-Data descriptors.
Please add Documentation for this new flag in
Documentation/dmaengine/provider.txtSure. I will add update the documentation in v3.
Quoted 6 lines
Quoted 6 lines
Signed-off-by Abhishek Sahu <[email protected]>---
include/linux/dmaengine.h| 3 +++1 file changed, 3 insertions(+)Quoted 16 lines
Quoted 7 lines
include/linux/dmaengine.h +0
-0@@ -186,6 +186,8 @@ struct dma_interleaved_template {* on the result of this operation * @DMA_CTRL_REUSE: client can reuse the descriptor and submit again Quoted 6 lines
till
* cleared or freed
+ * @DMA_PREP_CMD: tell the driver that the data passed to DMA API is in command
+ * format and it will be used for configuring the peripheral registers.Can you explain what is command format..?
The command format is not generic and its format will be dependent upon DMA engine. The client drivers will give data in its own command formats and this flag will be passed to DMA API’s to do the parsing according to its own command format.
Quoted 6 lines
Currently this flag description and name is inclined towards Qualcomm BAM DMA command flag. We want to make this flag as generic one so require your suggestion regarding this. Will renaming this flag as
DMA_PREP_NON_DATAorDMA_PREP_CUSTOMmake it more generic?
Quoted 2 lines
can we use same flag name
DMA_PREP_CMDor should we go for some other name?
Are you asking for using DMA_PREP_CMD, for that I think should be ok
If you asking about adding a new flag with DMA_PREP_CMD, then it would no
Quoted 15 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
*/
enum dma_ctrl_flags { DMA_PREP_INTERRUPT = (1 << 0),include/linux/dmaengine.h +1
-0@@ -195,6 +197,7 @@ enum dma_ctrl_flags {DMA_PREP_CONTINUE = (1 <<4 ),DMA_PREP_FENCE = (1 <<5 ),DMA_CTRL_REUSE = (1 <<6 ), + DMA_PREP_CMD = (1 << 7), };Signature · 1 line
Abhishek Sahu
Signature · 1 line
~Vinod
Re: [PATCH v2 1/3] dmaengine: add DMA_PREP_CMD for non-Data descriptors.
Quoted 55 lines · Vinod Koul
Quoted 54 lines · Abhishek Sahu
Quoted 52 lines · Abhishek Sahu
Quoted 8 lines · Vinod Koul
Quoted 7 lines · Abhishek Sahu
Some of the DMA controllers are capable of issuing the commands to peripheral by the DMA. These commands can be list of register reads/writes and its different from normal data reads/writes. This patch adds new flag
DMA_PREP_CMDin DMA API which tells the driver that the data passed to DMA API is in command format and DMA driver will form descriptor in the required format.Quoted 6 lines
Quoted 2 lines
This flag can be used by any DMA controller driver which requires special handling for non-Data descriptors.
Please add Documentation for this new flag in
Documentation/dmaengine/provider.txtSure. I will add update the documentation in v3.
Quoted 6 lines
Quoted 6 lines
Signed-off-by Abhishek Sahu <[email protected]>---
include/linux/dmaengine.h| 3 +++1 file changed, 3 insertions(+)Quoted 16 lines
Quoted 7 lines
include/linux/dmaengine.h +0
-0@@ -186,6 +186,8 @@ struct dma_interleaved_template {* on the result of this operation * @DMA_CTRL_REUSE: client can reuse the descriptor and submit again Quoted 6 lines
till
* cleared or freed
+ * @DMA_PREP_CMD: tell the driver that the data passed to DMA API is in command
+ * format and it will be used for configuring the peripheral registers.Can you explain what is command format..?
The command format is not generic and its format will be dependent upon DMA engine. The client drivers will give data in its own command formats and this flag will be passed to DMA API’s to do the parsing according to its own command format.
Currently this flag description and name is inclined towards Qualcomm BAM DMA command flag. We want to make this flag as generic one so require your suggestion regarding this. Will renaming this flag as
DMA_PREP_NON_DATAorDMA_PREP_CUSTOMmake it more generic?
Quoted 7 lines
Quoted 2 lines
can we use same flag name
DMA_PREP_CMDor should we go for some other name?Are you asking for using
DMA_PREP_CMD, for that I think should be okIf you asking about adding a new flag with
DMA_PREP_CMD, then it would no
Thanks Vinod.
We just want to add only one flag with name DMA_PREP_CMD and no other new flag.
I will update the description for DMA_PREP_CMD in Documentation/dmaengine/provider.txt
Quoted 12 lines
Quoted 12 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
*/
enum dma_ctrl_flags { DMA_PREP_INTERRUPT = (1 << 0),include/linux/dmaengine.h +1
-0@@ -195,6 +197,7 @@ enum dma_ctrl_flags {DMA_PREP_CONTINUE = (1 <<4 ),DMA_PREP_FENCE = (1 <<5 ),DMA_CTRL_REUSE = (1 <<6 ), + DMA_PREP_CMD = (1 << 7), };
Re: [PATCH v2 1/3] dmaengine: add DMA_PREP_CMD for non-Data descriptors.
In reply to Vinod KoulQuoted 55 lines · Vinod Koul
Quoted 54 lines · Abhishek Sahu
Quoted 52 lines · Abhishek Sahu
Quoted 8 lines · Vinod Koul
Quoted 7 lines · Abhishek Sahu
Some of the DMA controllers are capable of issuing the commands to peripheral by the DMA. These commands can be list of register reads/writes and its different from normal data reads/writes. This patch adds new flag
DMA_PREP_CMDin DMA API which tells the driver that the data passed to DMA API is in command format and DMA driver will form descriptor in the required format.Quoted 6 lines
Quoted 2 lines
This flag can be used by any DMA controller driver which requires special handling for non-Data descriptors.
Please add Documentation for this new flag in
Documentation/dmaengine/provider.txtSure. I will add update the documentation in v3.
Quoted 6 lines
Quoted 6 lines
Signed-off-by Abhishek Sahu <[email protected]>---
include/linux/dmaengine.h| 3 +++1 file changed, 3 insertions(+)Quoted 16 lines
Quoted 7 lines
include/linux/dmaengine.h +0
-0@@ -186,6 +186,8 @@ struct dma_interleaved_template {* on the result of this operation * @DMA_CTRL_REUSE: client can reuse the descriptor and submit again Quoted 6 lines
till
* cleared or freed
+ * @DMA_PREP_CMD: tell the driver that the data passed to DMA API is in command
+ * format and it will be used for configuring the peripheral registers.Can you explain what is command format..?
The command format is not generic and its format will be dependent upon DMA engine. The client drivers will give data in its own command formats and this flag will be passed to DMA API’s to do the parsing according to its own command format.
Currently this flag description and name is inclined towards Qualcomm BAM DMA command flag. We want to make this flag as generic one so require your suggestion regarding this. Will renaming this flag as
DMA_PREP_NON_DATAorDMA_PREP_CUSTOMmake it more generic?
Quoted 6 lines
Quoted 2 lines
can we use same flag name
DMA_PREP_CMDor should we go for some other name?Are you asking for using
DMA_PREP_CMD, for that I think should be okIf you asking about adding a new flag with
DMA_PREP_CMD, then it would no
Vinod, I wonder if we should introduce a DMA_PREP_CUSTOM flag and then reserve X number of upper flag bits to vendor specified that only they care about. That way they can define whatever they want in the upper bits if they need it.
Quoted 17 lines
Quoted 16 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
*/
enum dma_ctrl_flags { DMA_PREP_INTERRUPT = (1 << 0),include/linux/dmaengine.h +1
-0@@ -195,6 +197,7 @@ enum dma_ctrl_flags {DMA_PREP_CONTINUE = (1 <<4 ),DMA_PREP_FENCE = (1 <<5 ),DMA_CTRL_REUSE = (1 <<6 ), + DMA_PREP_CMD = (1 << 7), };Signature · 1 line
Abhishek Sahu
Re: [PATCH v2 1/3] dmaengine: add DMA_PREP_CMD for non-Data descriptors.
Quoted 11 lines · Dave Jiang
Quoted 4 lines · Vinod Koul
Are you asking for using
DMA_PREP_CMD, for that I think should be okIf you asking about adding a new flag with
DMA_PREP_CMD, then it would noVinod, I wonder if we should introduce a
DMA_PREP_CUSTOMflag and then reserve X number of upper flag bits to vendor specified that only they care about. That way they can define whatever they want in the upper bits if they need it.
Nah, that just leads to abuse :( So lets keep adding the flags generically as and when we need them..
Signature · 1 line
~Vinod
PATCH v2 2/3 dmaengine: qcom: bam_dma: wrapper functions for command descriptor
In reply to Abhishek SahuQCOM BAM also supports command descriptor which allows the SW to create descriptors of type command which does not generate any data transmissions but configures registers in the peripheral. In command descriptor the 32bit address point to the start of the command block which holds the command elements and the 16bit size define the size of the command block.
Each Command Element is structured by 4 words:
Write command: address + cmd
register data
register mask
reserved
Read command: address + cmd
read data result address,
reserved
reserved
This patch creates a new header file for BAM driver which contains the structures and wrapper functions for command descriptor. This file will be used by different QCOM peripheral drivers for forming the command descriptor
--- include/linux/dma/qcom_bam_dma.h | 79 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 include/linux/dma/qcom_bam_dma.h
include/linux/dma/qcom_bam_dma.h new file +79 -0
@@ -0,0 +1,79 @@ +/* +* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved. +* +* This software is licensed under the terms of the GNU General Public +* License version 2, as published by the Free Software Foundation, and +* may be copied, distributed, and modified under those terms. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ + +#ifndef _QCOM_BAM_DMA_H +#define _QCOM_BAM_DMA_H + +#include <asm/byteorder.h> + +/* +* This data type corresponds to the native Command Element +* supported by BAM DMA Engine. +* +* @cmd_and_addr - upper 8 bits command and lower 24 bits register address. +* @data - for write command: content to be written into peripheral register. +* for read command: dest addr to write peripheral register value. +* @mask - register mask. +* @reserved - for future usage. +* +*/ +struct bam_cmd_element { +__le32 cmd_and_addr; +__le32 data; +__le32 mask; +__le32 reserved; +}; + +/* +* This enum indicates the command type in a command element +*/ +enum bam_command_type { +BAM_WRITE_COMMAND =0 , +BAM_READ_COMMAND , +}; + +/* +* prep_bam_ce_le32 - Wrapper function to prepare a single BAM command +* element with the data already in le32 format. +* +* @bam_ce: bam command element +* @addr: target address +* @cmd: BAM command +* @data: actual data for write and dest addr for read in le32 +*/ +static inline void +bam_prep_ce_le32 (struct bam_cmd_element *bam_ce,u32 addr, +enum bam_command_type cmd,__le32 data) +{ + bam_ce->cmd_and_addr = +cpu_to_le32 ((addr &0xffffff ) | ((cmd &0xff ) <<24 )); + bam_ce->data = data; + bam_ce->mask =cpu_to_le32 (0xffffffff ); +} + +/* +* bam_prep_ce - Wrapper function to prepare a single BAM command element +* with the data. +* +* @bam_ce: BAM command element +* @addr: target address +* @cmd: BAM command +* @data: actual data for write and dest addr for read +*/ +static inline void +bam_prep_ce (struct bam_cmd_element *bam_ce,u32 addr, +enum bam_command_type cmd,u32 data) +{ +bam_prep_ce_le32 (bam_ce, addr, cmd,cpu_to_le32 (data)); +} +#endif
Signature · 1 line
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Re: [PATCH v2 2/3] dmaengine: qcom: bam_dma: wrapper functions for command descriptor
Quoted 87 lines · Abhishek Sahu
QCOM BAM also supports command descriptor which allows the SW to create descriptors of type command which does not generate any data transmissions but configures registers in the peripheral. In command descriptor the 32bit address point to the start of the command block which holds the command elements and the 16bit size define the size of the command block.
Each Command Element is structured by 4 words:
Write command: address + cmd
register data
register mask
reservedRead command: address + cmd
read data result address,
reserved
reservedThis patch creates a new header file for BAM driver which contains the structures and wrapper functions for command descriptor. This file will be used by different QCOM peripheral drivers for forming the command descriptor
Signed-off-by Abhishek Sahu <[email protected]>--- include/linux/dma/qcom_bam_dma.h | 79 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 include/linux/dma/qcom_bam_dma.hinclude/linux/dma/qcom_bam_dma.h new file +52
-0@@ -0,0 +1,79 @@ +/* +* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved. +* +* This software is licensed under the terms of the GNU General Public +* License version 2, as published by the Free Software Foundation, and +* may be copied, distributed, and modified under those terms. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ + +#ifndef _QCOM_BAM_DMA_H +#define _QCOM_BAM_DMA_H + +#include <asm/byteorder.h> + +/* +* This data type corresponds to the native Command Element +* supported by BAM DMA Engine. +* +* @cmd_and_addr - upper 8 bits command and lower 24 bits register address. +* @data - for write command: content to be written into peripheral register. +* for read command: dest addr to write peripheral register value. +* @mask - register mask. +* @reserved - for future usage. +* +*/ +struct bam_cmd_element { +__le32 cmd_and_addr; +__le32 data; +__le32 mask; +__le32 reserved; +}; + +/* +* This enum indicates the command type in a command element +*/ +enum bam_command_type { +BAM_WRITE_COMMAND =0 , +BAM_READ_COMMAND , +}; + +/* +* prep_bam_ce_le32 - Wrapper function to prepare a single BAM command +* element with the data already in le32 format. +* +* @bam_ce: bam command element +* @addr: target address +* @cmd: BAM command +* @data: actual data for write and dest addr for read in le32
include/linux/dma/qcom_bam_dma.h line 62
Quoted 10 lines
include/linux/dma/qcom_bam_dma.h new file +10
-0+*/ +static inline void +bam_prep_ce_le32 (struct bam_cmd_element *bam_ce,u32 addr, +enum bam_command_type cmd,__le32 data) +{ + bam_ce->cmd_and_addr = +cpu_to_le32 ((addr &0xffffff ) | ((cmd &0xff ) <<24 )); + bam_ce->data = data; + bam_ce->mask =cpu_to_le32 (0xffffffff ); +}
Is this being used by clients?
Quoted 20 lines
include/linux/dma/qcom_bam_dma.h new file +17
-0+ +/* +* bam_prep_ce - Wrapper function to prepare a single BAM command element +* with the data. +* +* @bam_ce: BAM command element +* @addr: target address +* @cmd: BAM command +* @data: actual data for write and dest addr for read +*/ +static inline void +bam_prep_ce (struct bam_cmd_element *bam_ce,u32 addr, +enum bam_command_type cmd,u32 data) +{ +bam_prep_ce_le32 (bam_ce, addr, cmd,cpu_to_le32 (data)); +} +#endif Signature · 1 line
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Signature · 1 line
~Vinod
Re: [PATCH v2 2/3] dmaengine: qcom: bam_dma: wrapper functions for command descriptor
Quoted 99 lines · Vinod Koul
Quoted 98 lines · Abhishek Sahu
QCOM BAM also supports command descriptor which allows the SW to create descriptors of type command which does not generate any data transmissions but configures registers in the peripheral. In command descriptor the 32bit address point to the start of the command block which holds the command elements and the 16bit size define the size of the command block.
Each Command Element is structured by 4 words:
Write command: address + cmd
register data
register mask
reservedRead command: address + cmd
read data result address,
reserved
reservedThis patch creates a new header file for BAM driver which contains the structures and wrapper functions for command descriptor. This file will be used by different QCOM peripheral drivers for forming the command descriptor
Signed-off-by Abhishek Sahu <[email protected]>--- include/linux/dma/qcom_bam_dma.h | 79 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 include/linux/dma/qcom_bam_dma.hinclude/linux/dma/qcom_bam_dma.h new file +2
-0@@ -0,0 +1,79 @@ +/* +* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */include/linux/dma/qcom_bam_dma.h new file +11
-0+ +#ifndef _QCOM_BAM_DMA_H +#define _QCOM_BAM_DMA_H + +#include <asm/byteorder.h> + +/* +* This data type corresponds to the native Command Element +* supported by BAM DMA Engine. +* +* @cmd_and_addr - upper 8 bits command and lower 24 bits register address.
+ * @data - for write command: content to be written into peripheral register.
+ * for read command: dest addr to write peripheral register value.
+ * @mask - register mask.
+ * @reserved - for future usage.
+ *
+ */include/linux/dma/qcom_bam_dma.h new file +17
-0+struct bam_cmd_element { +__le32 cmd_and_addr; +__le32 data; +__le32 mask; +__le32 reserved; +}; + +/* +* This enum indicates the command type in a command element +*/ +enum bam_command_type { +BAM_WRITE_COMMAND =0 , +BAM_READ_COMMAND , +}; + +/* +* prep_bam_ce_le32 - Wrapper function to prepare a single BAM command
+ * element with the data already in le32 format.
+ *
+ * @bam_ce: bam command element
+ * @addr: target address
+ * @cmd: BAM command
+ * @data: actual data for write and dest addr for read in le32
+ */include/linux/dma/qcom_bam_dma.h new file +3
-0+static inline void +bam_prep_ce_le32 (struct bam_cmd_element *bam_ce,u32 addr, +enum bam_command_type cmd,__le32 data)
Quoted 9 lines
include/linux/dma/qcom_bam_dma.h line 62
Quoted 6 lines
include/linux/dma/qcom_bam_dma.h new file +6
-0+{ + bam_ce->cmd_and_addr = +cpu_to_le32 ((addr &0xffffff ) | ((cmd &0xff ) <<24 )); + bam_ce->data = data; + bam_ce->mask =cpu_to_le32 (0xffffffff ); +}Is this being used by clients?
Yes Vinod. This wrapper function will be called by clients. NAND driver will call this function for reading/writing registers from BAM DMA.
Following is the NAND client driver patch
http://www.spinics.net/lists/devicetree/msg183713.html
Quoted 21 lines
Quoted 21 lines
include/linux/dma/qcom_bam_dma.h new file +3
-0+ +/* +* bam_prep_ce - Wrapper function to prepare a single BAM command element
+ * with the data.
+ *
+ * @bam_ce: BAM command element
+ * @addr: target address
+ * @cmd: BAM command
+ * @data: actual data for write and dest addr for read
+ */include/linux/dma/qcom_bam_dma.h new file +7
-1+static inline void +bam_prep_ce (struct bam_cmd_element *bam_ce,u32 addr, +enum bam_command_type cmd,u32 data) +{ +bam_prep_ce_le32 (bam_ce, addr, cmd,cpu_to_le32 (data)); +} +#endif --QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Signature · 1 line
Abhishek Sahu
PATCH v2 3/3 dmaengine: qcom: bam_dma: add command descriptor flag
In reply to Abhishek SahuIf DMA_PREP_CMD flag is passed in prep_slave_sg then peripheral driver has passed the data is in BAM command descriptor format and BAM driver should set CMD bit for each of the HW descriptors.
--- drivers/dma/qcom/bam_dma.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/dma/qcom/bam_dma.c +5 -1
@@ -65,6 +65,7 @@ struct bam_desc_hw {#define DESC_FLAG_EOT BIT(14)#define DESC_FLAG_EOB BIT(13)#define DESC_FLAG_NWD BIT(12) +#define DESC_FLAG_CMD BIT(11)struct bam_async_desc {struct virt_dma_desc vd;
@@ -645,6 +646,9 @@ static struct dma_async_tx_descriptor *bam_prep_slave_sg(struct dma_chan *chan,unsigned int curr_offset =0 ; do { + if (flags & DMA_PREP_CMD) + desc->flags |= cpu_to_le16(DESC_FLAG_CMD); + desc->addr = cpu_to_le32(sg_dma_address(sg) + curr_offset);
@@ -960,7 +964,7 @@ static void bam_start_dma(struct bam_chan *bchan)/* set any special flags on the last descriptor */ if (async_desc->num_desc == async_desc->xfer_len) - desc[async_desc->xfer_len -1 ].flags = + desc[async_desc->xfer_len -1 ].flags |=cpu_to_le16 (async_desc->flags);else desc[async_desc->xfer_len - 1].flags |=
Signature · 1 line
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation