dmaengine: mxs-dma: add dma support for i.MX23/28
Subsystems (4)
PATCH v4 1/1 dmaengine: mxs-dma: add dma support for i.MX23/28
This patch adds dma support for Freescale MXS-based SoC i.MX23/28, including apbh-dma and apbx-dma.
* apbh-dma and apbx-dma are supported in the driver as two mxs-dma instances.
* apbh-dma is different between mx23 and mx28, hardware version register is used to differentiate.
* mxs-dma supports pio function besides data transfer. The driver uses dma_data_direction DMA_NONE to identify the pio mode, and steals sgl and sg_len to get pio words and numbers from clients.
* mxs dmaengine has some very specific features, like sense function and the special NAND support (nand_lock, nand_wait4ready). These are too specific to implemented in generic dmaengine driver.
* The driver refers to imx-sdma and only a single descriptor is statically assigned to each channel.
--- arch/arm/mach-mxs/include/mach/dma.h | 26 ++ drivers/dma/Kconfig | 8 + drivers/dma/Makefile | 1 + drivers/dma/mxs-dma.c | 723 ++++++++++++++++++++++++++++++++++ 4 files changed, 758 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-mxs/include/mach/dma.h create mode 100644 drivers/dma/mxs-dma.c
arch/arm/mach-mxs/include/mach/dma.h new file +26 -0
@@ -0,0 +1,26 @@ +/* +* Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#ifndef __MACH_MXS_DMA_H__ +#define __MACH_MXS_DMA_H__ + +struct mxs_dma_data { +int chan_irq; +}; + +static inline int mxs_dma_is_apbh (struct dma_chan *chan) +{ +return !strcmp (dev_name (chan->device->dev),"mxs-dma-apbh" ); +} + +static inline int mxs_dma_is_apbx (struct dma_chan *chan) +{ +return !strcmp (dev_name (chan->device->dev),"mxs-dma-apbx" ); +} + +#endif /* __MACH_MXS_DMA_H__ */
drivers/dma/Kconfig +8 -0
@@ -227,6 +227,14 @@ config IMX_DMA Support the i.MX DMA engine. This engine is integrated into Freescale i.MX1/21/27 chips. +config MXS_DMA + bool "MXS DMA support" + depends on SOC_IMX23 || SOC_IMX28 + select DMA_ENGINE + help + Support the MXS DMA engine. This engine including APBH-DMA + and APBX-DMA is integrated into Freescale i.MX23/28 chips. + config DMA_ENGINE bool
drivers/dma/Makefile +1 -0
@@ -23,6 +23,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_MXS_DMA) += mxs-dma.o obj-$(CONFIG_TIMB_DMA) += timb_dma.o obj-$(CONFIG_STE_DMA40) += ste_dma40.o ste_dma40_ll.o obj-$(CONFIG_PL330_DMA) += pl330.o
drivers/dma/mxs-dma.c new file +723 -0
723 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH v4 1/1 dmaengine: mxs-dma: add dma support for i.MX23/28
Hi Shawn,
Quoted 17 lines · Shawn Guo
This patch adds dma support for Freescale MXS-based SoC i.MX23/28, including apbh-dma and apbx-dma.
* apbh-dma and apbx-dma are supported in the driver as two mxs-dma instances.
* apbh-dma is different between mx23 and mx28, hardware version register is used to differentiate.
* mxs-dma supports pio function besides data transfer. The driver uses
dma_data_directionDMA_NONEto identify the pio mode, and steals sgl andsg_lento get pio words and numbers from clients.* mxs dmaengine has some very specific features, like sense function and the special NAND support (
nand_lock,nand_wait4ready). These are too specific to implemented in generic dmaengine driver.
Quoted 5 lines
* The driver refers to imx-sdma and only a single descriptor is statically assigned to each channel.
Signed-off-by Shawn Guo <[email protected]>---
What are (roughly) the changes since last version?
Regards,
Wolfram
Signature · 9 lines
Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ | -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20110225/7415eff3/attachment.sig>
PATCH v4 1/1 dmaengine: mxs-dma: add dma support for i.MX23/28
Quoted 2 lines · Wolfram Sang
Hi Shawn,
Hi Wolfram,
Quoted 18 lines · Shawn Guo
Quoted 17 lines
This patch adds dma support for Freescale MXS-based SoC i.MX23/28, including apbh-dma and apbx-dma.
* apbh-dma and apbx-dma are supported in the driver as two mxs-dma instances.
* apbh-dma is different between mx23 and mx28, hardware version register is used to differentiate.
* mxs-dma supports pio function besides data transfer. The driver uses
dma_data_directionDMA_NONEto identify the pio mode, and steals sgl andsg_lento get pio words and numbers from clients.* mxs dmaengine has some very specific features, like sense function and the special NAND support (
nand_lock,nand_wait4ready). These are too specific to implemented in generic dmaengine driver.
Quoted 8 lines
Quoted 5 lines
* The driver refers to imx-sdma and only a single descriptor is statically assigned to each channel.
Signed-off-by Shawn Guo <[email protected]>---
What are (roughly) the changes since last version?
Sorry, I did not give the change log. Basically, it addressed the comments below from Vinod and Lothar on v3.
======
drivers/dma/mxs-dma.c
Quoted 5 lines
drivers/dma/mxs-dma.c new file +5
-0+#define HW_APBHX_CTRL0 0x000 +#define BM_APBH_CTRL0_APB_BURST8_EN (1 << 29) +#define BM_APBH_CTRL0_APB_BURST_EN (1 << 28) +#define BP_APBH_CTRL0_CLKGATE_CHANNEL (8) +#define BP_APBH_CTRL0_RESET_CHANNEL (16)
can you please use consistent spacing here...
drivers/dma/mxs-dma.c
Quoted 8 lines
drivers/dma/mxs-dma.c new file +8
-0+static irqreturn_t mxs_dma_int_handler (int irq,void *dev_id) +{ +struct mxs_dma_engine *mxs_dma = dev_id; +u32 stat1, stat2; + +/* completion status */ + stat1 =readl (mxs_dma->base +HW_APBHX_CTRL1 ); + stat1 &=0xffff ;
Magic number?
Quoted 7 lines
drivers/dma/mxs-dma.c new file +7
-0+writel (stat1, mxs_dma->base +HW_APBHX_CTRL1 +MXS_CLR_ADDR ); + +/* error status */ + stat2 =readl (mxs_dma->base +HW_APBHX_CTRL2 ); +writel (stat2, mxs_dma->base +HW_APBHX_CTRL2 +MXS_CLR_ADDR ); + +/*
drivers/dma/mxs-dma.c
Quoted 10 lines
drivers/dma/mxs-dma.c new file +10
-0+* When both completion and error of termination bits set at the +* same time, we do not take it as an error. IOW, it only becomes +* an error we need to handler here in case of ether it's an bus +* error or a termination error with no completion. +*/ + stat2 = ((stat2 >>16 ) & stat2) |/* bus error */ + (~(stat2 >>16 ) & stat2 & ~stat1);/* termination with no completion */ + +/* combine error and completion status for checking */ + stat1 = (stat2 <<16 ) | stat1;
would it be possible for you to avoid these magic number, will help you when you add more controllers...
Quoted 6 lines
Quoted 5 lines
drivers/dma/mxs-dma.c
Quoted 5 lines
drivers/dma/mxs-dma.c new file +5
-0+#define HW_APBHX_CTRL0 0x000 +#define BM_APBH_CTRL0_APB_BURST8_EN (1 << 29) +#define BM_APBH_CTRL0_APB_BURST_EN (1 << 28) +#define BP_APBH_CTRL0_CLKGATE_CHANNEL (8) +#define BP_APBH_CTRL0_RESET_CHANNEL (16)
There is no need to enclose bare number in macro definitions in parenthesis.
...
=======
Signature · 2 lines
Regards, Shawn
PATCH v4 1/1 dmaengine: mxs-dma: add dma support for i.MX23/28
In reply to Shawn GuoQuoted 13 lines · Shawn Guo
This patch adds dma support for Freescale MXS-based SoC i.MX23/28, including apbh-dma and apbx-dma.
* apbh-dma and apbx-dma are supported in the driver as two mxs-dma instances.
* apbh-dma is different between mx23 and mx28, hardware version register is used to differentiate.
* mxs-dma supports pio function besides data transfer. The driver uses
dma_data_directionDMA_NONEto identify the pio mode, and steals sgl andsg_lento get pio words and numbers from clients.
Quoted 8 lines
* mxs dmaengine has some very specific features, like sense function and the special NAND support (
nand_lock,nand_wait4ready). These are too specific to implemented in generic dmaengine driver.* The driver refers to imx-sdma and only a single descriptor is statically assigned to each channel.
Signed-off-by Shawn Guo <[email protected]>
Please fix the checkpatch errors and warnings, at least it should have zero errors.
ERROR: code indent should use tabs where possible
#430: FILE: drivers/dma/mxs-dma.c:250:
+ if (mxs_chan->desc.callback)$
WARNING: please, no spaces at the start of a line
#430: FILE: drivers/dma/mxs-dma.c:250:
+ if (mxs_chan->desc.callback)$
ERROR: code indent should use tabs where possible
#431: FILE: drivers/dma/mxs-dma.c:251:
+ mxs_chan->desc.callback(mxs_chan->desc.callback_param);
WARNING: please, no spaces at the start of a line
#431: FILE: drivers/dma/mxs-dma.c:251:
+ mxs_chan->desc.callback(mxs_chan->desc.callback_param);
ERROR: do not initialise statics to 0 or NULL
#564: FILE: drivers/dma/mxs-dma.c:384:
+ static int idx = 0;
~Vinod