diff options
author | Hongbo Zhang <hongbo.zhang@freescale.com> | 2014-04-18 04:17:48 -0400 |
---|---|---|
committer | Vinod Koul <vinod.koul@intel.com> | 2014-05-02 12:47:43 -0400 |
commit | 2a5ecb7918d72183f0292266026d077cd2c8d3ed (patch) | |
tree | 9fbd4c6b9b13a3bf90c9b2432d175a9d136d6e94 /drivers/dma/fsldma.c | |
parent | 86d19a5491d08fdc5a5cb4be5a09d5f88a6b96ba (diff) |
DMA: Freescale: move functions to avoid forward declarations
These functions will be modified in the next patch in the series. By moving the
function in a patch separate from the changes, it will make review easier.
Signed-off-by: Hongbo Zhang <hongbo.zhang@freescale.com>
Signed-off-by: Qiang Liu <qiang.liu@freescale.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Diffstat (limited to 'drivers/dma/fsldma.c')
-rw-r--r-- | drivers/dma/fsldma.c | 190 |
1 files changed, 95 insertions, 95 deletions
diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c index adc266e6d5c9..e0fec68aed25 100644 --- a/drivers/dma/fsldma.c +++ b/drivers/dma/fsldma.c | |||
@@ -459,6 +459,101 @@ static struct fsl_desc_sw *fsl_dma_alloc_descriptor(struct fsldma_chan *chan) | |||
459 | } | 459 | } |
460 | 460 | ||
461 | /** | 461 | /** |
462 | * fsl_chan_xfer_ld_queue - transfer any pending transactions | ||
463 | * @chan : Freescale DMA channel | ||
464 | * | ||
465 | * HARDWARE STATE: idle | ||
466 | * LOCKING: must hold chan->desc_lock | ||
467 | */ | ||
468 | static void fsl_chan_xfer_ld_queue(struct fsldma_chan *chan) | ||
469 | { | ||
470 | struct fsl_desc_sw *desc; | ||
471 | |||
472 | /* | ||
473 | * If the list of pending descriptors is empty, then we | ||
474 | * don't need to do any work at all | ||
475 | */ | ||
476 | if (list_empty(&chan->ld_pending)) { | ||
477 | chan_dbg(chan, "no pending LDs\n"); | ||
478 | return; | ||
479 | } | ||
480 | |||
481 | /* | ||
482 | * The DMA controller is not idle, which means that the interrupt | ||
483 | * handler will start any queued transactions when it runs after | ||
484 | * this transaction finishes | ||
485 | */ | ||
486 | if (!chan->idle) { | ||
487 | chan_dbg(chan, "DMA controller still busy\n"); | ||
488 | return; | ||
489 | } | ||
490 | |||
491 | /* | ||
492 | * If there are some link descriptors which have not been | ||
493 | * transferred, we need to start the controller | ||
494 | */ | ||
495 | |||
496 | /* | ||
497 | * Move all elements from the queue of pending transactions | ||
498 | * onto the list of running transactions | ||
499 | */ | ||
500 | chan_dbg(chan, "idle, starting controller\n"); | ||
501 | desc = list_first_entry(&chan->ld_pending, struct fsl_desc_sw, node); | ||
502 | list_splice_tail_init(&chan->ld_pending, &chan->ld_running); | ||
503 | |||
504 | /* | ||
505 | * The 85xx DMA controller doesn't clear the channel start bit | ||
506 | * automatically at the end of a transfer. Therefore we must clear | ||
507 | * it in software before starting the transfer. | ||
508 | */ | ||
509 | if ((chan->feature & FSL_DMA_IP_MASK) == FSL_DMA_IP_85XX) { | ||
510 | u32 mode; | ||
511 | |||
512 | mode = get_mr(chan); | ||
513 | mode &= ~FSL_DMA_MR_CS; | ||
514 | set_mr(chan, mode); | ||
515 | } | ||
516 | |||
517 | /* | ||
518 | * Program the descriptor's address into the DMA controller, | ||
519 | * then start the DMA transaction | ||
520 | */ | ||
521 | set_cdar(chan, desc->async_tx.phys); | ||
522 | get_cdar(chan); | ||
523 | |||
524 | dma_start(chan); | ||
525 | chan->idle = false; | ||
526 | } | ||
527 | |||
528 | /** | ||
529 | * fsldma_cleanup_descriptor - cleanup and free a single link descriptor | ||
530 | * @chan: Freescale DMA channel | ||
531 | * @desc: descriptor to cleanup and free | ||
532 | * | ||
533 | * This function is used on a descriptor which has been executed by the DMA | ||
534 | * controller. It will run any callbacks, submit any dependencies, and then | ||
535 | * free the descriptor. | ||
536 | */ | ||
537 | static void fsldma_cleanup_descriptor(struct fsldma_chan *chan, | ||
538 | struct fsl_desc_sw *desc) | ||
539 | { | ||
540 | struct dma_async_tx_descriptor *txd = &desc->async_tx; | ||
541 | |||
542 | /* Run the link descriptor callback function */ | ||
543 | if (txd->callback) { | ||
544 | chan_dbg(chan, "LD %p callback\n", desc); | ||
545 | txd->callback(txd->callback_param); | ||
546 | } | ||
547 | |||
548 | /* Run any dependencies */ | ||
549 | dma_run_dependencies(txd); | ||
550 | |||
551 | dma_descriptor_unmap(txd); | ||
552 | chan_dbg(chan, "LD %p free\n", desc); | ||
553 | dma_pool_free(chan->desc_pool, desc, txd->phys); | ||
554 | } | ||
555 | |||
556 | /** | ||
462 | * fsl_dma_alloc_chan_resources - Allocate resources for DMA channel. | 557 | * fsl_dma_alloc_chan_resources - Allocate resources for DMA channel. |
463 | * @chan : Freescale DMA channel | 558 | * @chan : Freescale DMA channel |
464 | * | 559 | * |
@@ -803,101 +898,6 @@ static int fsl_dma_device_control(struct dma_chan *dchan, | |||
803 | } | 898 | } |
804 | 899 | ||
805 | /** | 900 | /** |
806 | * fsldma_cleanup_descriptor - cleanup and free a single link descriptor | ||
807 | * @chan: Freescale DMA channel | ||
808 | * @desc: descriptor to cleanup and free | ||
809 | * | ||
810 | * This function is used on a descriptor which has been executed by the DMA | ||
811 | * controller. It will run any callbacks, submit any dependencies, and then | ||
812 | * free the descriptor. | ||
813 | */ | ||
814 | static void fsldma_cleanup_descriptor(struct fsldma_chan *chan, | ||
815 | struct fsl_desc_sw *desc) | ||
816 | { | ||
817 | struct dma_async_tx_descriptor *txd = &desc->async_tx; | ||
818 | |||
819 | /* Run the link descriptor callback function */ | ||
820 | if (txd->callback) { | ||
821 | chan_dbg(chan, "LD %p callback\n", desc); | ||
822 | txd->callback(txd->callback_param); | ||
823 | } | ||
824 | |||
825 | /* Run any dependencies */ | ||
826 | dma_run_dependencies(txd); | ||
827 | |||
828 | dma_descriptor_unmap(txd); | ||
829 | chan_dbg(chan, "LD %p free\n", desc); | ||
830 | dma_pool_free(chan->desc_pool, desc, txd->phys); | ||
831 | } | ||
832 | |||
833 | /** | ||
834 | * fsl_chan_xfer_ld_queue - transfer any pending transactions | ||
835 | * @chan : Freescale DMA channel | ||
836 | * | ||
837 | * HARDWARE STATE: idle | ||
838 | * LOCKING: must hold chan->desc_lock | ||
839 | */ | ||
840 | static void fsl_chan_xfer_ld_queue(struct fsldma_chan *chan) | ||
841 | { | ||
842 | struct fsl_desc_sw *desc; | ||
843 | |||
844 | /* | ||
845 | * If the list of pending descriptors is empty, then we | ||
846 | * don't need to do any work at all | ||
847 | */ | ||
848 | if (list_empty(&chan->ld_pending)) { | ||
849 | chan_dbg(chan, "no pending LDs\n"); | ||
850 | return; | ||
851 | } | ||
852 | |||
853 | /* | ||
854 | * The DMA controller is not idle, which means that the interrupt | ||
855 | * handler will start any queued transactions when it runs after | ||
856 | * this transaction finishes | ||
857 | */ | ||
858 | if (!chan->idle) { | ||
859 | chan_dbg(chan, "DMA controller still busy\n"); | ||
860 | return; | ||
861 | } | ||
862 | |||
863 | /* | ||
864 | * If there are some link descriptors which have not been | ||
865 | * transferred, we need to start the controller | ||
866 | */ | ||
867 | |||
868 | /* | ||
869 | * Move all elements from the queue of pending transactions | ||
870 | * onto the list of running transactions | ||
871 | */ | ||
872 | chan_dbg(chan, "idle, starting controller\n"); | ||
873 | desc = list_first_entry(&chan->ld_pending, struct fsl_desc_sw, node); | ||
874 | list_splice_tail_init(&chan->ld_pending, &chan->ld_running); | ||
875 | |||
876 | /* | ||
877 | * The 85xx DMA controller doesn't clear the channel start bit | ||
878 | * automatically at the end of a transfer. Therefore we must clear | ||
879 | * it in software before starting the transfer. | ||
880 | */ | ||
881 | if ((chan->feature & FSL_DMA_IP_MASK) == FSL_DMA_IP_85XX) { | ||
882 | u32 mode; | ||
883 | |||
884 | mode = get_mr(chan); | ||
885 | mode &= ~FSL_DMA_MR_CS; | ||
886 | set_mr(chan, mode); | ||
887 | } | ||
888 | |||
889 | /* | ||
890 | * Program the descriptor's address into the DMA controller, | ||
891 | * then start the DMA transaction | ||
892 | */ | ||
893 | set_cdar(chan, desc->async_tx.phys); | ||
894 | get_cdar(chan); | ||
895 | |||
896 | dma_start(chan); | ||
897 | chan->idle = false; | ||
898 | } | ||
899 | |||
900 | /** | ||
901 | * fsl_dma_memcpy_issue_pending - Issue the DMA start command | 901 | * fsl_dma_memcpy_issue_pending - Issue the DMA start command |
902 | * @chan : Freescale DMA channel | 902 | * @chan : Freescale DMA channel |
903 | */ | 903 | */ |