Lines Matching full:dma
15 /* DIER register DMA enable bits */
28 struct stm32_timers_dma *dma = p; in stm32_timers_dma_done() local
32 status = dmaengine_tx_status(dma->chan, dma->chan->cookie, &state); in stm32_timers_dma_done()
34 complete(&dma->completion); in stm32_timers_dma_done()
38 * stm32_timers_dma_burst_read - Read from timers registers using DMA.
40 * Read from STM32 timers registers using DMA on a single event.
42 * @buf: DMA'able destination buffer
44 * @reg: registers start offset for DMA to read from (like CCRx for capture)
45 * @num_reg: number of registers to read upon each DMA request, starting @reg.
57 struct stm32_timers_dma *dma = &ddata->dma; in stm32_timers_dma_burst_read() local
75 if (!dma->chans[id]) in stm32_timers_dma_burst_read()
77 mutex_lock(&dma->lock); in stm32_timers_dma_burst_read()
79 /* Select DMA channel in use */ in stm32_timers_dma_burst_read()
80 dma->chan = dma->chans[id]; in stm32_timers_dma_burst_read()
87 /* Prepare DMA read from timer registers, using DMA burst mode */ in stm32_timers_dma_burst_read()
89 config.src_addr = (dma_addr_t)dma->phys_base + TIM_DMAR; in stm32_timers_dma_burst_read()
91 ret = dmaengine_slave_config(dma->chan, &config); in stm32_timers_dma_burst_read()
95 desc = dmaengine_prep_slave_single(dma->chan, dma_buf, len, in stm32_timers_dma_burst_read()
103 desc->callback_param = dma; in stm32_timers_dma_burst_read()
109 reinit_completion(&dma->completion); in stm32_timers_dma_burst_read()
110 dma_async_issue_pending(dma->chan); in stm32_timers_dma_burst_read()
112 /* Setup and enable timer DMA burst mode */ in stm32_timers_dma_burst_read()
119 /* Clear pending flags before enabling DMA request */ in stm32_timers_dma_burst_read()
129 err = wait_for_completion_interruptible_timeout(&dma->completion, in stm32_timers_dma_burst_read()
141 dmaengine_terminate_all(dma->chan); in stm32_timers_dma_burst_read()
145 dma->chan = NULL; in stm32_timers_dma_burst_read()
146 mutex_unlock(&dma->lock); in stm32_timers_dma_burst_read()
177 init_completion(&ddata->dma.completion); in stm32_timers_dma_probe()
178 mutex_init(&ddata->dma.lock); in stm32_timers_dma_probe()
180 /* Optional DMA support: get valid DMA channel(s) or NULL */ in stm32_timers_dma_probe()
183 ddata->dma.chans[i] = dma_request_chan(dev, name); in stm32_timers_dma_probe()
185 ddata->dma.chans[STM32_TIMERS_DMA_UP] = dma_request_chan(dev, "up"); in stm32_timers_dma_probe()
186 ddata->dma.chans[STM32_TIMERS_DMA_TRIG] = dma_request_chan(dev, "trig"); in stm32_timers_dma_probe()
187 ddata->dma.chans[STM32_TIMERS_DMA_COM] = dma_request_chan(dev, "com"); in stm32_timers_dma_probe()
190 if (IS_ERR(ddata->dma.chans[i])) { in stm32_timers_dma_probe()
192 if (PTR_ERR(ddata->dma.chans[i]) != -ENODEV && !ret) in stm32_timers_dma_probe()
193 ret = PTR_ERR(ddata->dma.chans[i]); in stm32_timers_dma_probe()
195 ddata->dma.chans[i] = NULL; in stm32_timers_dma_probe()
208 if (ddata->dma.chans[i]) in stm32_timers_dma_remove()
209 dma_release_channel(ddata->dma.chans[i]); in stm32_timers_dma_remove()
229 /* Timer physical addr for DMA */ in stm32_timers_probe()
230 ddata->dma.phys_base = res->start; in stm32_timers_probe()
264 * DMA are released, to avoid race on DMA. in stm32_timers_remove()