Lines Matching refs:mxs_chan
185 struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(chan); in mxs_dma_reset_chan() local
186 struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma; in mxs_dma_reset_chan()
187 int chan_id = mxs_chan->chan.chan_id; in mxs_dma_reset_chan()
196 if (mxs_chan->flags & MXS_DMA_USE_SEMAPHORE && in mxs_dma_reset_chan()
197 mxs_chan->flags & MXS_DMA_SG_LOOP) { in mxs_dma_reset_chan()
198 mxs_chan->reset = true; in mxs_dma_reset_chan()
221 dev_err(&mxs_chan->mxs_dma->pdev->dev, in mxs_dma_reset_chan()
229 mxs_chan->status = DMA_COMPLETE; in mxs_dma_reset_chan()
234 struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(chan); in mxs_dma_enable_chan() local
235 struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma; in mxs_dma_enable_chan()
236 int chan_id = mxs_chan->chan.chan_id; in mxs_dma_enable_chan()
239 writel(mxs_chan->ccw_phys, in mxs_dma_enable_chan()
243 if (mxs_chan->flags & MXS_DMA_USE_SEMAPHORE && in mxs_dma_enable_chan()
244 mxs_chan->flags & MXS_DMA_SG_LOOP) { in mxs_dma_enable_chan()
252 mxs_chan->reset = false; in mxs_dma_enable_chan()
257 struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(chan); in mxs_dma_disable_chan() local
259 mxs_chan->status = DMA_COMPLETE; in mxs_dma_disable_chan()
264 struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(chan); in mxs_dma_pause_chan() local
265 struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma; in mxs_dma_pause_chan()
266 int chan_id = mxs_chan->chan.chan_id; in mxs_dma_pause_chan()
276 mxs_chan->status = DMA_PAUSED; in mxs_dma_pause_chan()
282 struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(chan); in mxs_dma_resume_chan() local
283 struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma; in mxs_dma_resume_chan()
284 int chan_id = mxs_chan->chan.chan_id; in mxs_dma_resume_chan()
294 mxs_chan->status = DMA_IN_PROGRESS; in mxs_dma_resume_chan()
305 struct mxs_dma_chan *mxs_chan = from_tasklet(mxs_chan, t, tasklet); in mxs_dma_tasklet() local
307 dmaengine_desc_get_callback_invoke(&mxs_chan->desc, NULL); in mxs_dma_tasklet()
324 struct mxs_dma_chan *mxs_chan; in mxs_dma_int_handler() local
364 mxs_chan = &mxs_dma->mxs_chans[chan]; in mxs_dma_int_handler()
370 mxs_chan->status = DMA_ERROR; in mxs_dma_int_handler()
371 mxs_dma_reset_chan(&mxs_chan->chan); in mxs_dma_int_handler()
372 } else if (mxs_chan->status != DMA_COMPLETE) { in mxs_dma_int_handler()
373 if (mxs_chan->flags & MXS_DMA_SG_LOOP) { in mxs_dma_int_handler()
374 mxs_chan->status = DMA_IN_PROGRESS; in mxs_dma_int_handler()
375 if (mxs_chan->flags & MXS_DMA_USE_SEMAPHORE) in mxs_dma_int_handler()
379 mxs_chan->status = DMA_COMPLETE; in mxs_dma_int_handler()
383 if (mxs_chan->status == DMA_COMPLETE) { in mxs_dma_int_handler()
384 if (mxs_chan->reset) in mxs_dma_int_handler()
386 dma_cookie_complete(&mxs_chan->desc); in mxs_dma_int_handler()
390 tasklet_schedule(&mxs_chan->tasklet); in mxs_dma_int_handler()
397 struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(chan); in mxs_dma_alloc_chan_resources() local
398 struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma; in mxs_dma_alloc_chan_resources()
401 mxs_chan->ccw = dma_alloc_coherent(mxs_dma->dma_device.dev, in mxs_dma_alloc_chan_resources()
403 &mxs_chan->ccw_phys, GFP_KERNEL); in mxs_dma_alloc_chan_resources()
404 if (!mxs_chan->ccw) { in mxs_dma_alloc_chan_resources()
409 ret = request_irq(mxs_chan->chan_irq, mxs_dma_int_handler, in mxs_dma_alloc_chan_resources()
420 dma_async_tx_descriptor_init(&mxs_chan->desc, chan); in mxs_dma_alloc_chan_resources()
421 mxs_chan->desc.tx_submit = mxs_dma_tx_submit; in mxs_dma_alloc_chan_resources()
424 async_tx_ack(&mxs_chan->desc); in mxs_dma_alloc_chan_resources()
429 free_irq(mxs_chan->chan_irq, mxs_dma); in mxs_dma_alloc_chan_resources()
432 mxs_chan->ccw, mxs_chan->ccw_phys); in mxs_dma_alloc_chan_resources()
439 struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(chan); in mxs_dma_free_chan_resources() local
440 struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma; in mxs_dma_free_chan_resources()
444 free_irq(mxs_chan->chan_irq, mxs_dma); in mxs_dma_free_chan_resources()
447 mxs_chan->ccw, mxs_chan->ccw_phys); in mxs_dma_free_chan_resources()
479 struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(chan); in mxs_dma_prep_slave_sg() local
480 struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma; in mxs_dma_prep_slave_sg()
487 if (mxs_chan->status == DMA_IN_PROGRESS) in mxs_dma_prep_slave_sg()
488 idx = mxs_chan->desc_count; in mxs_dma_prep_slave_sg()
497 mxs_chan->status = DMA_IN_PROGRESS; in mxs_dma_prep_slave_sg()
498 mxs_chan->flags = 0; in mxs_dma_prep_slave_sg()
506 ccw = &mxs_chan->ccw[idx - 1]; in mxs_dma_prep_slave_sg()
507 ccw->next = mxs_chan->ccw_phys + sizeof(*ccw) * idx; in mxs_dma_prep_slave_sg()
516 ccw = &mxs_chan->ccw[idx++]; in mxs_dma_prep_slave_sg()
541 ccw = &mxs_chan->ccw[idx++]; in mxs_dma_prep_slave_sg()
543 ccw->next = mxs_chan->ccw_phys + sizeof(*ccw) * idx; in mxs_dma_prep_slave_sg()
564 mxs_chan->desc_count = idx; in mxs_dma_prep_slave_sg()
566 return &mxs_chan->desc; in mxs_dma_prep_slave_sg()
569 mxs_chan->status = DMA_ERROR; in mxs_dma_prep_slave_sg()
578 struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(chan); in mxs_dma_prep_dma_cyclic() local
579 struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma; in mxs_dma_prep_dma_cyclic()
583 if (mxs_chan->status == DMA_IN_PROGRESS) in mxs_dma_prep_dma_cyclic()
586 mxs_chan->status = DMA_IN_PROGRESS; in mxs_dma_prep_dma_cyclic()
587 mxs_chan->flags |= MXS_DMA_SG_LOOP; in mxs_dma_prep_dma_cyclic()
588 mxs_chan->flags |= MXS_DMA_USE_SEMAPHORE; in mxs_dma_prep_dma_cyclic()
605 struct mxs_dma_ccw *ccw = &mxs_chan->ccw[i]; in mxs_dma_prep_dma_cyclic()
608 ccw->next = mxs_chan->ccw_phys; in mxs_dma_prep_dma_cyclic()
610 ccw->next = mxs_chan->ccw_phys + sizeof(*ccw) * (i + 1); in mxs_dma_prep_dma_cyclic()
629 mxs_chan->desc_count = i; in mxs_dma_prep_dma_cyclic()
631 return &mxs_chan->desc; in mxs_dma_prep_dma_cyclic()
634 mxs_chan->status = DMA_ERROR; in mxs_dma_prep_dma_cyclic()
649 struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(chan); in mxs_dma_tx_status() local
650 struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma; in mxs_dma_tx_status()
653 if (mxs_chan->status == DMA_IN_PROGRESS && in mxs_dma_tx_status()
654 mxs_chan->flags & MXS_DMA_SG_LOOP) { in mxs_dma_tx_status()
658 last_ccw = &mxs_chan->ccw[mxs_chan->desc_count - 1]; in mxs_dma_tx_status()
669 return mxs_chan->status; in mxs_dma_tx_status()
708 struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(chan); in mxs_dma_filter_fn() local
709 struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma; in mxs_dma_filter_fn()
719 mxs_chan->chan_irq = chan_irq; in mxs_dma_filter_fn()
779 struct mxs_dma_chan *mxs_chan = &mxs_dma->mxs_chans[i]; in mxs_dma_probe() local
781 mxs_chan->mxs_dma = mxs_dma; in mxs_dma_probe()
782 mxs_chan->chan.device = &mxs_dma->dma_device; in mxs_dma_probe()
783 dma_cookie_init(&mxs_chan->chan); in mxs_dma_probe()
785 tasklet_setup(&mxs_chan->tasklet, mxs_dma_tasklet); in mxs_dma_probe()
789 list_add_tail(&mxs_chan->chan.device_node, in mxs_dma_probe()