Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

serial: tegra: Read DMA status before terminating

Read the DMA status before terminating the DMA, as doing so deletes
the DMA desc.

Also, to get the correct transfer status information, pause the DMA
using dmaengine_pause() before reading the DMA status.

Fixes: e9ea096dd225 ("serial: tegra: add serial driver")
Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Akhil R <akhilrajeev@nvidia.com>
Signed-off-by: Kartik <kkartik@nvidia.com>
Link: https://lore.kernel.org/r/1666105086-17326-1-git-send-email-kkartik@nvidia.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Kartik and committed by
Greg Kroah-Hartman
109a951a c2087b37

+4 -2
+4 -2
drivers/tty/serial/serial-tegra.c
··· 618 618 if (tup->tx_in_progress != TEGRA_UART_TX_DMA) 619 619 return; 620 620 621 - dmaengine_terminate_all(tup->tx_dma_chan); 621 + dmaengine_pause(tup->tx_dma_chan); 622 622 dmaengine_tx_status(tup->tx_dma_chan, tup->tx_cookie, &state); 623 + dmaengine_terminate_all(tup->tx_dma_chan); 623 624 count = tup->tx_bytes_requested - state.residue; 624 625 async_tx_ack(tup->tx_dma_desc); 625 626 uart_xmit_advance(&tup->uport, count); ··· 763 762 return; 764 763 } 765 764 766 - dmaengine_terminate_all(tup->rx_dma_chan); 765 + dmaengine_pause(tup->rx_dma_chan); 767 766 dmaengine_tx_status(tup->rx_dma_chan, tup->rx_cookie, &state); 767 + dmaengine_terminate_all(tup->rx_dma_chan); 768 768 769 769 tegra_uart_rx_buffer_push(tup, state.residue); 770 770 tup->rx_dma_active = false;