From ba46e4d1b1a9c29df06baaa1f30442be4c37f99e Mon Sep 17 00:00:00 2001 From: Victor Ryabukhin Date: Mon, 7 Mar 2011 18:23:03 +0900 Subject: [PATCH] tegra hsuart: Clean tx_bytes in tegra_flush_buffer tx_bytes might contain amount of bytes which should be transmitted after next "tx empty" interrupt. If we clear xmit circular buffer, tx_bytes should also be set to 0, otherwise it will lead to crash in fill_tx_fifo. Bug 794635 Change-Id: Ia34aba33dd09730c8f91d19e5c103cf1060a357e Reviewed-on: http://git-master/r/21844 Reviewed-by: Varun Colbert Tested-by: Varun Colbert --- drivers/serial/tegra_hsuart.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/serial/tegra_hsuart.c b/drivers/serial/tegra_hsuart.c index 6c669cb613ec..f57ec8223492 100644 --- a/drivers/serial/tegra_hsuart.c +++ b/drivers/serial/tegra_hsuart.c @@ -1113,8 +1113,8 @@ static void tegra_set_termios(struct uart_port *u, struct ktermios *termios, } /* - * Flush any TX data submitted for DMA. Called when the TX circular - * buffer is reset. + * Flush any TX data submitted for DMA and PIO. Called when the + * TX circular buffer is reset. */ static void tegra_flush_buffer(struct uart_port *u) { @@ -1124,6 +1124,8 @@ static void tegra_flush_buffer(struct uart_port *u) t = container_of(u, struct tegra_uart_port, uport); + t->tx_bytes = 0; + if (t->use_tx_dma) { tegra_dma_dequeue_req(t->tx_dma, &t->tx_dma_req); t->tx_dma_req.size = 0; -- 2.34.1