Lines Matching full:dw
19 #include "dw-edma-core.h"
20 #include "dw-edma-v0-core.h"
21 #include "dw-hdma-v0-core.h"
46 struct dw_edma_chip *chip = chan->dw->chip; in dw_edma_get_pci_address()
78 struct dw_edma_chip *chip = desc->chan->dw->chip; in dw_edma_alloc_chunk()
187 struct dw_edma *dw = chan->dw; in dw_edma_start_transfer() local
205 dw_edma_core_start(dw, child, !desc->xfer_sz); in dw_edma_start_transfer()
220 if (chan->dw->chip->flags & DW_EDMA_CHIP_LOCAL) { in dw_edma_device_caps()
389 * If eDMA is embedded into the DW PCIe RP/EP and controlled from the in dw_edma_device_transfer()
404 if (chan->dw->chip->flags & DW_EDMA_CHIP_LOCAL) { in dw_edma_device_transfer()
710 static int dw_edma_channel_setup(struct dw_edma *dw, u32 wr_alloc, u32 rd_alloc) in dw_edma_channel_setup() argument
712 struct dw_edma_chip *chip = dw->chip; in dw_edma_channel_setup()
720 ch_cnt = dw->wr_ch_cnt + dw->rd_ch_cnt; in dw_edma_channel_setup()
721 dma = &dw->dma; in dw_edma_channel_setup()
726 chan = &dw->chan[i]; in dw_edma_channel_setup()
728 chan->dw = dw; in dw_edma_channel_setup()
730 if (i < dw->wr_ch_cnt) { in dw_edma_channel_setup()
734 chan->id = i - dw->wr_ch_cnt; in dw_edma_channel_setup()
752 if (dw->nr_irqs == 1) in dw_edma_channel_setup()
759 irq = &dw->irq[pos]; in dw_edma_channel_setup()
766 irq->dw = dw; in dw_edma_channel_setup()
776 &dw->chip->dt_region_wr[chan->id] : in dw_edma_channel_setup()
777 &dw->chip->dt_region_rd[chan->id]; in dw_edma_channel_setup()
830 static int dw_edma_irq_request(struct dw_edma *dw, in dw_edma_irq_request() argument
833 struct dw_edma_chip *chip = dw->chip; in dw_edma_irq_request()
834 struct device *dev = dw->chip->dev; in dw_edma_irq_request()
841 ch_cnt = dw->wr_ch_cnt + dw->rd_ch_cnt; in dw_edma_irq_request()
846 dw->irq = devm_kcalloc(dev, chip->nr_irqs, sizeof(*dw->irq), GFP_KERNEL); in dw_edma_irq_request()
847 if (!dw->irq) in dw_edma_irq_request()
854 IRQF_SHARED, dw->name, &dw->irq[0]); in dw_edma_irq_request()
856 dw->nr_irqs = 0; in dw_edma_irq_request()
861 get_cached_msi_msg(irq, &dw->irq[0].msi); in dw_edma_irq_request()
863 dw->nr_irqs = 1; in dw_edma_irq_request()
869 dw_edma_dec_irq_alloc(&tmp, wr_alloc, dw->wr_ch_cnt); in dw_edma_irq_request()
870 dw_edma_dec_irq_alloc(&tmp, rd_alloc, dw->rd_ch_cnt); in dw_edma_irq_request()
873 dw_edma_add_irq_mask(&wr_mask, *wr_alloc, dw->wr_ch_cnt); in dw_edma_irq_request()
874 dw_edma_add_irq_mask(&rd_mask, *rd_alloc, dw->rd_ch_cnt); in dw_edma_irq_request()
882 IRQF_SHARED, dw->name, in dw_edma_irq_request()
883 &dw->irq[i]); in dw_edma_irq_request()
888 get_cached_msi_msg(irq, &dw->irq[i].msi); in dw_edma_irq_request()
891 dw->nr_irqs = i; in dw_edma_irq_request()
899 free_irq(irq, &dw->irq[i]); in dw_edma_irq_request()
908 struct dw_edma *dw; in dw_edma_probe() local
920 dw = devm_kzalloc(dev, sizeof(*dw), GFP_KERNEL); in dw_edma_probe()
921 if (!dw) in dw_edma_probe()
924 dw->chip = chip; in dw_edma_probe()
926 if (dw->chip->mf == EDMA_MF_HDMA_NATIVE) in dw_edma_probe()
927 dw_hdma_v0_core_register(dw); in dw_edma_probe()
929 dw_edma_v0_core_register(dw); in dw_edma_probe()
931 raw_spin_lock_init(&dw->lock); in dw_edma_probe()
933 dw->wr_ch_cnt = min_t(u16, chip->ll_wr_cnt, in dw_edma_probe()
934 dw_edma_core_ch_count(dw, EDMA_DIR_WRITE)); in dw_edma_probe()
935 dw->wr_ch_cnt = min_t(u16, dw->wr_ch_cnt, EDMA_MAX_WR_CH); in dw_edma_probe()
937 dw->rd_ch_cnt = min_t(u16, chip->ll_rd_cnt, in dw_edma_probe()
938 dw_edma_core_ch_count(dw, EDMA_DIR_READ)); in dw_edma_probe()
939 dw->rd_ch_cnt = min_t(u16, dw->rd_ch_cnt, EDMA_MAX_RD_CH); in dw_edma_probe()
941 if (!dw->wr_ch_cnt && !dw->rd_ch_cnt) in dw_edma_probe()
945 dw->wr_ch_cnt, dw->rd_ch_cnt); in dw_edma_probe()
948 dw->chan = devm_kcalloc(dev, dw->wr_ch_cnt + dw->rd_ch_cnt, in dw_edma_probe()
949 sizeof(*dw->chan), GFP_KERNEL); in dw_edma_probe()
950 if (!dw->chan) in dw_edma_probe()
953 snprintf(dw->name, sizeof(dw->name), "dw-edma-core:%s", in dw_edma_probe()
957 dw_edma_core_off(dw); in dw_edma_probe()
960 err = dw_edma_irq_request(dw, &wr_alloc, &rd_alloc); in dw_edma_probe()
965 err = dw_edma_channel_setup(dw, wr_alloc, rd_alloc); in dw_edma_probe()
970 dw_edma_core_debugfs_on(dw); in dw_edma_probe()
972 chip->dw = dw; in dw_edma_probe()
977 for (i = (dw->nr_irqs - 1); i >= 0; i--) in dw_edma_probe()
978 free_irq(chip->ops->irq_vector(dev, i), &dw->irq[i]); in dw_edma_probe()
988 struct dw_edma *dw = chip->dw; in dw_edma_remove() local
992 if (!dw) in dw_edma_remove()
996 dw_edma_core_off(dw); in dw_edma_remove()
999 for (i = (dw->nr_irqs - 1); i >= 0; i--) in dw_edma_remove()
1000 free_irq(chip->ops->irq_vector(dev, i), &dw->irq[i]); in dw_edma_remove()
1003 dma_async_device_unregister(&dw->dma); in dw_edma_remove()
1004 list_for_each_entry_safe(chan, _chan, &dw->dma.channels, in dw_edma_remove()