DMAEngine: Add DMAEngine driver based on old MSM DMA APIs
Subsystems (4)
PATCH v3 2/2 DMAEngine: Add DMAEngine driver based on old MSM DMA APIs
Add DMAEngine based driver using the old MSM DMA APIs internally. The benefit of this approach is that not all the drivers have to get converted to DMAEngine APIs simultaneosly while both the drivers can stay enabled in the kernel. The client drivers using the old MSM APIs directly can now convert to DMAEngine one by one.
--- arch/arm/mach-msm/include/mach/dma.h | 30 ++ drivers/dma/Kconfig | 12 + drivers/dma/Makefile | 1 + drivers/dma/msm-dma.c | 724 ++++++++++++++++++++++++++++++++++ 4 files changed, 767 insertions(+), 0 deletions(-) create mode 100644 drivers/dma/msm-dma.c
arch/arm/mach-msm/include/mach/dma.h +30 -0
@@ -18,6 +18,36 @@#include <linux/list.h> #include <mach/msm_iomap.h> +#define sg_dma_offset (sg) ((sg)->offset) +#define box_dma_row_address (box) ((box)->dma_row_address) +#define box_dma_row_len (box) ((box)->dma_row_len) +#define box_dma_row_num (box) ((box)->dma_row_num) +#define box_dma_row_offset (box) ((box)->dma_row_offset) + +#define MSM_DMA_CMD_MASK 0x9FFF8 +#define MSM_DMA_CMD_SHIFT 0 +#define MSM_BOX_SRC_RLEN_MASK 0xFFFF +#define MSM_BOX_SRC_RLEN_SHIFT 16 +#define MSM_BOX_SRC_RNUM_MASK 0xFFFF +#define MSM_BOX_SRC_RNUM_SHIFT 16 +#define MSM_BOX_SRC_ROFFSET_MASK 0xFFFF +#define MSM_BOX_SRC_ROFFSET_SHIFT 16 +#define MSM_BOX_DST_RLEN_MASK 0xFFFF +#define MSM_BOX_DST_RNUM_MASK 0xFFFF +#define MSM_BOX_DST_ROFFSET_MASK 0xFFFF +#define MSM_BOX_MODE_CMD 0x3 + +enum adm_flush_type { +ADM_FORCED_FLUSH , +ADM_GRACEFUL_FLUSH , +}; + +enum adm_dma_type { +ADM_SINGLE_MODE , +ADM_SG_MODE , +ADM_BOX_MODE , +}; +struct msm_dmov_errdata {uint32_t flush[6 ]; };
drivers/dma/Kconfig +12 -0
@@ -252,6 +252,18 @@ config EP93XX_DMA help Enable support for the Cirrus Logic EP93xx M2P/M2M DMA controller. +config MSM_DMA + tristate "Qualcomm MSM DMA support" + depends on ARCH_MSM + select DMA_ENGINE + help + Support the Qualcomm DMA engine. This engine is integrated into + Qualcomm chips. + + Say Y here if you have such a chipset. + + If unsure, say N. + config DMA_ENGINE bool
drivers/dma/Makefile +1 -0
@@ -19,6 +19,7 @@ obj-$(CONFIG_COH901318) += coh901318.o coh901318_lli.o obj-$(CONFIG_AMCC_PPC440SPE_ADMA) += ppc4xx/ obj-$(CONFIG_IMX_SDMA) += imx-sdma.o obj-$(CONFIG_IMX_DMA) += imx-dma.o +obj-$(CONFIG_MSM_DMA) += msm-dma.o obj-$(CONFIG_MXS_DMA) += mxs-dma.o obj-$(CONFIG_TIMB_DMA) += timb_dma.o obj-$(CONFIG_SIRF_DMA) += sirf-dma.o
drivers/dma/msm-dma.c new file +724 -0
724 lines not on this page · raw message
Signature · 2 lines
Sent by a consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
Quoted 1 line · Ravi Kumar V
Add DMAEngine based driver using the old MSM DMA APIs internally.
What do you mean by this?
Quoted 5 lines
The benefit of this approach is that not all the drivers have to get converted to DMAEngine APIs simultaneosly while both the drivers can stay enabled in the kernel. The client drivers using the old MSM APIs directly can now convert to DMAEngine one by one.
Which drivers?
Daniel
Quoted 5 lines · Daniel Walker
Quoted 1 line · Ravi Kumar V
Add DMAEngine based driver using the old MSM DMA APIs internally.
What do you mean by this?
There is a MSM DMA driver in arch/arm/mach-msm/ which is not in dmaengine framework standards, but that driver is been used by client drivers nand, eMMC and serial drivers. Now if we implement the whole dma driver using dmaengine framework then nand, eMMC like drivers will be failed as they are using old dma driver API's, so instead of implementing new driver from scratch we are keeping the old dma API's as it is and using those API's in new dmaengine framework.So that we can convert clients drivers to use dma engine framework.
Quoted 7 lines
Quoted 5 lines
The benefit of this approach is that not all the drivers have to get converted to DMAEngine APIs simultaneosly while both the drivers can stay enabled in the kernel. The client drivers using the old MSM APIs directly can now convert to DMAEngine one by one.
Which drivers?
client drivers which are using dma.
Quoted 7 lines
Daniel
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Signature · 2 lines
Sent by a consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
Quoted 2 lines · Shantanu Gupta
Any info available(publicly) on so as to what all chipsets have this capability ?
The ADM hardware is in every currently available MSM that can run Linux. It is being phased out, to be replaced by a new DMA system (SPS/BAM). Fortunately, there are some chips (MSM8960) that have both ADM and SPS/BAM so there should be time to get those drivers in.
At least as my memory serves me:
7201 - ADM
8250 - ADM
8660 - 2 ADMs, SPS/BAM
8960 - 1 ADM, SPS/BAM
The ADM is mostly a regular DMA-type device. Each channel can be associated with a rate-control channel, which is needed for some devices. It also has a mode called "box mode", which works kind of like a self-repeating scatter list. This mode is needed for some of the peripherals also on the MSM.
David
Quoted 22 lines · Daniel Walker
On Mon, Mar 12, 2012 at 04:02:44PM +0530, Ravi Kumar V wrote:
> Add DMAEngine based driver using the old MSM DMA APIs internally.What do you mean by this?
> The benefit of this approach is that not all the drivers > have to get converted to DMAEngine APIs simultaneosly while > both the drivers can stay enabled in the kernel. The client > drivers using the old MSM APIs directly can now convert to > DMAEngine one by one.
Which drivers?
Daniel
--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
Quoted 6 lines · Ravi Kumar V
Quoted 5 lines · Daniel Walker
Quoted 1 line · Ravi Kumar V
Add DMAEngine based driver using the old MSM DMA APIs internally.
What do you mean by this?
Quoted 9 lines
There is a MSM DMA driver in
arch/arm/mach-msm/which is not in dmaengine framework standards, but that driver is been used by client drivers nand, eMMC and serial drivers. Now if we implement the whole dma driver using dmaengine framework then nand, eMMC like drivers will be failed as they are using old dma driver API's, so instead of implementing new driver from scratch we are keeping the old dma API's as it is and using those API's in new dmaengine framework.So that we can convert clients drivers to use dma engine framework.
Did you investigate converting the drivers (nand, eMMC, serial) ? It seems like there would be a 1:1 mapping between the API's , so it might only be a find->replace operation.
Daniel
Quoted 4 lines
[...]
drivers/dma/msm-dma.c new file +3
-0+ +struct dma_async_tx_descriptor *msm_dma_prep_interleaved(struct dma_chan *dchan, + struct dma_interleaved_template *xt,
drivers/dma/msm-dma.c line 500
Quoted 10 lines
drivers/dma/msm-dma.c new file +10
-0+ unsigned long flags, void *context) +{ + + struct msm_dma_chan *chan; +struct msm_dma_desc_sw *new; +struct adm_box_cmd_t *box_cmd_vaddr; +u32 *cmd_cntrl = context; + +if (!dchan) +return ERR_PTR (-EINVAL );
This is supposed to return either NULL or a valid descriptor.
Quoted 4 lines
drivers/dma/msm-dma.c new file +3
-0+ +if (!xt) +return ERR_PTR (-EINVAL );[...
Quoted 17 lines · Daniel Walker
Quoted 6 lines · Ravi Kumar V
Quoted 5 lines · Daniel Walker
Quoted 1 line · Ravi Kumar V
Add DMAEngine based driver using the old MSM DMA APIs internally.
What do you mean by this?
Quoted 9 lines
There is a MSM DMA driver in
arch/arm/mach-msm/which is not in dmaengine framework standards, but that driver is been used by client drivers nand, eMMC and serial drivers. Now if we implement the whole dma driver using dmaengine framework then nand, eMMC like drivers will be failed as they are using old dma driver API's, so instead of implementing new driver from scratch we are keeping the old dma API's as it is and using those API's in new dmaengine framework.So that we can convert clients drivers to use dma engine framework.
Quoted 3 lines
Did you investigate converting the drivers (nand, eMMC, serial) ? It seems like there would be a 1:1 mapping between the API's , so it might only be a
find->replaceoperation.
Only at a very superficial level--they both do DMA. The ADM driver wants its scatterlists constructed manually by the caller (in DMA-able memory) and just the pointer handed over. The drivers will have to be converted to use the abstracted scatterlists that dmaengine wants. Drivers like msm_sdcc are currently fairly intimitely tied to flow that is specific to ADM. The msm_sdcc driver also needs use of the ADM's "box" mode, which has to be made to work with DMAEngine as well.
Providing both APIs is really the only practical way to get this in without having to rewrite several other drivers.
The nand driver (which doesn't seem to have made it in yet,
https://lkml.org/lkml/2011/2/28/570) is much worse. About half of the code is constructing ADM specific command blocks. I'm not even sure it will be practical to even migrate that driver to DMAEngine, since the nand controller hardware is so intimately tied to the functioning of the ADM.
David
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
Quoted 2 lines · Shantanu Gupta
Any info available(publicly) on so as to what all chipsets have this capability ?
This is DMA engine driver for "Application Data Mover(ADM)" which in one type of DMA device in most of the Qualcomm processors like snapdragon.
Quoted 26 lines
On Tue, Mar 13, 2012 at 1:44 AM, Daniel Walker <[email protected] <mailto:[email protected]>> wrote:
On Mon, Mar 12, 2012 at 04:02:44PM +0530, Ravi Kumar V wrote:
> Add DMAEngine based driver using the old MSM DMA APIs internally.sWhat do you mean by this?
> The benefit of this approach is that not all the drivers > have to get converted to DMAEngine APIs simultaneosly while > both the drivers can stay enabled in the kernel. The client > drivers using the old MSM APIs directly can now convert to > DMAEngine one by one.
Which drivers?
Daniel
--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
the body of a message to majordomo at vger.kernel.org <mailto:[email protected]>
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
Sent by a consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
Quoted 33 lines · David Brown
Quoted 17 lines · Daniel Walker
Quoted 6 lines · Ravi Kumar V
Quoted 5 lines · Daniel Walker
Quoted 1 line · Ravi Kumar V
Add DMAEngine based driver using the old MSM DMA APIs internally.
What do you mean by this?
Quoted 9 lines
There is a MSM DMA driver in
arch/arm/mach-msm/which is not in dmaengine framework standards, but that driver is been used by client drivers nand, eMMC and serial drivers. Now if we implement the whole dma driver using dmaengine framework then nand, eMMC like drivers will be failed as they are using old dma driver API's, so instead of implementing new driver from scratch we are keeping the old dma API's as it is and using those API's in new dmaengine framework.So that we can convert clients drivers to use dma engine framework.Quoted 3 lines
Did you investigate converting the drivers (nand, eMMC, serialied ) ? It seems like there would be a 1:1 mapping between the API's , so it might only be a
find->replaceoperation.Only at a very superficial level--they both do DMA. The ADM driver wants its scatterlists constructed manually by the caller (in DMA-able memory) and just the pointer handed over. The drivers will have to be converted to use the abstracted scatterlists that dmaengine wants. Drivers like
msm_sdccare currently fairly intimitely tied to flow that is specific to ADM. Themsm_sdccdriver also needs use of the ADM's "box" mode, which has to be made to work with DMAEngine as well.Providing both APIs is really the only practical way to get this in without having to rewrite several other drivers.
Quoted 9 lines
The nand driver (which doesn't seem to have made it in yet,
https://lkml.org/lkml/2011/2/28/570) is much worse. About half of the code is constructing ADM specific command blocks. I'm not even sure it will be practical to even migrate that driver to DMAEngine, since the nand controller hardware is so intimately tied to the functioning of the ADM.David
Yes i have tried to convert these drivers, but mostly we need to add DMAEngine stuff like requesting channel, creating the descriptors, passing these descriptors to channel etc which are different from old implementation.So we have choose this path not to disturb the existing drivers while converting a driver.
Thanks
Ravi Kumar V
Signature · 2 lines
Sent by a consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
Quoted 12 lines · Daniel Walker
Quoted 10 lines · Ravi Kumar V
There is a MSM DMA driver in
arch/arm/mach-msm/which is not in dmaengine framework standards, but that driver is been used by client drivers nand, eMMC and serial drivers. Now if we implement the whole dma driver using dmaengine framework then nand, eMMC like drivers will be failed as they are using old dma driver API's, so instead of implementing new driver from scratch we are keeping the old dma API's as it is and using those API's in new dmaengine framework.So that we can convert clients drivers to use dma engine framework.
Quoted 3 lines
Did you investigate converting the drivers (nand, eMMC, serial) ? It seems like there would be a 1:1 mapping between the API's , so it might only be a
find->replaceoperation.
The eMMC i.e. drivers/mmc/host/msm_sdcc.c should preferably not be converted, instead switch the platforms over to using drivers/mmc/host/mmci.c which is already very well enabled for DMA engine.
Augment it with Qualcomm silicon differences as needed, I do not think they will be major.
Yours,
Linus Walleij