serial: tegra: Read DMA status before terminating

[ Upstream commit 109a951a9f ]

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: e9ea096dd2 ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Kartik 2022-10-18 20:28:06 +05:30 коммит произвёл Greg Kroah-Hartman
Родитель a0ead7e8da
Коммит 6b4424efcf
1 изменённых файлов: 4 добавлений и 2 удалений

Просмотреть файл

@ -619,8 +619,9 @@ static void tegra_uart_stop_tx(struct uart_port *u)
if (tup->tx_in_progress != TEGRA_UART_TX_DMA) if (tup->tx_in_progress != TEGRA_UART_TX_DMA)
return; return;
dmaengine_terminate_all(tup->tx_dma_chan); dmaengine_pause(tup->tx_dma_chan);
dmaengine_tx_status(tup->tx_dma_chan, tup->tx_cookie, &state); dmaengine_tx_status(tup->tx_dma_chan, tup->tx_cookie, &state);
dmaengine_terminate_all(tup->tx_dma_chan);
count = tup->tx_bytes_requested - state.residue; count = tup->tx_bytes_requested - state.residue;
async_tx_ack(tup->tx_dma_desc); async_tx_ack(tup->tx_dma_desc);
uart_xmit_advance(&tup->uport, count); uart_xmit_advance(&tup->uport, count);
@ -763,8 +764,9 @@ static void tegra_uart_terminate_rx_dma(struct tegra_uart_port *tup)
return; return;
} }
dmaengine_terminate_all(tup->rx_dma_chan); dmaengine_pause(tup->rx_dma_chan);
dmaengine_tx_status(tup->rx_dma_chan, tup->rx_cookie, &state); dmaengine_tx_status(tup->rx_dma_chan, tup->rx_cookie, &state);
dmaengine_terminate_all(tup->rx_dma_chan);
tegra_uart_rx_buffer_push(tup, state.residue); tegra_uart_rx_buffer_push(tup, state.residue);
tup->rx_dma_active = false; tup->rx_dma_active = false;