Lines Matching refs:d40d
634 static int d40_pool_lli_alloc(struct d40_chan *d40c, struct d40_desc *d40d, in d40_pool_lli_alloc() argument
647 base = d40d->lli_pool.pre_alloc_lli; in d40_pool_lli_alloc()
648 d40d->lli_pool.size = sizeof(d40d->lli_pool.pre_alloc_lli); in d40_pool_lli_alloc()
649 d40d->lli_pool.base = NULL; in d40_pool_lli_alloc()
651 d40d->lli_pool.size = lli_len * 2 * align; in d40_pool_lli_alloc()
653 base = kmalloc(d40d->lli_pool.size + align, GFP_NOWAIT); in d40_pool_lli_alloc()
654 d40d->lli_pool.base = base; in d40_pool_lli_alloc()
656 if (d40d->lli_pool.base == NULL) in d40_pool_lli_alloc()
661 d40d->lli_log.src = PTR_ALIGN(base, align); in d40_pool_lli_alloc()
662 d40d->lli_log.dst = d40d->lli_log.src + lli_len; in d40_pool_lli_alloc()
664 d40d->lli_pool.dma_addr = 0; in d40_pool_lli_alloc()
666 d40d->lli_phy.src = PTR_ALIGN(base, align); in d40_pool_lli_alloc()
667 d40d->lli_phy.dst = d40d->lli_phy.src + lli_len; in d40_pool_lli_alloc()
669 d40d->lli_pool.dma_addr = dma_map_single(d40c->base->dev, in d40_pool_lli_alloc()
670 d40d->lli_phy.src, in d40_pool_lli_alloc()
671 d40d->lli_pool.size, in d40_pool_lli_alloc()
675 d40d->lli_pool.dma_addr)) { in d40_pool_lli_alloc()
676 kfree(d40d->lli_pool.base); in d40_pool_lli_alloc()
677 d40d->lli_pool.base = NULL; in d40_pool_lli_alloc()
678 d40d->lli_pool.dma_addr = 0; in d40_pool_lli_alloc()
686 static void d40_pool_lli_free(struct d40_chan *d40c, struct d40_desc *d40d) in d40_pool_lli_free() argument
688 if (d40d->lli_pool.dma_addr) in d40_pool_lli_free()
689 dma_unmap_single(d40c->base->dev, d40d->lli_pool.dma_addr, in d40_pool_lli_free()
690 d40d->lli_pool.size, DMA_TO_DEVICE); in d40_pool_lli_free()
692 kfree(d40d->lli_pool.base); in d40_pool_lli_free()
693 d40d->lli_pool.base = NULL; in d40_pool_lli_free()
694 d40d->lli_pool.size = 0; in d40_pool_lli_free()
695 d40d->lli_log.src = NULL; in d40_pool_lli_free()
696 d40d->lli_log.dst = NULL; in d40_pool_lli_free()
697 d40d->lli_phy.src = NULL; in d40_pool_lli_free()
698 d40d->lli_phy.dst = NULL; in d40_pool_lli_free()
702 struct d40_desc *d40d) in d40_lcla_alloc_one() argument
718 d40c->base->lcla_pool.alloc_map[idx] = d40d; in d40_lcla_alloc_one()
719 d40d->lcla_alloc++; in d40_lcla_alloc_one()
731 struct d40_desc *d40d) in d40_lcla_free_all() argument
745 if (d40c->base->lcla_pool.alloc_map[idx] == d40d) { in d40_lcla_free_all()
747 d40d->lcla_alloc--; in d40_lcla_free_all()
748 if (d40d->lcla_alloc == 0) { in d40_lcla_free_all()
761 static void d40_desc_remove(struct d40_desc *d40d) in d40_desc_remove() argument
763 list_del(&d40d->node); in d40_desc_remove()
793 static void d40_desc_free(struct d40_chan *d40c, struct d40_desc *d40d) in d40_desc_free() argument
796 d40_pool_lli_free(d40c, d40d); in d40_desc_free()
797 d40_lcla_free_all(d40c, d40d); in d40_desc_free()
798 kmem_cache_free(d40c->base->desc_slab, d40d); in d40_desc_free()
940 static void d40_desc_load(struct d40_chan *d40c, struct d40_desc *d40d) in d40_desc_load() argument
943 d40_phy_lli_load(d40c, d40d); in d40_desc_load()
944 d40d->lli_current = d40d->lli_len; in d40_desc_load()
946 d40_log_lli_to_lcxa(d40c, d40d); in d40_desc_load()
1110 struct d40_desc *d40d; in d40_term_all() local
1114 while ((d40d = d40_first_done(d40c))) { in d40_term_all()
1115 d40_desc_remove(d40d); in d40_term_all()
1116 d40_desc_free(d40c, d40d); in d40_term_all()
1120 while ((d40d = d40_first_active_get(d40c))) { in d40_term_all()
1121 d40_desc_remove(d40d); in d40_term_all()
1122 d40_desc_free(d40c, d40d); in d40_term_all()
1126 while ((d40d = d40_first_queued(d40c))) { in d40_term_all()
1127 d40_desc_remove(d40d); in d40_term_all()
1128 d40_desc_free(d40c, d40d); in d40_term_all()
1132 while ((d40d = d40_first_pending(d40c))) { in d40_term_all()
1133 d40_desc_remove(d40d); in d40_term_all()
1134 d40_desc_free(d40c, d40d); in d40_term_all()
1139 list_for_each_entry_safe(d40d, _d, &d40c->client, node) { in d40_term_all()
1140 d40_desc_remove(d40d); in d40_term_all()
1141 d40_desc_free(d40c, d40d); in d40_term_all()
1146 list_for_each_entry_safe(d40d, _d, in d40_term_all()
1148 d40_desc_remove(d40d); in d40_term_all()
1149 d40_desc_free(d40c, d40d); in d40_term_all()
1470 struct d40_desc *d40d = container_of(tx, struct d40_desc, txd); in d40_tx_submit() local
1476 d40_desc_queue(d40c, d40d); in d40_tx_submit()
1489 struct d40_desc *d40d; in d40_queue_start() local
1493 d40d = d40_first_queued(d40c); in d40_queue_start()
1495 if (d40d != NULL) { in d40_queue_start()
1502 d40_desc_remove(d40d); in d40_queue_start()
1505 d40_desc_submit(d40c, d40d); in d40_queue_start()
1508 d40_desc_load(d40c, d40d); in d40_queue_start()
1517 return d40d; in d40_queue_start()
1523 struct d40_desc *d40d; in dma_tc_handle() local
1526 d40d = d40_first_active_get(d40c); in dma_tc_handle()
1528 if (d40d == NULL) in dma_tc_handle()
1531 if (d40d->cyclic) { in dma_tc_handle()
1538 if (d40d->lli_current < d40d->lli_len in dma_tc_handle()
1541 d40_lcla_free_all(d40c, d40d); in dma_tc_handle()
1542 d40_desc_load(d40c, d40d); in dma_tc_handle()
1545 if (d40d->lli_current == d40d->lli_len) in dma_tc_handle()
1546 d40d->lli_current = 0; in dma_tc_handle()
1549 d40_lcla_free_all(d40c, d40d); in dma_tc_handle()
1551 if (d40d->lli_current < d40d->lli_len) { in dma_tc_handle()
1552 d40_desc_load(d40c, d40d); in dma_tc_handle()
1565 d40_desc_remove(d40d); in dma_tc_handle()
1566 d40_desc_done(d40c, d40d); in dma_tc_handle()
1577 struct d40_desc *d40d; in dma_tasklet() local
1585 d40d = d40_first_done(d40c); in dma_tasklet()
1586 if (d40d == NULL) { in dma_tasklet()
1588 d40d = d40_first_active_get(d40c); in dma_tasklet()
1589 if (d40d == NULL || !d40d->cyclic) in dma_tasklet()
1593 if (!d40d->cyclic) in dma_tasklet()
1594 dma_cookie_complete(&d40d->txd); in dma_tasklet()
1606 callback_active = !!(d40d->txd.flags & DMA_PREP_INTERRUPT); in dma_tasklet()
1607 dmaengine_desc_get_callback(&d40d->txd, &cb); in dma_tasklet()
1609 if (!d40d->cyclic) { in dma_tasklet()
1610 if (async_tx_test_ack(&d40d->txd)) { in dma_tasklet()
1611 d40_desc_remove(d40d); in dma_tasklet()
1612 d40_desc_free(d40c, d40d); in dma_tasklet()
1613 } else if (!d40d->is_in_client_list) { in dma_tasklet()
1614 d40_desc_remove(d40d); in dma_tasklet()
1615 d40_lcla_free_all(d40c, d40d); in dma_tasklet()
1616 list_add_tail(&d40d->node, &d40c->client); in dma_tasklet()
1617 d40d->is_in_client_list = true; in dma_tasklet()