serial: tegra: update tx_circular buffer only when TX_DMA is in progress
Laxman Dewangan
maintainerPATCH 1/2 serial: tegra: update tx_circular buffer only when TX_DMA is in progress
From: Pradeep Goudagunta <[email protected]>
When channel is require to stop transmit then update the Tx circular buffer only when DMA based transfer is in progress. If there is no DMA based transfer then no need to update the Tx buffer.
--- drivers/tty/serial/serial-tegra.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/tty/serial/serial-tegra.c +3 -0
@@ -482,6 +482,9 @@ static void tegra_uart_stop_tx(struct uart_port *u)struct dma_tx_state state;int count; +if (tup->tx_in_progress !=TEGRA_UART_TX_DMA ) +return ; +dmaengine_terminate_all (tup->tx_dma_chan);dmaengine_tx_status (tup->tx_dma_chan, tup->tx_cookie, &state); count = tup->tx_bytes_requested - state.residue;
Signature · 1 line
1.8.1.5
Laxman Dewangan
maintainerPATCH 2/2 serial: tegra: ack the rx dma desc after transfer terminated
From: Pradeep Goudagunta <[email protected]>
The Rx dma descriptor allocated without the DMA_ACK flags so that once after tarnsfer done or terminated, client can ack the descriptor to free it for later use.
If the Rx DMA is terminated for some reason then rx-dma descriptor is not getting acked which causes the memory leak and list of usage desc to grow continuously.
Hence, acknowledge the rx-dma descriptor once transfer is terminated to avoid memory leak and desc list to grow.
--- drivers/tty/serial/serial-tegra.c | 1 + 1 file changed, 1 insertion(+)
drivers/tty/serial/serial-tegra.c +1 -0
@@ -602,6 +602,7 @@ static void tegra_uart_handle_rx_dma(struct tegra_uart_port *tup,dmaengine_terminate_all (tup->rx_dma_chan);dmaengine_tx_status (tup->rx_dma_chan, tup->rx_cookie, &state); +async_tx_ack (tup->rx_dma_desc); count = tup->rx_bytes_requested - state.residue;/* If we are here, DMA is stopped */
Signature · 1 line
1.8.1.5