Lines Matching refs:mchan
241 struct mpc_dma_chan *mchan = dma_chan_to_mpc_dma_chan(c); in dma_chan_to_mpc_dma() local
243 return container_of(mchan, struct mpc_dma, channels[c->chan_id]); in dma_chan_to_mpc_dma()
254 static void mpc_dma_execute(struct mpc_dma_chan *mchan) in mpc_dma_execute() argument
256 struct mpc_dma *mdma = dma_chan_to_mpc_dma(&mchan->chan); in mpc_dma_execute()
260 int cid = mchan->chan.chan_id; in mpc_dma_execute()
262 while (!list_empty(&mchan->queued)) { in mpc_dma_execute()
263 mdesc = list_first_entry(&mchan->queued, in mpc_dma_execute()
272 if (list_empty(&mchan->active)) in mpc_dma_execute()
273 list_move_tail(&mdesc->node, &mchan->active); in mpc_dma_execute()
276 list_move_tail(&mdesc->node, &mchan->active); in mpc_dma_execute()
281 list_for_each_entry(mdesc, &mchan->active, node) { in mpc_dma_execute()
320 struct mpc_dma_chan *mchan; in mpc_dma_irq_process() local
327 mchan = &mdma->channels[ch + off]; in mpc_dma_irq_process()
329 spin_lock(&mchan->lock); in mpc_dma_irq_process()
336 list_for_each_entry(mdesc, &mchan->active, node) in mpc_dma_irq_process()
340 list_splice_tail_init(&mchan->active, &mchan->completed); in mpc_dma_irq_process()
341 if (!list_empty(&mchan->queued)) in mpc_dma_irq_process()
342 mpc_dma_execute(mchan); in mpc_dma_irq_process()
344 spin_unlock(&mchan->lock); in mpc_dma_irq_process()
379 struct mpc_dma_chan *mchan; in mpc_dma_process_completed() local
387 mchan = &mdma->channels[i]; in mpc_dma_process_completed()
390 spin_lock_irqsave(&mchan->lock, flags); in mpc_dma_process_completed()
391 if (!list_empty(&mchan->completed)) in mpc_dma_process_completed()
392 list_splice_tail_init(&mchan->completed, &list); in mpc_dma_process_completed()
393 spin_unlock_irqrestore(&mchan->lock, flags); in mpc_dma_process_completed()
409 spin_lock_irqsave(&mchan->lock, flags); in mpc_dma_process_completed()
410 list_splice_tail_init(&list, &mchan->free); in mpc_dma_process_completed()
411 mchan->chan.completed_cookie = last_cookie; in mpc_dma_process_completed()
412 spin_unlock_irqrestore(&mchan->lock, flags); in mpc_dma_process_completed()
462 struct mpc_dma_chan *mchan = dma_chan_to_mpc_dma_chan(txd->chan); in mpc_dma_tx_submit() local
469 spin_lock_irqsave(&mchan->lock, flags); in mpc_dma_tx_submit()
472 list_move_tail(&mdesc->node, &mchan->queued); in mpc_dma_tx_submit()
475 if (list_empty(&mchan->active)) in mpc_dma_tx_submit()
476 mpc_dma_execute(mchan); in mpc_dma_tx_submit()
480 spin_unlock_irqrestore(&mchan->lock, flags); in mpc_dma_tx_submit()
489 struct mpc_dma_chan *mchan = dma_chan_to_mpc_dma_chan(chan); in mpc_dma_alloc_chan_resources() local
531 spin_lock_irqsave(&mchan->lock, flags); in mpc_dma_alloc_chan_resources()
532 mchan->tcd = tcd; in mpc_dma_alloc_chan_resources()
533 mchan->tcd_paddr = tcd_paddr; in mpc_dma_alloc_chan_resources()
534 list_splice_tail_init(&descs, &mchan->free); in mpc_dma_alloc_chan_resources()
535 spin_unlock_irqrestore(&mchan->lock, flags); in mpc_dma_alloc_chan_resources()
547 struct mpc_dma_chan *mchan = dma_chan_to_mpc_dma_chan(chan); in mpc_dma_free_chan_resources() local
554 spin_lock_irqsave(&mchan->lock, flags); in mpc_dma_free_chan_resources()
557 BUG_ON(!list_empty(&mchan->prepared)); in mpc_dma_free_chan_resources()
558 BUG_ON(!list_empty(&mchan->queued)); in mpc_dma_free_chan_resources()
559 BUG_ON(!list_empty(&mchan->active)); in mpc_dma_free_chan_resources()
560 BUG_ON(!list_empty(&mchan->completed)); in mpc_dma_free_chan_resources()
563 list_splice_tail_init(&mchan->free, &descs); in mpc_dma_free_chan_resources()
564 tcd = mchan->tcd; in mpc_dma_free_chan_resources()
565 tcd_paddr = mchan->tcd_paddr; in mpc_dma_free_chan_resources()
567 spin_unlock_irqrestore(&mchan->lock, flags); in mpc_dma_free_chan_resources()
605 struct mpc_dma_chan *mchan = dma_chan_to_mpc_dma_chan(chan); in mpc_dma_prep_memcpy() local
611 spin_lock_irqsave(&mchan->lock, iflags); in mpc_dma_prep_memcpy()
612 if (!list_empty(&mchan->free)) { in mpc_dma_prep_memcpy()
613 mdesc = list_first_entry(&mchan->free, struct mpc_dma_desc, in mpc_dma_prep_memcpy()
617 spin_unlock_irqrestore(&mchan->lock, iflags); in mpc_dma_prep_memcpy()
667 spin_lock_irqsave(&mchan->lock, iflags); in mpc_dma_prep_memcpy()
668 list_add_tail(&mdesc->node, &mchan->prepared); in mpc_dma_prep_memcpy()
669 spin_unlock_irqrestore(&mchan->lock, iflags); in mpc_dma_prep_memcpy()
689 struct mpc_dma_chan *mchan = dma_chan_to_mpc_dma_chan(chan); in mpc_dma_prep_slave_sg() local
707 spin_lock_irqsave(&mchan->lock, iflags); in mpc_dma_prep_slave_sg()
709 mdesc = list_first_entry(&mchan->free, in mpc_dma_prep_slave_sg()
712 spin_unlock_irqrestore(&mchan->lock, iflags); in mpc_dma_prep_slave_sg()
721 per_paddr = mchan->src_per_paddr; in mpc_dma_prep_slave_sg()
722 tcd_nunits = mchan->src_tcd_nunits; in mpc_dma_prep_slave_sg()
724 per_paddr = mchan->dst_per_paddr; in mpc_dma_prep_slave_sg()
725 tcd_nunits = mchan->dst_tcd_nunits; in mpc_dma_prep_slave_sg()
728 spin_unlock_irqrestore(&mchan->lock, iflags); in mpc_dma_prep_slave_sg()
745 if (!IS_ALIGNED(sg_dma_address(sg), mchan->dwidth)) in mpc_dma_prep_slave_sg()
749 tcd->doff = mchan->dwidth; in mpc_dma_prep_slave_sg()
754 if (!IS_ALIGNED(sg_dma_address(sg), mchan->swidth)) in mpc_dma_prep_slave_sg()
757 tcd->soff = mchan->swidth; in mpc_dma_prep_slave_sg()
761 tcd->ssize = buswidth_to_dmatsize(mchan->swidth); in mpc_dma_prep_slave_sg()
762 tcd->dsize = buswidth_to_dmatsize(mchan->dwidth); in mpc_dma_prep_slave_sg()
766 if (!IS_ALIGNED(tcd->nbytes, mchan->swidth)) in mpc_dma_prep_slave_sg()
794 spin_lock_irqsave(&mchan->lock, iflags); in mpc_dma_prep_slave_sg()
795 list_add_tail(&mdesc->node, &mchan->prepared); in mpc_dma_prep_slave_sg()
796 spin_unlock_irqrestore(&mchan->lock, iflags); in mpc_dma_prep_slave_sg()
803 spin_lock_irqsave(&mchan->lock, iflags); in mpc_dma_prep_slave_sg()
804 list_add_tail(&mdesc->node, &mchan->free); in mpc_dma_prep_slave_sg()
805 spin_unlock_irqrestore(&mchan->lock, iflags); in mpc_dma_prep_slave_sg()
832 struct mpc_dma_chan *mchan = dma_chan_to_mpc_dma_chan(chan); in mpc_dma_device_config() local
833 struct mpc_dma *mdma = dma_chan_to_mpc_dma(&mchan->chan); in mpc_dma_device_config()
859 spin_lock_irqsave(&mchan->lock, flags); in mpc_dma_device_config()
861 mchan->src_per_paddr = cfg->src_addr; in mpc_dma_device_config()
862 mchan->src_tcd_nunits = cfg->src_maxburst; in mpc_dma_device_config()
863 mchan->swidth = cfg->src_addr_width; in mpc_dma_device_config()
864 mchan->dst_per_paddr = cfg->dst_addr; in mpc_dma_device_config()
865 mchan->dst_tcd_nunits = cfg->dst_maxburst; in mpc_dma_device_config()
866 mchan->dwidth = cfg->dst_addr_width; in mpc_dma_device_config()
869 if (mchan->src_tcd_nunits == 0) in mpc_dma_device_config()
870 mchan->src_tcd_nunits = 1; in mpc_dma_device_config()
871 if (mchan->dst_tcd_nunits == 0) in mpc_dma_device_config()
872 mchan->dst_tcd_nunits = 1; in mpc_dma_device_config()
874 spin_unlock_irqrestore(&mchan->lock, flags); in mpc_dma_device_config()
881 struct mpc_dma_chan *mchan = dma_chan_to_mpc_dma_chan(chan); in mpc_dma_device_terminate_all() local
886 spin_lock_irqsave(&mchan->lock, flags); in mpc_dma_device_terminate_all()
889 list_splice_tail_init(&mchan->prepared, &mchan->free); in mpc_dma_device_terminate_all()
890 list_splice_tail_init(&mchan->queued, &mchan->free); in mpc_dma_device_terminate_all()
891 list_splice_tail_init(&mchan->active, &mchan->free); in mpc_dma_device_terminate_all()
893 spin_unlock_irqrestore(&mchan->lock, flags); in mpc_dma_device_terminate_all()
904 struct mpc_dma_chan *mchan; in mpc_dma_probe() local
998 mchan = &mdma->channels[i]; in mpc_dma_probe()
1000 mchan->chan.device = dma; in mpc_dma_probe()
1001 dma_cookie_init(&mchan->chan); in mpc_dma_probe()
1003 INIT_LIST_HEAD(&mchan->free); in mpc_dma_probe()
1004 INIT_LIST_HEAD(&mchan->prepared); in mpc_dma_probe()
1005 INIT_LIST_HEAD(&mchan->queued); in mpc_dma_probe()
1006 INIT_LIST_HEAD(&mchan->active); in mpc_dma_probe()
1007 INIT_LIST_HEAD(&mchan->completed); in mpc_dma_probe()
1009 spin_lock_init(&mchan->lock); in mpc_dma_probe()
1010 list_add_tail(&mchan->chan.device_node, &dma->channels); in mpc_dma_probe()