summaryrefslogtreecommitdiff
path: root/drivers/dma/mxs-dma.c
AgeCommit message (Collapse)Author
2012-10-12ENGR00227835 imx6q: gpmi: fix the warning when no NAND chip exitsHuang Shijie
If there is no nand chip in the board, the kernel will prints out the following warning message: ------------[ cut here ]------------ WARNING: at arch/arm/plat-mxc/clock.c:63 clk_disable+0x48/0x90() clock enable/disable mismatch! clk apbh_dma_clk Modules linked in: [<80044f48>] (unwind_backtrace+0x0/0xfc) from [<80070ac0>] (warn_slowpath_common+0x4c/0x64) [<80070ac0>] (warn_slowpath_common+0x4c/0x64) from [<80070b6c>] (warn_slowpath_fmt+0x30/0x40) [<80070b6c>] (warn_slowpath_fmt+0x30/0x40) from [<8005ee60>] (clk_disable+0x48/0x90) [<8005ee60>] (clk_disable+0x48/0x90) from [<80255e48>] (dma_chan_put+0x4c/0x50) [<80255e48>] (dma_chan_put+0x4c/0x50) from [<80255f18>] (dma_release_channel+0x24/0x94) [<80255f18>] (dma_release_channel+0x24/0x94) from [<802ad8ec>] (release_resources+0x58/0x6c) [<802ad8ec>] (release_resources+0x58/0x6c) from [<80445964>] (gpmi_nand_probe+0x44c/0x4ec) [<80445964>] (gpmi_nand_probe+0x44c/0x4ec) from [<80281868>] (platform_drv_probe+0x18/0x1c) [<80281868>] (platform_drv_probe+0x18/0x1c) from [<80280590>] (driver_probe_device+0x98/0x1a4) [<80280590>] (driver_probe_device+0x98/0x1a4) from [<80280728>] (__driver_attach+0x8c/0x90) [<80280728>] (__driver_attach+0x8c/0x90) from [<8027fdd0>] (bus_for_each_dev+0x60/0x8c) [<8027fdd0>] (bus_for_each_dev+0x60/0x8c) from [<8027f75c>] (bus_add_driver+0x184/0x25c) [<8027f75c>] (bus_add_driver+0x184/0x25c) from [<80280d1c>] (driver_register+0x78/0x13c) [<80280d1c>] (driver_register+0x78/0x13c) from [<80022d80>] (gpmi_nand_init+0xc/0x3c) [<80022d80>] (gpmi_nand_init+0xc/0x3c) from [<80039478>] (do_one_initcall+0x30/0x16c) [<80039478>] (do_one_initcall+0x30/0x16c) from [<80008410>] (kernel_init+0x98/0x144) [<80008410>] (kernel_init+0x98/0x144) from [<8003ffb4>] (kernel_thread_exit+0x0/0x8) ---[ end trace c28d32057fe33a29 ]--- This mxs_dma_clk's usecount is not correctly changed which causes the kernel shows this warning. This patch adds proper clk_disable_unprepare/clk_prepare_enable in the mxs-dma driver to balance the mxs_dma_clk's usecount. Also put the mxs_dma_clk when the gpmi exits. Signed-off-by: Huang Shijie <b32955@freescale.com>
2012-07-20ENGR00177241-3 mx6 close APBH DMA clock when no I/O operationAllen Xu
When there is no NAND I/O operation, close all the reference clock, include GPMI,BCH and APBH clock. Signed-off-by: Allen Xu <allen.xu@freescale.com>
2012-07-20ENGR00173731-3 mxs-dma : rewrite the last parameter of mxs_dma_prep_slave_sg()Huang Shijie
[1] Background : The GPMI does ECC read page operation with a DMA chain consist of three DMA Command Structures. The middle one of the chain is used to enable the BCH, and read out the NAND page. The WAIT4END(wait for command end) is a comunication signal between the GPMI and MXS-DMA. [2] The current DMA code sets the WAIT4END bit at the last one, such as: +-----+ +-----+ +-----+ | cmd | ------------> | cmd | ------------------> | cmd | +-----+ +-----+ +-----+ ^ | | set WAIT4END here This chain works fine in the mx23/mx28. [3] But in the new GPMI version (used in MX50/MX60), the WAIT4END bit should be set not only at the last DMA Command Structure, but also at the middle one, such as: +-----+ +-----+ +-----+ | cmd | ------------> | cmd | ------------------> | cmd | +-----+ +-----+ +-----+ ^ ^ | | | | set WAIT4END here too set WAIT4END here If we do not set WAIT4END, the BCH maybe stalls in "ECC reading page" state. In the next ECC write page operation, a DMA-timeout occurs. This has been catched in the MX6Q board. [4] In order to fix the bug, rewrite the last parameter of mxs_dma_prep_slave_sg(), and use the dma_ctrl_flags: --------------------------------------------------------- DMA_PREP_INTERRUPT : append a new DMA Command Structrue. DMA_CTRL_ACK : set the WAIT4END bit for this DMA Command Structure. --------------------------------------------------------- [5] changes to the relative drivers: For gpmi-nand driver: use the new flags. Signed-off-by: Huang Shijie <b32955@freescale.com>
2012-07-20ENGR00173731-2 mxs-dma : use the new mxs-dma.hHuang Shijie
use the new header : mxs-dma.h. Signed-off-by: Huang Shijie <b32955@freescale.com>
2012-07-20dma: mxs-dma: convert to clk_prepare/clk_unprepareShawn Guo
The patch converts mxs-dma driver to clk_prepare/clk_unprepare by using helper functions clk_prepare_enable/clk_disable_unprepare. Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Acked-by: Marek Vasut <marek.vasut@gmail.com> Acked-by: Vinod Koul <vinod.koul@linux.intel.com>
2012-07-20dma: mxs-dma: Don't use CLKGATE bits in CTRL0 to disable DMA channelsLothar Waßmann
This is how the original Freescale code (unintentionally) worked, because the code path which would have asserted the CLKGATE bit was never actually reached in their code. This fixes the nefarious "DMA timout" bug when multiple DMA channels (e.g. GPMI NAND and MMC) are used at the same time. If a better fix for this problem should be found, the clkgate handling could be reinstated. See http://lists.infradead.org/pipermail/linux-arm-kernel/2011-September/065228.html Also reverse the order of mxs_dma_disable_chan() and mxs_dma_reset_chan() in mxs_dma_control() because mxs_dma_reset_chan() can only work when the DMA channel is enabled. Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de> Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
2012-07-20dma: mxs-dma: make mxs_dma_prep_slave_sg() multi user safeLothar Waßmann
Using a static variable for counting the number of CCWs attached to a DMA channel when appending a new descriptor is not multi user safe. Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de> Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
2012-07-20dma: mxs-dma: Always leave mxs_dma_init() with the clock disabled.Lothar Waßmann
There is no need to have the clock enabled all the time the driver is loaded. It will be enabled anyway in mxs_dma_alloc_chan_resources() when a channel is actually going to be used. Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de> Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
2012-07-20dma: mxs-dma: fix a typo in commentLothar Waßmann
Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de> Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
2012-07-20dmaengine: move drivers to dma_transfer_directionVinod Koul
fixup usage of dma direction by introducing dma_transfer_direction, this patch moves dma/drivers/* to use new enum Cc: Jassi Brar <jaswinder.singh@linaro.org> Cc: Russell King <rmk+kernel@arm.linux.org.uk> Cc: Viresh Kumar <viresh.kumar@st.com> Cc: Linus Walleij <linus.walleij@linaro.org> Cc: Nicolas Ferre <nicolas.ferre@atmel.com> Cc: Mika Westerberg <mika.westerberg@iki.fi> Cc: H Hartley Sweeten <hartleys@visionengravers.com> Cc: Li Yang <leoli@freescale.com> Cc: Zhang Wei <zw@zh-kernel.org> Cc: Sascha Hauer <s.hauer@pengutronix.de> Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Cc: Shawn Guo <shawn.guo@freescale.com> Cc: Yong Wang <yong.y.wang@intel.com> Cc: Tomoya MORINAGA <tomoya-linux@dsn.lapis-semi.com> Cc: Boojin Kim <boojin.kim@samsung.com> Cc: Barry Song <Baohua.Song@csr.com> Acked-by: Mika Westerberg <mika.westerberg@iki.fi> Acked-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Viresh Kumar <viresh.kumar@st.com> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
2012-07-20dmaengine: add DMA_TRANS_NONE to dma_transfer_directionShawn Guo
Before dma_transfer_direction was introduced to replace dma_data_direction, some dmaengine device uses DMA_NONE of dma_data_direction for some talk with its client drivers. The mxs-dma and its clients mxs-mmc and gpmi-nand are such case. This patch adds DMA_TRANS_NONE to dma_transfer_direction and migrate the DMA_NONE use in mxs-dma to it. It also fixes the compile warning below. CC drivers/dma/mxs-dma.o drivers/dma/mxs-dma.c: In function ‘mxs_dma_prep_slave_sg’: drivers/dma/mxs-dma.c:420:16: warning: comparison between ‘enum dma_transfer_direction’ and ‘enum dma_data_direction’ Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
2012-07-20ENGR00173369-3 Revert "ENGR00143126-3 ARM: add DMA driver for mx50"Huang Shijie
This reverts commit 6257fa54c1c66de2c9f72172895ea7e0e3c0845c. Signed-off-by: Huang Shijie <b32955@freescale.com>
2012-07-20ENGR00173369-2 Revert "ENGR00139247-6 DMA : add DMA support for imx6q"Huang Shijie
This reverts commit ab11e98c15ecb29eaf93114cb928478c98d637e9. Signed-off-by: Huang Shijie <b32955@freescale.com>
2012-07-20ENGR00173369-1 Revert "ENGR00169906-4 MXS-DMA : change the last parameter...Huang Shijie
This reverts commit a1a43335ccbf5578eb48edbf16c11e53d76c0123. Signed-off-by: Huang Shijie <b32955@freescale.com>
2012-07-20ENGR00169906-4 MXS-DMA : change the last parameter of mxs_dma_prep_slave_sg()Huang Shijie
For a long DMA chain which may have more then two DMA Command Structures, the current DMA code sets the WAIT4END bit at the last one, such as: +-----+ +-----+ +-----+ | cmd | ------------> | cmd | ------------------> | cmd | +-----+ +-----+ +-----+ ^ | | set WAIT4END here But in the NAND ECC read case, the WAIT4END bit should be set not only at the last DMA Command Structure, but also at the middle one, such as: +-----+ +-----+ +-----+ | cmd | ------------> | cmd | ------------------> | cmd | +-----+ +-----+ +-----+ ^ ^ | | | | set WAIT4END here too set WAIT4END here We set the WAIT4END in the middle DMA Command Structure to ensure the BCH module finishs its job. If we do not wait in this situation, the BCH module may be changed in the following DMA Command Structures, and it maybe becomes unstable which will cause a DMA timeout This has been catched in the MX6Q board. So rewrite the last parameter of mxs_dma_prep_slave_sg(). Add some more flags to let the driver sets the WAIT4END as it needs. Acked-by: Jason Liu <r64343@freescale.com> Signed-off-by: Huang Shijie <b32955@freescale.com>
2012-07-20mxs-dma: enable CLKGATE before accessing registersLothar Waßmann
After calling mxs_dma_disable_chan() for a channel, that channel becomes unusable because some controller registers can only be written when the clock is enabled via CLKGATE. Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2012-07-20ARM: mxs-dma: reset after disable channelDong Aisheng
We met some channels in abnormal state after disable. Reset it to get a clean state. Signed-off-by: Dong Aisheng <b29396@freescale.com> Cc: Vinod Koul <vinod.koul@intel.com> Cc: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2012-07-20dma: mxs-dma: fix unterminated platform_device_id tableAxel Lin
Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2012-07-20dmaengine: mxs-dma: skip request_irq for NO_IRQShawn Guo
In general, the mxs-dma users get separate irq for each channel, but gpmi is special one which has only one irq shared by all gpmi channels. It causes mxs_dma channel allocation function fail for all other gpmi channels except the first one calling into the function. The patch gets request_irq call skipped for NO_IRQ case, and leaves this gpmi specific quirk to gpmi driver to sort out. It will fix above problem if gpmi driver sets chan_irq as gpmi irq for only one channel and NO_IRQ for all the rest channels. Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Cc: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2012-07-20ENGR00139247-6 DMA : add DMA support for imx6qHuang Shijie
add the dma support for imx6q. Signed-off-by: Huang Shijie <b32955@freescale.com>
2012-07-20ENGR00143126-3 ARM: add DMA driver for mx50Huang Shijie
add the DMA driver for mx50. Signed-off-by: Huang Shijie <b32955@freescale.com>
2011-03-02dmaengine: mxs-dma: add dma support for i.MX23/28Shawn 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_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. Signed-off-by: Shawn Guo <shawn.guo@freescale.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com>