Lines Matching refs:s3cchan
258 static bool s3c24xx_dma_phy_valid(struct s3c24xx_dma_chan *s3cchan, in s3c24xx_dma_phy_valid() argument
261 struct s3c24xx_dma_engine *s3cdma = s3cchan->host; in s3c24xx_dma_phy_valid()
263 struct s3c24xx_dma_channel *cdata = &pdata->channels[s3cchan->id]; in s3c24xx_dma_phy_valid()
267 if (!s3cchan->slave) in s3c24xx_dma_phy_valid()
286 struct s3c24xx_dma_phy *s3c24xx_dma_get_phy(struct s3c24xx_dma_chan *s3cchan) in s3c24xx_dma_get_phy() argument
288 struct s3c24xx_dma_engine *s3cdma = s3cchan->host; in s3c24xx_dma_get_phy()
300 if (!s3c24xx_dma_phy_valid(s3cchan, phy)) in s3c24xx_dma_get_phy()
306 phy->serving = s3cchan; in s3c24xx_dma_get_phy()
370 static u32 s3c24xx_dma_getbytes_chan(struct s3c24xx_dma_chan *s3cchan) in s3c24xx_dma_getbytes_chan() argument
372 struct s3c24xx_dma_phy *phy = s3cchan->phy; in s3c24xx_dma_getbytes_chan()
373 struct s3c24xx_txd *txd = s3cchan->at; in s3c24xx_dma_getbytes_chan()
382 struct s3c24xx_dma_chan *s3cchan = to_s3c24xx_dma_chan(chan); in s3c24xx_dma_set_runtime_config() local
391 spin_lock_irqsave(&s3cchan->vc.lock, flags); in s3c24xx_dma_set_runtime_config()
393 if (!s3cchan->slave) { in s3c24xx_dma_set_runtime_config()
398 s3cchan->cfg = *config; in s3c24xx_dma_set_runtime_config()
401 spin_unlock_irqrestore(&s3cchan->vc.lock, flags); in s3c24xx_dma_set_runtime_config()
439 static void s3c24xx_dma_start_next_sg(struct s3c24xx_dma_chan *s3cchan, in s3c24xx_dma_start_next_sg() argument
442 struct s3c24xx_dma_engine *s3cdma = s3cchan->host; in s3c24xx_dma_start_next_sg()
443 struct s3c24xx_dma_phy *phy = s3cchan->phy; in s3c24xx_dma_start_next_sg()
462 if (s3cchan->slave) { in s3c24xx_dma_start_next_sg()
464 &pdata->channels[s3cchan->id]; in s3c24xx_dma_start_next_sg()
494 if (!s3cchan->slave) in s3c24xx_dma_start_next_sg()
503 static void s3c24xx_dma_start_next_txd(struct s3c24xx_dma_chan *s3cchan) in s3c24xx_dma_start_next_txd() argument
505 struct s3c24xx_dma_phy *phy = s3cchan->phy; in s3c24xx_dma_start_next_txd()
506 struct virt_dma_desc *vd = vchan_next_desc(&s3cchan->vc); in s3c24xx_dma_start_next_txd()
511 s3cchan->at = txd; in s3c24xx_dma_start_next_txd()
519 s3c24xx_dma_start_next_sg(s3cchan, txd); in s3c24xx_dma_start_next_txd()
523 struct s3c24xx_dma_chan *s3cchan) in s3c24xx_dma_free_txd_list() argument
527 vchan_get_all_descriptors(&s3cchan->vc, &head); in s3c24xx_dma_free_txd_list()
528 vchan_dma_desc_free_list(&s3cchan->vc, &head); in s3c24xx_dma_free_txd_list()
536 static void s3c24xx_dma_phy_alloc_and_start(struct s3c24xx_dma_chan *s3cchan) in s3c24xx_dma_phy_alloc_and_start() argument
538 struct s3c24xx_dma_engine *s3cdma = s3cchan->host; in s3c24xx_dma_phy_alloc_and_start()
541 phy = s3c24xx_dma_get_phy(s3cchan); in s3c24xx_dma_phy_alloc_and_start()
544 s3cchan->name); in s3c24xx_dma_phy_alloc_and_start()
545 s3cchan->state = S3C24XX_DMA_CHAN_WAITING; in s3c24xx_dma_phy_alloc_and_start()
550 phy->id, s3cchan->name); in s3c24xx_dma_phy_alloc_and_start()
552 s3cchan->phy = phy; in s3c24xx_dma_phy_alloc_and_start()
553 s3cchan->state = S3C24XX_DMA_CHAN_RUNNING; in s3c24xx_dma_phy_alloc_and_start()
555 s3c24xx_dma_start_next_txd(s3cchan); in s3c24xx_dma_phy_alloc_and_start()
559 struct s3c24xx_dma_chan *s3cchan) in s3c24xx_dma_phy_reassign_start() argument
561 struct s3c24xx_dma_engine *s3cdma = s3cchan->host; in s3c24xx_dma_phy_reassign_start()
564 phy->id, s3cchan->name); in s3c24xx_dma_phy_reassign_start()
571 phy->serving = s3cchan; in s3c24xx_dma_phy_reassign_start()
572 s3cchan->phy = phy; in s3c24xx_dma_phy_reassign_start()
573 s3cchan->state = S3C24XX_DMA_CHAN_RUNNING; in s3c24xx_dma_phy_reassign_start()
574 s3c24xx_dma_start_next_txd(s3cchan); in s3c24xx_dma_phy_reassign_start()
581 static void s3c24xx_dma_phy_free(struct s3c24xx_dma_chan *s3cchan) in s3c24xx_dma_phy_free() argument
583 struct s3c24xx_dma_engine *s3cdma = s3cchan->host; in s3c24xx_dma_phy_free()
600 s3c24xx_dma_phy_valid(p, s3cchan->phy)) { in s3c24xx_dma_phy_free()
607 s3c24xx_dma_terminate_phy(s3cchan->phy); in s3c24xx_dma_phy_free()
620 s3c24xx_dma_phy_reassign_start(s3cchan->phy, next); in s3c24xx_dma_phy_free()
628 s3c24xx_dma_put_phy(s3cchan->phy); in s3c24xx_dma_phy_free()
631 s3cchan->phy = NULL; in s3c24xx_dma_phy_free()
632 s3cchan->state = S3C24XX_DMA_CHAN_IDLE; in s3c24xx_dma_phy_free()
638 struct s3c24xx_dma_chan *s3cchan = to_s3c24xx_dma_chan(vd->tx.chan); in s3c24xx_dma_desc_free() local
640 if (!s3cchan->slave) in s3c24xx_dma_desc_free()
649 struct s3c24xx_dma_chan *s3cchan = phy->serving; in s3c24xx_dma_irq() local
661 if (unlikely(!s3cchan)) { in s3c24xx_dma_irq()
670 spin_lock(&s3cchan->vc.lock); in s3c24xx_dma_irq()
671 txd = s3cchan->at; in s3c24xx_dma_irq()
678 s3c24xx_dma_start_next_sg(s3cchan, txd); in s3c24xx_dma_irq()
680 s3cchan->at = NULL; in s3c24xx_dma_irq()
687 if (vchan_next_desc(&s3cchan->vc)) in s3c24xx_dma_irq()
688 s3c24xx_dma_start_next_txd(s3cchan); in s3c24xx_dma_irq()
690 s3c24xx_dma_phy_free(s3cchan); in s3c24xx_dma_irq()
696 s3c24xx_dma_start_next_sg(s3cchan, txd); in s3c24xx_dma_irq()
699 spin_unlock(&s3cchan->vc.lock); in s3c24xx_dma_irq()
710 struct s3c24xx_dma_chan *s3cchan = to_s3c24xx_dma_chan(chan); in s3c24xx_dma_terminate_all() local
711 struct s3c24xx_dma_engine *s3cdma = s3cchan->host; in s3c24xx_dma_terminate_all()
715 spin_lock_irqsave(&s3cchan->vc.lock, flags); in s3c24xx_dma_terminate_all()
717 if (!s3cchan->phy && !s3cchan->at) { in s3c24xx_dma_terminate_all()
719 s3cchan->id); in s3c24xx_dma_terminate_all()
724 s3cchan->state = S3C24XX_DMA_CHAN_IDLE; in s3c24xx_dma_terminate_all()
727 if (s3cchan->phy) in s3c24xx_dma_terminate_all()
728 s3c24xx_dma_phy_free(s3cchan); in s3c24xx_dma_terminate_all()
731 if (s3cchan->at) { in s3c24xx_dma_terminate_all()
732 vchan_terminate_vdesc(&s3cchan->at->vd); in s3c24xx_dma_terminate_all()
733 s3cchan->at = NULL; in s3c24xx_dma_terminate_all()
737 s3c24xx_dma_free_txd_list(s3cdma, s3cchan); in s3c24xx_dma_terminate_all()
739 spin_unlock_irqrestore(&s3cchan->vc.lock, flags); in s3c24xx_dma_terminate_all()
746 struct s3c24xx_dma_chan *s3cchan = to_s3c24xx_dma_chan(chan); in s3c24xx_dma_synchronize() local
748 vchan_synchronize(&s3cchan->vc); in s3c24xx_dma_synchronize()
760 struct s3c24xx_dma_chan *s3cchan = to_s3c24xx_dma_chan(chan); in s3c24xx_dma_tx_status() local
768 spin_lock_irqsave(&s3cchan->vc.lock, flags); in s3c24xx_dma_tx_status()
776 spin_unlock_irqrestore(&s3cchan->vc.lock, flags); in s3c24xx_dma_tx_status()
780 vd = vchan_find_desc(&s3cchan->vc, cookie); in s3c24xx_dma_tx_status()
792 txd = s3cchan->at; in s3c24xx_dma_tx_status()
798 bytes += s3c24xx_dma_getbytes_chan(s3cchan); in s3c24xx_dma_tx_status()
800 spin_unlock_irqrestore(&s3cchan->vc.lock, flags); in s3c24xx_dma_tx_status()
819 struct s3c24xx_dma_chan *s3cchan = to_s3c24xx_dma_chan(chan); in s3c24xx_dma_prep_memcpy() local
820 struct s3c24xx_dma_engine *s3cdma = s3cchan->host; in s3c24xx_dma_prep_memcpy()
826 len, s3cchan->name); in s3c24xx_dma_prep_memcpy()
874 return vchan_tx_prep(&s3cchan->vc, &txd->vd, flags); in s3c24xx_dma_prep_memcpy()
881 struct s3c24xx_dma_chan *s3cchan = to_s3c24xx_dma_chan(chan); in s3c24xx_dma_prep_dma_cyclic() local
882 struct s3c24xx_dma_engine *s3cdma = s3cchan->host; in s3c24xx_dma_prep_dma_cyclic()
884 struct s3c24xx_dma_channel *cdata = &pdata->channels[s3cchan->id]; in s3c24xx_dma_prep_dma_cyclic()
894 size, period, s3cchan->name); in s3c24xx_dma_prep_dma_cyclic()
938 slave_addr = s3cchan->cfg.dst_addr; in s3c24xx_dma_prep_dma_cyclic()
939 txd->width = s3cchan->cfg.dst_addr_width; in s3c24xx_dma_prep_dma_cyclic()
944 slave_addr = s3cchan->cfg.src_addr; in s3c24xx_dma_prep_dma_cyclic()
945 txd->width = s3cchan->cfg.src_addr_width; in s3c24xx_dma_prep_dma_cyclic()
971 return vchan_tx_prep(&s3cchan->vc, &txd->vd, flags); in s3c24xx_dma_prep_dma_cyclic()
979 struct s3c24xx_dma_chan *s3cchan = to_s3c24xx_dma_chan(chan); in s3c24xx_dma_prep_slave_sg() local
980 struct s3c24xx_dma_engine *s3cdma = s3cchan->host; in s3c24xx_dma_prep_slave_sg()
982 struct s3c24xx_dma_channel *cdata = &pdata->channels[s3cchan->id]; in s3c24xx_dma_prep_slave_sg()
991 sg_dma_len(sgl), s3cchan->name); in s3c24xx_dma_prep_slave_sg()
1027 slave_addr = s3cchan->cfg.dst_addr; in s3c24xx_dma_prep_slave_sg()
1028 txd->width = s3cchan->cfg.dst_addr_width; in s3c24xx_dma_prep_slave_sg()
1033 slave_addr = s3cchan->cfg.src_addr; in s3c24xx_dma_prep_slave_sg()
1034 txd->width = s3cchan->cfg.src_addr_width; in s3c24xx_dma_prep_slave_sg()
1060 return vchan_tx_prep(&s3cchan->vc, &txd->vd, flags); in s3c24xx_dma_prep_slave_sg()
1069 struct s3c24xx_dma_chan *s3cchan = to_s3c24xx_dma_chan(chan); in s3c24xx_dma_issue_pending() local
1072 spin_lock_irqsave(&s3cchan->vc.lock, flags); in s3c24xx_dma_issue_pending()
1073 if (vchan_issue_pending(&s3cchan->vc)) { in s3c24xx_dma_issue_pending()
1074 if (!s3cchan->phy && s3cchan->state != S3C24XX_DMA_CHAN_WAITING) in s3c24xx_dma_issue_pending()
1075 s3c24xx_dma_phy_alloc_and_start(s3cchan); in s3c24xx_dma_issue_pending()
1077 spin_unlock_irqrestore(&s3cchan->vc.lock, flags); in s3c24xx_dma_issue_pending()
1415 struct s3c24xx_dma_chan *s3cchan; in s3c24xx_dma_filter() local
1420 s3cchan = to_s3c24xx_dma_chan(chan); in s3c24xx_dma_filter()
1422 return s3cchan->id == (uintptr_t)param; in s3c24xx_dma_filter()