Lines Matching full:pch
1555 struct dma_pl330_chan *pch; in dma_pl330_rqcb() local
1561 pch = desc->pchan; in dma_pl330_rqcb()
1564 if (!pch) in dma_pl330_rqcb()
1567 spin_lock_irqsave(&pch->lock, flags); in dma_pl330_rqcb()
1571 spin_unlock_irqrestore(&pch->lock, flags); in dma_pl330_rqcb()
1573 tasklet_schedule(&pch->task); in dma_pl330_rqcb()
2038 static inline void fill_queue(struct dma_pl330_chan *pch) in fill_queue() argument
2043 list_for_each_entry(desc, &pch->work_list, node) { in fill_queue()
2049 ret = pl330_submit_req(pch->thread, desc); in fill_queue()
2058 dev_err(pch->dmac->ddma.dev, "%s:%d Bad Desc(%d)\n", in fill_queue()
2060 tasklet_schedule(&pch->task); in fill_queue()
2067 struct dma_pl330_chan *pch = from_tasklet(pch, t, task); in pl330_tasklet() local
2072 spin_lock_irqsave(&pch->lock, flags); in pl330_tasklet()
2075 list_for_each_entry_safe(desc, _dt, &pch->work_list, node) in pl330_tasklet()
2077 if (!pch->cyclic) in pl330_tasklet()
2079 list_move_tail(&desc->node, &pch->completed_list); in pl330_tasklet()
2083 fill_queue(pch); in pl330_tasklet()
2085 if (list_empty(&pch->work_list)) { in pl330_tasklet()
2086 spin_lock(&pch->thread->dmac->lock); in pl330_tasklet()
2087 _stop(pch->thread); in pl330_tasklet()
2088 spin_unlock(&pch->thread->dmac->lock); in pl330_tasklet()
2090 pch->active = false; in pl330_tasklet()
2093 spin_lock(&pch->thread->dmac->lock); in pl330_tasklet()
2094 _start(pch->thread); in pl330_tasklet()
2095 spin_unlock(&pch->thread->dmac->lock); in pl330_tasklet()
2098 while (!list_empty(&pch->completed_list)) { in pl330_tasklet()
2101 desc = list_first_entry(&pch->completed_list, in pl330_tasklet()
2106 if (pch->cyclic) { in pl330_tasklet()
2108 list_move_tail(&desc->node, &pch->work_list); in pl330_tasklet()
2110 pch->active = true; in pl330_tasklet()
2111 spin_lock(&pch->thread->dmac->lock); in pl330_tasklet()
2112 _start(pch->thread); in pl330_tasklet()
2113 spin_unlock(&pch->thread->dmac->lock); in pl330_tasklet()
2118 list_move_tail(&desc->node, &pch->dmac->desc_pool); in pl330_tasklet()
2124 spin_unlock_irqrestore(&pch->lock, flags); in pl330_tasklet()
2126 spin_lock_irqsave(&pch->lock, flags); in pl330_tasklet()
2129 spin_unlock_irqrestore(&pch->lock, flags); in pl330_tasklet()
2133 pm_runtime_mark_last_busy(pch->dmac->ddma.dev); in pl330_tasklet()
2134 pm_runtime_put_autosuspend(pch->dmac->ddma.dev); in pl330_tasklet()
2160 struct dma_pl330_chan *pch = to_pchan(chan); in pl330_alloc_chan_resources() local
2161 struct pl330_dmac *pl330 = pch->dmac; in pl330_alloc_chan_resources()
2167 pch->cyclic = false; in pl330_alloc_chan_resources()
2169 pch->thread = pl330_request_channel(pl330); in pl330_alloc_chan_resources()
2170 if (!pch->thread) { in pl330_alloc_chan_resources()
2175 tasklet_setup(&pch->task, pl330_tasklet); in pl330_alloc_chan_resources()
2201 static void pl330_unprep_slave_fifo(struct dma_pl330_chan *pch) in pl330_unprep_slave_fifo() argument
2203 if (pch->dir != DMA_NONE) in pl330_unprep_slave_fifo()
2204 dma_unmap_resource(pch->chan.device->dev, pch->fifo_dma, in pl330_unprep_slave_fifo()
2205 1 << pch->burst_sz, pch->dir, 0); in pl330_unprep_slave_fifo()
2206 pch->dir = DMA_NONE; in pl330_unprep_slave_fifo()
2210 static bool pl330_prep_slave_fifo(struct dma_pl330_chan *pch, in pl330_prep_slave_fifo() argument
2213 struct device *dev = pch->chan.device->dev; in pl330_prep_slave_fifo()
2217 if (pch->dir == dma_dir) in pl330_prep_slave_fifo()
2220 pl330_unprep_slave_fifo(pch); in pl330_prep_slave_fifo()
2221 pch->fifo_dma = dma_map_resource(dev, pch->fifo_addr, in pl330_prep_slave_fifo()
2222 1 << pch->burst_sz, dma_dir, 0); in pl330_prep_slave_fifo()
2223 if (dma_mapping_error(dev, pch->fifo_dma)) in pl330_prep_slave_fifo()
2226 pch->dir = dma_dir; in pl330_prep_slave_fifo()
2244 struct dma_pl330_chan *pch = to_pchan(chan); in pl330_config_write() local
2246 pl330_unprep_slave_fifo(pch); in pl330_config_write()
2249 pch->fifo_addr = slave_config->dst_addr; in pl330_config_write()
2251 pch->burst_sz = __ffs(slave_config->dst_addr_width); in pl330_config_write()
2252 pch->burst_len = fixup_burst_len(slave_config->dst_maxburst, in pl330_config_write()
2253 pch->dmac->quirks); in pl330_config_write()
2256 pch->fifo_addr = slave_config->src_addr; in pl330_config_write()
2258 pch->burst_sz = __ffs(slave_config->src_addr_width); in pl330_config_write()
2259 pch->burst_len = fixup_burst_len(slave_config->src_maxburst, in pl330_config_write()
2260 pch->dmac->quirks); in pl330_config_write()
2269 struct dma_pl330_chan *pch = to_pchan(chan); in pl330_config() local
2271 memcpy(&pch->slave_config, slave_config, sizeof(*slave_config)); in pl330_config()
2278 struct dma_pl330_chan *pch = to_pchan(chan); in pl330_terminate_all() local
2281 struct pl330_dmac *pl330 = pch->dmac; in pl330_terminate_all()
2285 spin_lock_irqsave(&pch->lock, flags); in pl330_terminate_all()
2288 _stop(pch->thread); in pl330_terminate_all()
2289 pch->thread->req[0].desc = NULL; in pl330_terminate_all()
2290 pch->thread->req[1].desc = NULL; in pl330_terminate_all()
2291 pch->thread->req_running = -1; in pl330_terminate_all()
2294 power_down = pch->active; in pl330_terminate_all()
2295 pch->active = false; in pl330_terminate_all()
2298 list_for_each_entry(desc, &pch->submitted_list, node) { in pl330_terminate_all()
2303 list_for_each_entry(desc, &pch->work_list , node) { in pl330_terminate_all()
2308 list_splice_tail_init(&pch->submitted_list, &pl330->desc_pool); in pl330_terminate_all()
2309 list_splice_tail_init(&pch->work_list, &pl330->desc_pool); in pl330_terminate_all()
2310 list_splice_tail_init(&pch->completed_list, &pl330->desc_pool); in pl330_terminate_all()
2311 spin_unlock_irqrestore(&pch->lock, flags); in pl330_terminate_all()
2329 struct dma_pl330_chan *pch = to_pchan(chan); in pl330_pause() local
2330 struct pl330_dmac *pl330 = pch->dmac; in pl330_pause()
2334 spin_lock_irqsave(&pch->lock, flags); in pl330_pause()
2337 _stop(pch->thread); in pl330_pause()
2340 spin_unlock_irqrestore(&pch->lock, flags); in pl330_pause()
2349 struct dma_pl330_chan *pch = to_pchan(chan); in pl330_free_chan_resources() local
2350 struct pl330_dmac *pl330 = pch->dmac; in pl330_free_chan_resources()
2353 tasklet_kill(&pch->task); in pl330_free_chan_resources()
2355 pm_runtime_get_sync(pch->dmac->ddma.dev); in pl330_free_chan_resources()
2358 pl330_release_channel(pch->thread); in pl330_free_chan_resources()
2359 pch->thread = NULL; in pl330_free_chan_resources()
2361 if (pch->cyclic) in pl330_free_chan_resources()
2362 list_splice_tail_init(&pch->work_list, &pch->dmac->desc_pool); in pl330_free_chan_resources()
2365 pm_runtime_mark_last_busy(pch->dmac->ddma.dev); in pl330_free_chan_resources()
2366 pm_runtime_put_autosuspend(pch->dmac->ddma.dev); in pl330_free_chan_resources()
2367 pl330_unprep_slave_fifo(pch); in pl330_free_chan_resources()
2370 static int pl330_get_current_xferred_count(struct dma_pl330_chan *pch, in pl330_get_current_xferred_count() argument
2373 struct pl330_thread *thrd = pch->thread; in pl330_get_current_xferred_count()
2374 struct pl330_dmac *pl330 = pch->dmac; in pl330_get_current_xferred_count()
2387 pm_runtime_mark_last_busy(pch->dmac->ddma.dev); in pl330_get_current_xferred_count()
2404 struct dma_pl330_chan *pch = to_pchan(chan); in pl330_tx_status() local
2415 spin_lock_irqsave(&pch->lock, flags); in pl330_tx_status()
2416 spin_lock(&pch->thread->dmac->lock); in pl330_tx_status()
2418 if (pch->thread->req_running != -1) in pl330_tx_status()
2419 running = pch->thread->req[pch->thread->req_running].desc; in pl330_tx_status()
2421 last_enq = pch->thread->req[pch->thread->lstenq].desc; in pl330_tx_status()
2424 list_for_each_entry(desc, &pch->work_list, node) { in pl330_tx_status()
2429 pl330_get_current_xferred_count(pch, desc); in pl330_tx_status()
2459 spin_unlock(&pch->thread->dmac->lock); in pl330_tx_status()
2460 spin_unlock_irqrestore(&pch->lock, flags); in pl330_tx_status()
2470 struct dma_pl330_chan *pch = to_pchan(chan); in pl330_issue_pending() local
2473 spin_lock_irqsave(&pch->lock, flags); in pl330_issue_pending()
2474 if (list_empty(&pch->work_list)) { in pl330_issue_pending()
2480 WARN_ON(list_empty(&pch->submitted_list)); in pl330_issue_pending()
2481 pch->active = true; in pl330_issue_pending()
2482 pm_runtime_get_sync(pch->dmac->ddma.dev); in pl330_issue_pending()
2484 list_splice_tail_init(&pch->submitted_list, &pch->work_list); in pl330_issue_pending()
2485 spin_unlock_irqrestore(&pch->lock, flags); in pl330_issue_pending()
2487 pl330_tasklet(&pch->task); in pl330_issue_pending()
2498 struct dma_pl330_chan *pch = to_pchan(tx->chan); in pl330_tx_submit() local
2502 spin_lock_irqsave(&pch->lock, flags); in pl330_tx_submit()
2507 if (pch->cyclic) { in pl330_tx_submit()
2515 list_move_tail(&desc->node, &pch->submitted_list); in pl330_tx_submit()
2520 list_add_tail(&last->node, &pch->submitted_list); in pl330_tx_submit()
2521 spin_unlock_irqrestore(&pch->lock, flags); in pl330_tx_submit()
2583 static struct dma_pl330_desc *pl330_get_desc(struct dma_pl330_chan *pch) in pl330_get_desc() argument
2585 struct pl330_dmac *pl330 = pch->dmac; in pl330_get_desc()
2586 u8 *peri_id = pch->chan.private; in pl330_get_desc()
2605 desc->pchan = pch; in pl330_get_desc()
2609 desc->peri = peri_id ? pch->chan.chan_id : 0; in pl330_get_desc()
2610 desc->rqcfg.pcfg = &pch->dmac->pcfg; in pl330_get_desc()
2612 dma_async_tx_descriptor_init(&desc->txd, &pch->chan); in pl330_get_desc()
2626 __pl330_prep_dma_memcpy(struct dma_pl330_chan *pch, dma_addr_t dst, in __pl330_prep_dma_memcpy() argument
2629 struct dma_pl330_desc *desc = pl330_get_desc(pch); in __pl330_prep_dma_memcpy()
2632 dev_err(pch->dmac->ddma.dev, "%s:%d Unable to fetch desc\n", in __pl330_prep_dma_memcpy()
2655 struct dma_pl330_chan *pch = desc->pchan; in get_burst_len() local
2656 struct pl330_dmac *pl330 = pch->dmac; in get_burst_len()
2676 struct dma_pl330_chan *pch = to_pchan(chan); in pl330_prep_dma_cyclic() local
2677 struct pl330_dmac *pl330 = pch->dmac; in pl330_prep_dma_cyclic()
2686 dev_err(pch->dmac->ddma.dev, "%s:%d Invalid dma direction\n", in pl330_prep_dma_cyclic()
2691 pl330_config_write(chan, &pch->slave_config, direction); in pl330_prep_dma_cyclic()
2693 if (!pl330_prep_slave_fifo(pch, direction)) in pl330_prep_dma_cyclic()
2697 desc = pl330_get_desc(pch); in pl330_prep_dma_cyclic()
2699 dev_err(pch->dmac->ddma.dev, "%s:%d Unable to fetch desc\n", in pl330_prep_dma_cyclic()
2725 dst = pch->fifo_dma; in pl330_prep_dma_cyclic()
2730 src = pch->fifo_dma; in pl330_prep_dma_cyclic()
2738 desc->rqcfg.brst_size = pch->burst_sz; in pl330_prep_dma_cyclic()
2739 desc->rqcfg.brst_len = pch->burst_len; in pl330_prep_dma_cyclic()
2754 pch->cyclic = true; in pl330_prep_dma_cyclic()
2765 struct dma_pl330_chan *pch = to_pchan(chan); in pl330_prep_dma_memcpy() local
2769 if (unlikely(!pch || !len)) in pl330_prep_dma_memcpy()
2772 pl330 = pch->dmac; in pl330_prep_dma_memcpy()
2774 desc = __pl330_prep_dma_memcpy(pch, dst, src, len); in pl330_prep_dma_memcpy()
2840 struct dma_pl330_chan *pch = to_pchan(chan); in pl330_prep_slave_sg() local
2844 if (unlikely(!pch || !sgl || !sg_len)) in pl330_prep_slave_sg()
2847 pl330_config_write(chan, &pch->slave_config, direction); in pl330_prep_slave_sg()
2849 if (!pl330_prep_slave_fifo(pch, direction)) in pl330_prep_slave_sg()
2856 desc = pl330_get_desc(pch); in pl330_prep_slave_sg()
2858 struct pl330_dmac *pl330 = pch->dmac; in pl330_prep_slave_sg()
2860 dev_err(pch->dmac->ddma.dev, in pl330_prep_slave_sg()
2876 fill_px(&desc->px, pch->fifo_dma, sg_dma_address(sg), in pl330_prep_slave_sg()
2881 fill_px(&desc->px, sg_dma_address(sg), pch->fifo_dma, in pl330_prep_slave_sg()
2885 desc->rqcfg.brst_size = pch->burst_sz; in pl330_prep_slave_sg()
2886 desc->rqcfg.brst_len = pch->burst_len; in pl330_prep_slave_sg()
2928 struct dma_pl330_chan *pch = &pl330->peripherals[pr]; in pl330_debugfs_show() local
2930 if (!pch->thread || thrd->id != pch->thread->id) in pl330_debugfs_show()
2999 struct dma_pl330_chan *pch, *_p; in pl330_probe() local
3090 pl330->peripherals = kcalloc(num_chan, sizeof(*pch), GFP_KERNEL); in pl330_probe()
3097 pch = &pl330->peripherals[i]; in pl330_probe()
3099 pch->chan.private = adev->dev.of_node; in pl330_probe()
3100 INIT_LIST_HEAD(&pch->submitted_list); in pl330_probe()
3101 INIT_LIST_HEAD(&pch->work_list); in pl330_probe()
3102 INIT_LIST_HEAD(&pch->completed_list); in pl330_probe()
3103 spin_lock_init(&pch->lock); in pl330_probe()
3104 pch->thread = NULL; in pl330_probe()
3105 pch->chan.device = pd; in pl330_probe()
3106 pch->dmac = pl330; in pl330_probe()
3107 pch->dir = DMA_NONE; in pl330_probe()
3110 list_add_tail(&pch->chan.device_node, &pd->channels); in pl330_probe()
3177 list_for_each_entry_safe(pch, _p, &pl330->ddma.channels, in pl330_probe()
3181 list_del(&pch->chan.device_node); in pl330_probe()
3184 if (pch->thread) { in pl330_probe()
3185 pl330_terminate_all(&pch->chan); in pl330_probe()
3186 pl330_free_chan_resources(&pch->chan); in pl330_probe()
3203 struct dma_pl330_chan *pch, *_p; in pl330_remove() local
3220 list_for_each_entry_safe(pch, _p, &pl330->ddma.channels, in pl330_remove()
3224 list_del(&pch->chan.device_node); in pl330_remove()
3227 if (pch->thread) { in pl330_remove()
3228 pl330_terminate_all(&pch->chan); in pl330_remove()
3229 pl330_free_chan_resources(&pch->chan); in pl330_remove()