Lines Matching +full:mixed +full:- +full:burst
2 * Copyright (C) 2013-2014 Renesas Electronics Europe Ltd.
13 #include <linux/dma-mapping.h>
26 #include <dt-bindings/dma/nbpfaxi.h>
108 * 1. high-level descriptor, containing a struct dma_async_tx_descriptor object
112 * allocated from coherent memory - one per SG segment
115 * together with link descriptors as mixed (DMA / CPU) objects, or (b)
119 * Therefore for both cases (a) and (b) at run-time objects (2) and (3) shall be
146 * struct nbpf_desc - DMA transfer descriptor
164 #define NBPF_DESCS_PER_PAGE ((PAGE_SIZE - sizeof(struct list_head)) / \
178 * struct nbpf_channel - one DMAC channel
186 * @slave_burst:maximum slave burst size in bytes
188 * @dmarq_cfg: DMA request line configuration - high / low, edge / level for NBPF_CHAN_CFG
195 * @done: list of completed descriptors, waiting post-processing
196 * @desc_page: list of additionally allocated descriptor pages - if any
292 * we try to separate the hardware-specific part from the (largely) generic
299 /* Hardware-specific part */
304 u32 data = ioread32(chan->base + offset); in nbpf_chan_read()
305 dev_dbg(chan->dma_chan.device->dev, "%s(0x%p + 0x%x) = 0x%x\n", in nbpf_chan_read()
306 __func__, chan->base, offset, data); in nbpf_chan_read()
313 iowrite32(data, chan->base + offset); in nbpf_chan_write()
314 dev_dbg(chan->dma_chan.device->dev, "%s(0x%p + 0x%x) = 0x%x\n", in nbpf_chan_write()
315 __func__, chan->base, offset, data); in nbpf_chan_write()
321 u32 data = ioread32(nbpf->base + offset); in nbpf_read()
322 dev_dbg(nbpf->dma_dev.dev, "%s(0x%p + 0x%x) = 0x%x\n", in nbpf_read()
323 __func__, nbpf->base, offset, data); in nbpf_read()
330 iowrite32(data, nbpf->base + offset); in nbpf_write()
331 dev_dbg(nbpf->dma_dev.dev, "%s(0x%p + 0x%x) = 0x%x\n", in nbpf_write()
332 __func__, nbpf->base, offset, data); in nbpf_write()
342 u32 status = nbpf_read(chan->nbpf, NBPF_DSTAT_END); in nbpf_status_get()
344 return status & BIT(chan - chan->nbpf->chan); in nbpf_status_get()
359 return nbpf->chan + __ffs(error); in nbpf_error_get_channel()
370 for (i = 1000; i; i--) { in nbpf_error_clear()
378 dev_err(chan->dma_chan.device->dev, in nbpf_error_clear()
386 struct nbpf_channel *chan = desc->chan; in nbpf_start()
387 struct nbpf_link_desc *ldesc = list_first_entry(&desc->sg, struct nbpf_link_desc, node); in nbpf_start()
389 nbpf_chan_write(chan, NBPF_CHAN_NXLA, (u32)ldesc->hwdesc_dma_addr); in nbpf_start()
391 chan->paused = false; in nbpf_start()
393 /* Software trigger MEMCPY - only MEMCPY uses the block mode */ in nbpf_start()
394 if (ldesc->hwdesc->config & NBPF_CHAN_CFG_TM) in nbpf_start()
397 dev_dbg(chan->nbpf->dma_dev.dev, "%s(): next 0x%x, cur 0x%x\n", __func__, in nbpf_start()
405 chan->dmarq_cfg = (chan->flags & NBPF_SLAVE_RQ_HIGH ? NBPF_CHAN_CFG_HIEN : 0) | in nbpf_chan_prepare()
406 (chan->flags & NBPF_SLAVE_RQ_LOW ? NBPF_CHAN_CFG_LOEN : 0) | in nbpf_chan_prepare()
407 (chan->flags & NBPF_SLAVE_RQ_LEVEL ? in nbpf_chan_prepare()
409 chan->terminal; in nbpf_chan_prepare()
415 chan->dmarq_cfg = NBPF_CHAN_CFG_AM & 0x400; in nbpf_chan_prepare_default()
416 chan->terminal = 0; in nbpf_chan_prepare_default()
417 chan->flags = 0; in nbpf_chan_prepare_default()
425 * per-transfer configuration will be loaded from transfer descriptors. in nbpf_chan_configure()
427 nbpf_chan_write(chan, NBPF_CHAN_CFG, NBPF_CHAN_CFG_DMS | chan->dmarq_cfg); in nbpf_chan_configure()
433 int max_burst = nbpf->config->buffer_size * 8; in nbpf_xfer_ds()
435 if (nbpf->max_burst_mem_read || nbpf->max_burst_mem_write) { in nbpf_xfer_ds()
438 max_burst = min_not_zero(nbpf->max_burst_mem_read, in nbpf_xfer_ds()
439 nbpf->max_burst_mem_write); in nbpf_xfer_ds()
442 if (nbpf->max_burst_mem_read) in nbpf_xfer_ds()
443 max_burst = nbpf->max_burst_mem_read; in nbpf_xfer_ds()
446 if (nbpf->max_burst_mem_write) in nbpf_xfer_ds()
447 max_burst = nbpf->max_burst_mem_write; in nbpf_xfer_ds()
460 enum dma_slave_buswidth width, u32 burst) in nbpf_xfer_size() argument
464 if (!burst) in nbpf_xfer_size()
465 burst = 1; in nbpf_xfer_size()
469 size = 8 * burst; in nbpf_xfer_size()
473 size = 4 * burst; in nbpf_xfer_size()
477 size = 2 * burst; in nbpf_xfer_size()
484 size = burst; in nbpf_xfer_size()
495 * a timeout, if no more data arrives - receive what's already there. We want to
498 * to recognise such slaves. We use a data-width check to distinguish between
506 struct nbpf_link_reg *hwdesc = ldesc->hwdesc; in nbpf_prep_one()
507 struct nbpf_desc *desc = ldesc->desc; in nbpf_prep_one()
508 struct nbpf_channel *chan = desc->chan; in nbpf_prep_one()
509 struct device *dev = chan->dma_chan.device->dev; in nbpf_prep_one()
513 hwdesc->header = NBPF_HEADER_WBD | NBPF_HEADER_LV | in nbpf_prep_one()
516 hwdesc->src_addr = src; in nbpf_prep_one()
517 hwdesc->dst_addr = dst; in nbpf_prep_one()
518 hwdesc->transaction_size = size; in nbpf_prep_one()
529 * e.g. with serial drivers like amba-pl011.c. For reception it sets up in nbpf_prep_one()
532 * in the Rx FIFO. For this to work with the RAM side using burst in nbpf_prep_one()
536 mem_xfer = nbpf_xfer_ds(chan->nbpf, size, direction); in nbpf_prep_one()
540 can_burst = chan->slave_src_width >= 3; in nbpf_prep_one()
542 chan->slave_src_burst : chan->slave_src_width); in nbpf_prep_one()
547 if (mem_xfer > chan->slave_src_burst && !can_burst) in nbpf_prep_one()
548 mem_xfer = chan->slave_src_burst; in nbpf_prep_one()
549 /* Device-to-RAM DMA is unreliable without REQD set */ in nbpf_prep_one()
550 hwdesc->config = NBPF_CHAN_CFG_SAD | (NBPF_CHAN_CFG_DDS & (mem_xfer << 16)) | in nbpf_prep_one()
556 slave_xfer = min(mem_xfer, chan->slave_dst_width >= 3 ? in nbpf_prep_one()
557 chan->slave_dst_burst : chan->slave_dst_width); in nbpf_prep_one()
558 hwdesc->config = NBPF_CHAN_CFG_DAD | (NBPF_CHAN_CFG_SDS & (mem_xfer << 12)) | in nbpf_prep_one()
563 hwdesc->config = NBPF_CHAN_CFG_TCM | NBPF_CHAN_CFG_TM | in nbpf_prep_one()
569 return -EINVAL; in nbpf_prep_one()
572 hwdesc->config |= chan->dmarq_cfg | (last ? 0 : NBPF_CHAN_CFG_DEM) | in nbpf_prep_one()
575 dev_dbg(dev, "%s(): desc @ %pad: hdr 0x%x, cfg 0x%x, %zu @ %pad -> %pad\n", in nbpf_prep_one()
576 __func__, &ldesc->hwdesc_dma_addr, hwdesc->header, in nbpf_prep_one()
577 hwdesc->config, size, &src, &dst); in nbpf_prep_one()
579 dma_sync_single_for_device(dev, ldesc->hwdesc_dma_addr, sizeof(*hwdesc), in nbpf_prep_one()
603 dev_dbg(dchan->device->dev, "Entry %s()\n", __func__); in nbpf_issue_pending()
605 spin_lock_irqsave(&chan->lock, flags); in nbpf_issue_pending()
606 if (list_empty(&chan->queued)) in nbpf_issue_pending()
609 list_splice_tail_init(&chan->queued, &chan->active); in nbpf_issue_pending()
611 if (!chan->running) { in nbpf_issue_pending()
612 struct nbpf_desc *desc = list_first_entry(&chan->active, in nbpf_issue_pending()
615 chan->running = desc; in nbpf_issue_pending()
619 spin_unlock_irqrestore(&chan->lock, flags); in nbpf_issue_pending()
632 spin_lock_irqsave(&chan->lock, flags); in nbpf_tx_status()
633 running = chan->running ? chan->running->async_tx.cookie : -EINVAL; in nbpf_tx_status()
636 state->residue = nbpf_bytes_left(chan); in nbpf_tx_status()
637 dev_dbg(dchan->device->dev, "%s(): residue %u\n", __func__, in nbpf_tx_status()
638 state->residue); in nbpf_tx_status()
643 list_for_each_entry(desc, &chan->active, node) in nbpf_tx_status()
644 if (desc->async_tx.cookie == cookie) { in nbpf_tx_status()
650 list_for_each_entry(desc, &chan->queued, node) in nbpf_tx_status()
651 if (desc->async_tx.cookie == cookie) { in nbpf_tx_status()
657 state->residue = found ? desc->length : 0; in nbpf_tx_status()
660 spin_unlock_irqrestore(&chan->lock, flags); in nbpf_tx_status()
663 if (chan->paused) in nbpf_tx_status()
672 struct nbpf_channel *chan = desc->chan; in nbpf_tx_submit()
676 spin_lock_irqsave(&chan->lock, flags); in nbpf_tx_submit()
678 list_add_tail(&desc->node, &chan->queued); in nbpf_tx_submit()
679 spin_unlock_irqrestore(&chan->lock, flags); in nbpf_tx_submit()
681 dev_dbg(chan->dma_chan.device->dev, "Entry %s(%d)\n", __func__, cookie); in nbpf_tx_submit()
688 struct dma_chan *dchan = &chan->dma_chan; in nbpf_desc_page_alloc()
696 struct device *dev = dchan->device->dev; in nbpf_desc_page_alloc()
699 return -ENOMEM; in nbpf_desc_page_alloc()
704 for (i = 0, ldesc = dpage->ldesc, hwdesc = dpage->hwdesc; in nbpf_desc_page_alloc()
705 i < ARRAY_SIZE(dpage->ldesc); in nbpf_desc_page_alloc()
707 ldesc->hwdesc = hwdesc; in nbpf_desc_page_alloc()
708 list_add_tail(&ldesc->node, &lhead); in nbpf_desc_page_alloc()
709 ldesc->hwdesc_dma_addr = dma_map_single(dchan->device->dev, in nbpf_desc_page_alloc()
713 hwdesc, &ldesc->hwdesc_dma_addr); in nbpf_desc_page_alloc()
716 for (i = 0, desc = dpage->desc; in nbpf_desc_page_alloc()
717 i < ARRAY_SIZE(dpage->desc); in nbpf_desc_page_alloc()
719 dma_async_tx_descriptor_init(&desc->async_tx, dchan); in nbpf_desc_page_alloc()
720 desc->async_tx.tx_submit = nbpf_tx_submit; in nbpf_desc_page_alloc()
721 desc->chan = chan; in nbpf_desc_page_alloc()
722 INIT_LIST_HEAD(&desc->sg); in nbpf_desc_page_alloc()
723 list_add_tail(&desc->node, &head); in nbpf_desc_page_alloc()
730 spin_lock_irq(&chan->lock); in nbpf_desc_page_alloc()
731 list_splice_tail(&lhead, &chan->free_links); in nbpf_desc_page_alloc()
732 list_splice_tail(&head, &chan->free); in nbpf_desc_page_alloc()
733 list_add(&dpage->node, &chan->desc_page); in nbpf_desc_page_alloc()
734 spin_unlock_irq(&chan->lock); in nbpf_desc_page_alloc()
736 return ARRAY_SIZE(dpage->desc); in nbpf_desc_page_alloc()
741 struct nbpf_channel *chan = desc->chan; in nbpf_desc_put()
745 spin_lock_irqsave(&chan->lock, flags); in nbpf_desc_put()
746 list_for_each_entry_safe(ldesc, tmp, &desc->sg, node) in nbpf_desc_put()
747 list_move(&ldesc->node, &chan->free_links); in nbpf_desc_put()
749 list_add(&desc->node, &chan->free); in nbpf_desc_put()
750 spin_unlock_irqrestore(&chan->lock, flags); in nbpf_desc_put()
759 spin_lock_irqsave(&chan->lock, flags); in nbpf_scan_acked()
760 list_for_each_entry_safe(desc, tmp, &chan->done, node) in nbpf_scan_acked()
761 if (async_tx_test_ack(&desc->async_tx) && desc->user_wait) { in nbpf_scan_acked()
762 list_move(&desc->node, &head); in nbpf_scan_acked()
763 desc->user_wait = false; in nbpf_scan_acked()
765 spin_unlock_irqrestore(&chan->lock, flags); in nbpf_scan_acked()
768 list_del(&desc->node); in nbpf_scan_acked()
775 * before we re-acquire the lock buffers can be taken already, so we have to
776 * re-check after re-acquiring the lock and possibly retry, if buffers are gone
786 spin_lock_irq(&chan->lock); in nbpf_desc_get()
791 if (list_empty(&chan->free)) { in nbpf_desc_get()
793 spin_unlock_irq(&chan->lock); in nbpf_desc_get()
797 spin_lock_irq(&chan->lock); in nbpf_desc_get()
800 desc = list_first_entry(&chan->free, struct nbpf_desc, node); in nbpf_desc_get()
801 list_del(&desc->node); in nbpf_desc_get()
804 if (list_empty(&chan->free_links)) { in nbpf_desc_get()
806 spin_unlock_irq(&chan->lock); in nbpf_desc_get()
812 spin_lock_irq(&chan->lock); in nbpf_desc_get()
816 ldesc = list_first_entry(&chan->free_links, in nbpf_desc_get()
818 ldesc->desc = desc; in nbpf_desc_get()
820 prev->hwdesc->next = (u32)ldesc->hwdesc_dma_addr; in nbpf_desc_get()
823 list_move_tail(&ldesc->node, &desc->sg); in nbpf_desc_get()
829 prev->hwdesc->next = 0; in nbpf_desc_get()
831 spin_unlock_irq(&chan->lock); in nbpf_desc_get()
842 spin_lock_irqsave(&chan->lock, flags); in nbpf_chan_idle()
844 list_splice_init(&chan->done, &head); in nbpf_chan_idle()
845 list_splice_init(&chan->active, &head); in nbpf_chan_idle()
846 list_splice_init(&chan->queued, &head); in nbpf_chan_idle()
848 chan->running = NULL; in nbpf_chan_idle()
850 spin_unlock_irqrestore(&chan->lock, flags); in nbpf_chan_idle()
853 dev_dbg(chan->nbpf->dma_dev.dev, "%s(): force-free desc %p cookie %d\n", in nbpf_chan_idle()
854 __func__, desc, desc->async_tx.cookie); in nbpf_chan_idle()
855 list_del(&desc->node); in nbpf_chan_idle()
864 dev_dbg(dchan->device->dev, "Entry %s\n", __func__); in nbpf_pause()
866 chan->paused = true; in nbpf_pause()
878 dev_dbg(dchan->device->dev, "Entry %s\n", __func__); in nbpf_terminate_all()
879 dev_dbg(dchan->device->dev, "Terminating\n"); in nbpf_terminate_all()
892 dev_dbg(dchan->device->dev, "Entry %s\n", __func__); in nbpf_config()
895 * We could check config->slave_id to match chan->terminal here, in nbpf_config()
900 chan->slave_dst_addr = config->dst_addr; in nbpf_config()
901 chan->slave_dst_width = nbpf_xfer_size(chan->nbpf, in nbpf_config()
902 config->dst_addr_width, 1); in nbpf_config()
903 chan->slave_dst_burst = nbpf_xfer_size(chan->nbpf, in nbpf_config()
904 config->dst_addr_width, in nbpf_config()
905 config->dst_maxburst); in nbpf_config()
906 chan->slave_src_addr = config->src_addr; in nbpf_config()
907 chan->slave_src_width = nbpf_xfer_size(chan->nbpf, in nbpf_config()
908 config->src_addr_width, 1); in nbpf_config()
909 chan->slave_src_burst = nbpf_xfer_size(chan->nbpf, in nbpf_config()
910 config->src_addr_width, in nbpf_config()
911 config->src_maxburst); in nbpf_config()
952 desc->async_tx.flags = flags; in nbpf_prep_sg()
953 desc->async_tx.cookie = -EBUSY; in nbpf_prep_sg()
954 desc->user_wait = false; in nbpf_prep_sg()
960 list_for_each_entry(ldesc, &desc->sg, node) { in nbpf_prep_sg()
965 i == len - 1); in nbpf_prep_sg()
979 desc->length = data_len; in nbpf_prep_sg()
982 return &desc->async_tx; in nbpf_prep_sg()
1002 dev_dbg(dchan->device->dev, "%s(): %zu @ %pad -> %pad\n", in nbpf_prep_memcpy()
1016 dev_dbg(dchan->device->dev, "Entry %s()\n", __func__); in nbpf_prep_slave_sg()
1022 sg_dma_address(&slave_sg) = chan->slave_dst_addr; in nbpf_prep_slave_sg()
1027 sg_dma_address(&slave_sg) = chan->slave_src_addr; in nbpf_prep_slave_sg()
1041 INIT_LIST_HEAD(&chan->free); in nbpf_alloc_chan_resources()
1042 INIT_LIST_HEAD(&chan->free_links); in nbpf_alloc_chan_resources()
1043 INIT_LIST_HEAD(&chan->queued); in nbpf_alloc_chan_resources()
1044 INIT_LIST_HEAD(&chan->active); in nbpf_alloc_chan_resources()
1045 INIT_LIST_HEAD(&chan->done); in nbpf_alloc_chan_resources()
1051 dev_dbg(dchan->device->dev, "Entry %s(): terminal %u\n", __func__, in nbpf_alloc_chan_resources()
1052 chan->terminal); in nbpf_alloc_chan_resources()
1064 dev_dbg(dchan->device->dev, "Entry %s()\n", __func__); in nbpf_free_chan_resources()
1068 /* Clean up for if a channel is re-used for MEMCPY after slave DMA */ in nbpf_free_chan_resources()
1071 list_for_each_entry_safe(dpage, tmp, &chan->desc_page, node) { in nbpf_free_chan_resources()
1074 list_del(&dpage->node); in nbpf_free_chan_resources()
1075 for (i = 0, ldesc = dpage->ldesc; in nbpf_free_chan_resources()
1076 i < ARRAY_SIZE(dpage->ldesc); in nbpf_free_chan_resources()
1078 dma_unmap_single(dchan->device->dev, ldesc->hwdesc_dma_addr, in nbpf_free_chan_resources()
1079 sizeof(*ldesc->hwdesc), DMA_TO_DEVICE); in nbpf_free_chan_resources()
1087 struct nbpf_device *nbpf = ofdma->of_dma_data; in nbpf_of_xlate()
1091 if (dma_spec->args_count != 2) in nbpf_of_xlate()
1094 dchan = dma_get_any_slave_channel(&nbpf->dma_dev); in nbpf_of_xlate()
1098 dev_dbg(dchan->device->dev, "Entry %s(%s)\n", __func__, in nbpf_of_xlate()
1099 dma_spec->np->name); in nbpf_of_xlate()
1103 chan->terminal = dma_spec->args[0]; in nbpf_of_xlate()
1104 chan->flags = dma_spec->args[1]; in nbpf_of_xlate()
1118 while (!list_empty(&chan->done)) { in nbpf_chan_tasklet()
1121 spin_lock_irq(&chan->lock); in nbpf_chan_tasklet()
1123 list_for_each_entry_safe(desc, tmp, &chan->done, node) { in nbpf_chan_tasklet()
1124 if (!desc->user_wait) { in nbpf_chan_tasklet()
1128 } else if (async_tx_test_ack(&desc->async_tx)) { in nbpf_chan_tasklet()
1133 list_del(&desc->node); in nbpf_chan_tasklet()
1134 spin_unlock_irq(&chan->lock); in nbpf_chan_tasklet()
1146 spin_unlock_irq(&chan->lock); in nbpf_chan_tasklet()
1150 dma_cookie_complete(&desc->async_tx); in nbpf_chan_tasklet()
1156 if (async_tx_test_ack(&desc->async_tx)) { in nbpf_chan_tasklet()
1157 list_del(&desc->node); in nbpf_chan_tasklet()
1160 desc->user_wait = true; in nbpf_chan_tasklet()
1164 dmaengine_desc_get_callback(&desc->async_tx, &cb); in nbpf_chan_tasklet()
1167 spin_unlock_irq(&chan->lock); in nbpf_chan_tasklet()
1189 dev_dbg(&chan->dma_chan.dev->device, "%s()\n", __func__); in nbpf_chan_irq()
1191 spin_lock(&chan->lock); in nbpf_chan_irq()
1192 desc = chan->running; in nbpf_chan_irq()
1201 list_move_tail(&desc->node, &chan->done); in nbpf_chan_irq()
1202 chan->running = NULL; in nbpf_chan_irq()
1204 if (!list_empty(&chan->active)) { in nbpf_chan_irq()
1205 desc = list_first_entry(&chan->active, in nbpf_chan_irq()
1208 chan->running = desc; in nbpf_chan_irq()
1212 spin_unlock(&chan->lock); in nbpf_chan_irq()
1215 tasklet_schedule(&chan->tasklet); in nbpf_chan_irq()
1225 dev_warn(nbpf->dma_dev.dev, "DMA error IRQ %u\n", irq); in nbpf_err_irq()
1243 struct dma_device *dma_dev = &nbpf->dma_dev; in nbpf_chan_probe()
1244 struct nbpf_channel *chan = nbpf->chan + n; in nbpf_chan_probe()
1247 chan->nbpf = nbpf; in nbpf_chan_probe()
1248 chan->base = nbpf->base + NBPF_REG_CHAN_OFFSET + NBPF_REG_CHAN_SIZE * n; in nbpf_chan_probe()
1249 INIT_LIST_HEAD(&chan->desc_page); in nbpf_chan_probe()
1250 spin_lock_init(&chan->lock); in nbpf_chan_probe()
1251 chan->dma_chan.device = dma_dev; in nbpf_chan_probe()
1252 dma_cookie_init(&chan->dma_chan); in nbpf_chan_probe()
1255 dev_dbg(dma_dev->dev, "%s(): channel %d: -> %p\n", __func__, n, chan->base); in nbpf_chan_probe()
1257 snprintf(chan->name, sizeof(chan->name), "nbpf %d", n); in nbpf_chan_probe()
1259 tasklet_init(&chan->tasklet, nbpf_chan_tasklet, (unsigned long)chan); in nbpf_chan_probe()
1260 ret = devm_request_irq(dma_dev->dev, chan->irq, in nbpf_chan_probe()
1262 chan->name, chan); in nbpf_chan_probe()
1267 list_add_tail(&chan->dma_chan.device_node, in nbpf_chan_probe()
1268 &dma_dev->channels); in nbpf_chan_probe()
1289 struct device *dev = &pdev->dev; in nbpf_probe()
1290 struct device_node *np = dev->of_node; in nbpf_probe()
1304 return -ENODEV; in nbpf_probe()
1307 num_channels = cfg->num_channels; in nbpf_probe()
1312 return -ENOMEM; in nbpf_probe()
1314 dma_dev = &nbpf->dma_dev; in nbpf_probe()
1315 dma_dev->dev = dev; in nbpf_probe()
1318 nbpf->base = devm_ioremap_resource(dev, iomem); in nbpf_probe()
1319 if (IS_ERR(nbpf->base)) in nbpf_probe()
1320 return PTR_ERR(nbpf->base); in nbpf_probe()
1322 nbpf->clk = devm_clk_get(dev, NULL); in nbpf_probe()
1323 if (IS_ERR(nbpf->clk)) in nbpf_probe()
1324 return PTR_ERR(nbpf->clk); in nbpf_probe()
1326 of_property_read_u32(np, "max-burst-mem-read", in nbpf_probe()
1327 &nbpf->max_burst_mem_read); in nbpf_probe()
1328 of_property_read_u32(np, "max-burst-mem-write", in nbpf_probe()
1329 &nbpf->max_burst_mem_write); in nbpf_probe()
1331 nbpf->config = cfg; in nbpf_probe()
1338 for (irq = irq_res->start; irq <= irq_res->end; in nbpf_probe()
1350 return -ENXIO; in nbpf_probe()
1356 nbpf->chan[i].irq = irqbuf[0]; in nbpf_probe()
1365 for (i = 0, chan = nbpf->chan; i <= num_channels; in nbpf_probe()
1370 chan->irq = irqbuf[i]; in nbpf_probe()
1373 if (chan != nbpf->chan + num_channels) in nbpf_probe()
1374 return -EINVAL; in nbpf_probe()
1383 nbpf->chan[i].irq = irq; in nbpf_probe()
1391 nbpf->eirq = eirq; in nbpf_probe()
1393 INIT_LIST_HEAD(&dma_dev->channels); in nbpf_probe()
1402 dma_cap_set(DMA_MEMCPY, dma_dev->cap_mask); in nbpf_probe()
1403 dma_cap_set(DMA_SLAVE, dma_dev->cap_mask); in nbpf_probe()
1404 dma_cap_set(DMA_PRIVATE, dma_dev->cap_mask); in nbpf_probe()
1407 dma_dev->device_alloc_chan_resources in nbpf_probe()
1409 dma_dev->device_free_chan_resources = nbpf_free_chan_resources; in nbpf_probe()
1410 dma_dev->device_prep_dma_memcpy = nbpf_prep_memcpy; in nbpf_probe()
1411 dma_dev->device_tx_status = nbpf_tx_status; in nbpf_probe()
1412 dma_dev->device_issue_pending = nbpf_issue_pending; in nbpf_probe()
1417 * dma_dev->copy_align = 4; in nbpf_probe()
1423 dma_dev->device_prep_slave_sg = nbpf_prep_slave_sg; in nbpf_probe()
1424 dma_dev->device_config = nbpf_config; in nbpf_probe()
1425 dma_dev->device_pause = nbpf_pause; in nbpf_probe()
1426 dma_dev->device_terminate_all = nbpf_terminate_all; in nbpf_probe()
1428 dma_dev->src_addr_widths = NBPF_DMA_BUSWIDTHS; in nbpf_probe()
1429 dma_dev->dst_addr_widths = NBPF_DMA_BUSWIDTHS; in nbpf_probe()
1430 dma_dev->directions = BIT(DMA_DEV_TO_MEM) | BIT(DMA_MEM_TO_DEV); in nbpf_probe()
1434 ret = clk_prepare_enable(nbpf->clk); in nbpf_probe()
1453 clk_disable_unprepare(nbpf->clk); in nbpf_probe()
1463 devm_free_irq(&pdev->dev, nbpf->eirq, nbpf); in nbpf_remove()
1465 for (i = 0; i < nbpf->config->num_channels; i++) { in nbpf_remove()
1466 struct nbpf_channel *chan = nbpf->chan + i; in nbpf_remove()
1468 devm_free_irq(&pdev->dev, chan->irq, chan); in nbpf_remove()
1470 tasklet_kill(&chan->tasklet); in nbpf_remove()
1473 of_dma_controller_free(pdev->dev.of_node); in nbpf_remove()
1474 dma_async_device_unregister(&nbpf->dma_dev); in nbpf_remove()
1475 clk_disable_unprepare(nbpf->clk); in nbpf_remove()
1498 clk_disable_unprepare(nbpf->clk); in nbpf_runtime_suspend()
1505 return clk_prepare_enable(nbpf->clk); in nbpf_runtime_resume()
1515 .name = "dma-nbpf",