Lines Matching defs:dma
18 #include <linux/dma-mapping.h>
29 #include <linux/platform_data/dma-atmel.h>
136 struct at91_twi_dma *dma = &dev->dma;
140 if (dma->xfer_in_progress) {
141 if (dma->direction == DMA_FROM_DEVICE)
142 dmaengine_terminate_all(dma->chan_rx);
144 dmaengine_terminate_all(dma->chan_tx);
145 dma->xfer_in_progress = false;
147 if (dma->buf_mapped) {
148 dma_unmap_single(dev->dev, sg_dma_address(&dma->sg[0]),
149 dev->buf_len, dma->direction);
150 dma->buf_mapped = false;
180 dma_unmap_single(dev->dev, sg_dma_address(&dev->dma.sg[0]),
199 struct at91_twi_dma *dma = &dev->dma;
200 struct dma_chan *chan_tx = dma->chan_tx;
206 dma->direction = DMA_TO_DEVICE;
212 dev_err(dev->dev, "dma map failed\n");
215 dma->buf_mapped = true;
227 sg = &dma->sg[sg_len++];
234 sg = &dma->sg[sg_len++];
248 sg_dma_len(&dma->sg[0]) = dev->buf_len;
249 sg_dma_address(&dma->sg[0]) = dma_addr;
252 txdesc = dmaengine_prep_slave_sg(chan_tx, dma->sg, sg_len,
256 dev_err(dev->dev, "dma prep slave sg failed\n");
263 dma->xfer_in_progress = true;
322 dma_unmap_single(dev->dev, sg_dma_address(&dev->dma.sg[0]),
326 /* The last two bytes have to be read without using dma */
338 struct at91_twi_dma *dma = &dev->dma;
339 struct dma_chan *chan_rx = dma->chan_rx;
343 dma->direction = DMA_FROM_DEVICE;
345 /* Keep in mind that we won't use dma to read the last two bytes */
349 dev_err(dev->dev, "dma map failed\n");
352 dma->buf_mapped = true;
368 sg_dma_len(&dma->sg[0]) = buf_len;
369 sg_dma_address(&dma->sg[0]) = dma_addr;
371 rxdesc = dmaengine_prep_slave_sg(chan_rx, dma->sg, 1, DMA_DEV_TO_MEM,
374 dev_err(dev->dev, "dma prep slave sg failed\n");
381 dma->xfer_in_progress = true;
383 dma_async_issue_pending(dma->chan_rx);
563 * When using dma without alternative command mode, the last
566 * In practice, there are some issues if you use the dma to
568 * Reading n-2 bytes with dma and the two last ones manually
752 struct at91_twi_dma *dma = &dev->dma;
782 dma->chan_tx = dma_request_chan(dev->dev, "tx");
783 if (IS_ERR(dma->chan_tx)) {
784 ret = PTR_ERR(dma->chan_tx);
785 dma->chan_tx = NULL;
789 dma->chan_rx = dma_request_chan(dev->dev, "rx");
790 if (IS_ERR(dma->chan_rx)) {
791 ret = PTR_ERR(dma->chan_rx);
792 dma->chan_rx = NULL;
797 if (dmaengine_slave_config(dma->chan_tx, &slave_config)) {
804 if (dmaengine_slave_config(dma->chan_rx, &slave_config)) {
810 sg_init_table(dma->sg, 2);
811 dma->buf_mapped = false;
812 dma->xfer_in_progress = false;
816 dma_chan_name(dma->chan_tx), dma_chan_name(dma->chan_rx));
823 if (dma->chan_rx)
824 dma_release_channel(dma->chan_rx);
825 if (dma->chan_tx)
826 dma_release_channel(dma->chan_tx);