Lines Matching refs:dma
17 struct uart_8250_dma *dma = p->dma; in __dma_tx_complete() local
22 dma_sync_single_for_cpu(dma->txchan->device->dev, dma->tx_addr, in __dma_tx_complete()
27 dma->tx_running = 0; in __dma_tx_complete()
29 uart_xmit_advance(&p->port, dma->tx_size); in __dma_tx_complete()
35 if (ret || !dma->tx_running) in __dma_tx_complete()
43 struct uart_8250_dma *dma = p->dma; in __dma_rx_complete() local
54 dma_status = dmaengine_tx_status(dma->rxchan, dma->rx_cookie, &state); in __dma_rx_complete()
58 count = dma->rx_size - state.residue; in __dma_rx_complete()
60 tty_insert_flip_string(tty_port, dma->rx_buf, count); in __dma_rx_complete()
62 dma->rx_running = 0; in __dma_rx_complete()
70 struct uart_8250_dma *dma = p->dma; in dma_rx_complete() local
74 if (dma->rx_running) in dma_rx_complete()
81 if (!dma->rx_running && (serial_lsr_in(p) & UART_LSR_DR)) in dma_rx_complete()
82 p->dma->rx_dma(p); in dma_rx_complete()
88 struct uart_8250_dma *dma = p->dma; in serial8250_tx_dma() local
94 if (dma->tx_running) { in serial8250_tx_dma()
96 dmaengine_pause(dma->txchan); in serial8250_tx_dma()
98 dmaengine_resume(dma->txchan); in serial8250_tx_dma()
110 dma->tx_size = CIRC_CNT_TO_END(xmit->head, xmit->tail, UART_XMIT_SIZE); in serial8250_tx_dma()
114 desc = dmaengine_prep_slave_single(dma->txchan, in serial8250_tx_dma()
115 dma->tx_addr + xmit->tail, in serial8250_tx_dma()
116 dma->tx_size, DMA_MEM_TO_DEV, in serial8250_tx_dma()
123 dma->tx_running = 1; in serial8250_tx_dma()
127 dma->tx_cookie = dmaengine_submit(desc); in serial8250_tx_dma()
129 dma_sync_single_for_device(dma->txchan->device->dev, dma->tx_addr, in serial8250_tx_dma()
132 dma_async_issue_pending(dma->txchan); in serial8250_tx_dma()
134 dma->tx_err = 0; in serial8250_tx_dma()
138 dma->tx_err = 1; in serial8250_tx_dma()
144 struct uart_8250_dma *dma = p->dma; in serial8250_rx_dma() local
147 if (dma->rx_running) in serial8250_rx_dma()
152 desc = dmaengine_prep_slave_single(dma->rxchan, dma->rx_addr, in serial8250_rx_dma()
153 dma->rx_size, DMA_DEV_TO_MEM, in serial8250_rx_dma()
158 dma->rx_running = 1; in serial8250_rx_dma()
162 dma->rx_cookie = dmaengine_submit(desc); in serial8250_rx_dma()
164 dma_async_issue_pending(dma->rxchan); in serial8250_rx_dma()
171 struct uart_8250_dma *dma = p->dma; in serial8250_rx_dma_flush() local
173 if (dma->rx_running) { in serial8250_rx_dma_flush()
174 dmaengine_pause(dma->rxchan); in serial8250_rx_dma_flush()
176 dmaengine_terminate_async(dma->rxchan); in serial8250_rx_dma_flush()
183 struct uart_8250_dma *dma = p->dma; in serial8250_request_dma() local
184 phys_addr_t rx_dma_addr = dma->rx_dma_addr ? in serial8250_request_dma()
185 dma->rx_dma_addr : p->port.mapbase; in serial8250_request_dma()
186 phys_addr_t tx_dma_addr = dma->tx_dma_addr ? in serial8250_request_dma()
187 dma->tx_dma_addr : p->port.mapbase; in serial8250_request_dma()
193 dma->rxconf.direction = DMA_DEV_TO_MEM; in serial8250_request_dma()
194 dma->rxconf.src_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE; in serial8250_request_dma()
195 dma->rxconf.src_addr = rx_dma_addr + UART_RX; in serial8250_request_dma()
197 dma->txconf.direction = DMA_MEM_TO_DEV; in serial8250_request_dma()
198 dma->txconf.dst_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE; in serial8250_request_dma()
199 dma->txconf.dst_addr = tx_dma_addr + UART_TX; in serial8250_request_dma()
205 dma->rxchan = dma_request_slave_channel_compat(mask, in serial8250_request_dma()
206 dma->fn, dma->rx_param, in serial8250_request_dma()
208 if (!dma->rxchan) in serial8250_request_dma()
212 ret = dma_get_slave_caps(dma->rxchan, &caps); in serial8250_request_dma()
221 dmaengine_slave_config(dma->rxchan, &dma->rxconf); in serial8250_request_dma()
224 dma->txchan = dma_request_slave_channel_compat(mask, in serial8250_request_dma()
225 dma->fn, dma->tx_param, in serial8250_request_dma()
227 if (!dma->txchan) { in serial8250_request_dma()
233 ret = dma_get_slave_caps(dma->txchan, &caps); in serial8250_request_dma()
241 dmaengine_slave_config(dma->txchan, &dma->txconf); in serial8250_request_dma()
244 if (!dma->rx_size) in serial8250_request_dma()
245 dma->rx_size = PAGE_SIZE; in serial8250_request_dma()
247 dma->rx_buf = dma_alloc_coherent(dma->rxchan->device->dev, dma->rx_size, in serial8250_request_dma()
248 &dma->rx_addr, GFP_KERNEL); in serial8250_request_dma()
249 if (!dma->rx_buf) { in serial8250_request_dma()
255 dma->tx_addr = dma_map_single(dma->txchan->device->dev, in serial8250_request_dma()
259 if (dma_mapping_error(dma->txchan->device->dev, dma->tx_addr)) { in serial8250_request_dma()
260 dma_free_coherent(dma->rxchan->device->dev, dma->rx_size, in serial8250_request_dma()
261 dma->rx_buf, dma->rx_addr); in serial8250_request_dma()
270 dma_release_channel(dma->txchan); in serial8250_request_dma()
272 dma_release_channel(dma->rxchan); in serial8250_request_dma()
279 struct uart_8250_dma *dma = p->dma; in serial8250_release_dma() local
281 if (!dma) in serial8250_release_dma()
285 dmaengine_terminate_sync(dma->rxchan); in serial8250_release_dma()
286 dma_free_coherent(dma->rxchan->device->dev, dma->rx_size, dma->rx_buf, in serial8250_release_dma()
287 dma->rx_addr); in serial8250_release_dma()
288 dma_release_channel(dma->rxchan); in serial8250_release_dma()
289 dma->rxchan = NULL; in serial8250_release_dma()
292 dmaengine_terminate_sync(dma->txchan); in serial8250_release_dma()
293 dma_unmap_single(dma->txchan->device->dev, dma->tx_addr, in serial8250_release_dma()
295 dma_release_channel(dma->txchan); in serial8250_release_dma()
296 dma->txchan = NULL; in serial8250_release_dma()
297 dma->tx_running = 0; in serial8250_release_dma()