diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-30 20:31:56 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-30 20:31:56 -0400 |
commit | 623ff7739e7c00fa3d55dbfd42a492a68298fd7a (patch) | |
tree | 0b7461753a1b13b27ea2958a7d48c6efb47bba54 /drivers/dma/mxs-dma.c | |
parent | c39e8ede284f469971589f2e04af78216e1a771d (diff) | |
parent | 7b0e67f604e1829e5292e1ad7743eb18dc42ea7c (diff) |
Merge tag 'for-linus-3.4' of git://git.infradead.org/mtd-2.6
Pull MTD changes from David Woodhouse:
- Artem's cleanup of the MTD API continues apace.
- Fixes and improvements for ST FSMC and SuperH FLCTL NAND, amongst
others.
- More work on DiskOnChip G3, new driver for DiskOnChip G4.
- Clean up debug/warning printks in JFFS2 to use pr_<level>.
Fix up various trivial conflicts, largely due to changes in calling
conventions for things like dmaengine_prep_slave_sg() (new inline
wrapper to hide new parameter, clashing with rewrite of previously last
parameter that used to be an 'append' flag, and is now a bitmap of
'unsigned long flags').
(Also some header file fallout - like so many merges this merge window -
and silly conflicts with sparse fixes)
* tag 'for-linus-3.4' of git://git.infradead.org/mtd-2.6: (120 commits)
mtd: docg3 add protection against concurrency
mtd: docg3 refactor cascade floors structure
mtd: docg3 increase write/erase timeout
mtd: docg3 fix inbound calculations
mtd: nand: gpmi: fix function annotations
mtd: phram: fix section mismatch for phram_setup
mtd: unify initialization of erase_info->fail_addr
mtd: support ONFI multi lun NAND
mtd: sm_ftl: fix typo in major number.
mtd: add device-tree support to spear_smi
mtd: spear_smi: Remove default partition information from driver
mtd: Add device-tree support to fsmc_nand
mtd: fix section mismatch for doc_probe_device
mtd: nand/fsmc: Remove sparse warnings and errors
mtd: nand/fsmc: Add DMA support
mtd: nand/fsmc: Access the NAND device word by word whenever possible
mtd: nand/fsmc: Use dev_err to report error scenario
mtd: nand/fsmc: Use devm routines
mtd: nand/fsmc: Modify fsmc driver to accept nand timing parameters via platform
mtd: fsmc_nand: add pm callbacks to support hibernation
...
Diffstat (limited to 'drivers/dma/mxs-dma.c')
-rw-r--r-- | drivers/dma/mxs-dma.c | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/drivers/dma/mxs-dma.c b/drivers/dma/mxs-dma.c index 65334c49b71e..c81ef7e10e08 100644 --- a/drivers/dma/mxs-dma.c +++ b/drivers/dma/mxs-dma.c | |||
@@ -22,10 +22,10 @@ | |||
22 | #include <linux/platform_device.h> | 22 | #include <linux/platform_device.h> |
23 | #include <linux/dmaengine.h> | 23 | #include <linux/dmaengine.h> |
24 | #include <linux/delay.h> | 24 | #include <linux/delay.h> |
25 | #include <linux/fsl/mxs-dma.h> | ||
25 | 26 | ||
26 | #include <asm/irq.h> | 27 | #include <asm/irq.h> |
27 | #include <mach/mxs.h> | 28 | #include <mach/mxs.h> |
28 | #include <mach/dma.h> | ||
29 | #include <mach/common.h> | 29 | #include <mach/common.h> |
30 | 30 | ||
31 | #include "dmaengine.h" | 31 | #include "dmaengine.h" |
@@ -337,10 +337,32 @@ static void mxs_dma_free_chan_resources(struct dma_chan *chan) | |||
337 | clk_disable_unprepare(mxs_dma->clk); | 337 | clk_disable_unprepare(mxs_dma->clk); |
338 | } | 338 | } |
339 | 339 | ||
340 | /* | ||
341 | * How to use the flags for ->device_prep_slave_sg() : | ||
342 | * [1] If there is only one DMA command in the DMA chain, the code should be: | ||
343 | * ...... | ||
344 | * ->device_prep_slave_sg(DMA_CTRL_ACK); | ||
345 | * ...... | ||
346 | * [2] If there are two DMA commands in the DMA chain, the code should be | ||
347 | * ...... | ||
348 | * ->device_prep_slave_sg(0); | ||
349 | * ...... | ||
350 | * ->device_prep_slave_sg(DMA_PREP_INTERRUPT | DMA_CTRL_ACK); | ||
351 | * ...... | ||
352 | * [3] If there are more than two DMA commands in the DMA chain, the code | ||
353 | * should be: | ||
354 | * ...... | ||
355 | * ->device_prep_slave_sg(0); // First | ||
356 | * ...... | ||
357 | * ->device_prep_slave_sg(DMA_PREP_INTERRUPT [| DMA_CTRL_ACK]); | ||
358 | * ...... | ||
359 | * ->device_prep_slave_sg(DMA_PREP_INTERRUPT | DMA_CTRL_ACK); // Last | ||
360 | * ...... | ||
361 | */ | ||
340 | static struct dma_async_tx_descriptor *mxs_dma_prep_slave_sg( | 362 | static struct dma_async_tx_descriptor *mxs_dma_prep_slave_sg( |
341 | struct dma_chan *chan, struct scatterlist *sgl, | 363 | struct dma_chan *chan, struct scatterlist *sgl, |
342 | unsigned int sg_len, enum dma_transfer_direction direction, | 364 | unsigned int sg_len, enum dma_transfer_direction direction, |
343 | unsigned long append, void *context) | 365 | unsigned long flags, void *context) |
344 | { | 366 | { |
345 | struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(chan); | 367 | struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(chan); |
346 | struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma; | 368 | struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma; |
@@ -348,6 +370,7 @@ static struct dma_async_tx_descriptor *mxs_dma_prep_slave_sg( | |||
348 | struct scatterlist *sg; | 370 | struct scatterlist *sg; |
349 | int i, j; | 371 | int i, j; |
350 | u32 *pio; | 372 | u32 *pio; |
373 | bool append = flags & DMA_PREP_INTERRUPT; | ||
351 | int idx = append ? mxs_chan->desc_count : 0; | 374 | int idx = append ? mxs_chan->desc_count : 0; |
352 | 375 | ||
353 | if (mxs_chan->status == DMA_IN_PROGRESS && !append) | 376 | if (mxs_chan->status == DMA_IN_PROGRESS && !append) |
@@ -374,7 +397,6 @@ static struct dma_async_tx_descriptor *mxs_dma_prep_slave_sg( | |||
374 | ccw->bits |= CCW_CHAIN; | 397 | ccw->bits |= CCW_CHAIN; |
375 | ccw->bits &= ~CCW_IRQ; | 398 | ccw->bits &= ~CCW_IRQ; |
376 | ccw->bits &= ~CCW_DEC_SEM; | 399 | ccw->bits &= ~CCW_DEC_SEM; |
377 | ccw->bits &= ~CCW_WAIT4END; | ||
378 | } else { | 400 | } else { |
379 | idx = 0; | 401 | idx = 0; |
380 | } | 402 | } |
@@ -389,7 +411,8 @@ static struct dma_async_tx_descriptor *mxs_dma_prep_slave_sg( | |||
389 | ccw->bits = 0; | 411 | ccw->bits = 0; |
390 | ccw->bits |= CCW_IRQ; | 412 | ccw->bits |= CCW_IRQ; |
391 | ccw->bits |= CCW_DEC_SEM; | 413 | ccw->bits |= CCW_DEC_SEM; |
392 | ccw->bits |= CCW_WAIT4END; | 414 | if (flags & DMA_CTRL_ACK) |
415 | ccw->bits |= CCW_WAIT4END; | ||
393 | ccw->bits |= CCW_HALT_ON_TERM; | 416 | ccw->bits |= CCW_HALT_ON_TERM; |
394 | ccw->bits |= CCW_TERM_FLUSH; | 417 | ccw->bits |= CCW_TERM_FLUSH; |
395 | ccw->bits |= BF_CCW(sg_len, PIO_NUM); | 418 | ccw->bits |= BF_CCW(sg_len, PIO_NUM); |
@@ -420,7 +443,8 @@ static struct dma_async_tx_descriptor *mxs_dma_prep_slave_sg( | |||
420 | ccw->bits &= ~CCW_CHAIN; | 443 | ccw->bits &= ~CCW_CHAIN; |
421 | ccw->bits |= CCW_IRQ; | 444 | ccw->bits |= CCW_IRQ; |
422 | ccw->bits |= CCW_DEC_SEM; | 445 | ccw->bits |= CCW_DEC_SEM; |
423 | ccw->bits |= CCW_WAIT4END; | 446 | if (flags & DMA_CTRL_ACK) |
447 | ccw->bits |= CCW_WAIT4END; | ||
424 | } | 448 | } |
425 | } | 449 | } |
426 | } | 450 | } |