tegra hsuart: Clean tx_bytes in tegra_flush_buffer
authorVictor Ryabukhin <vryabukhin@nvidia.com>
Mon, 7 Mar 2011 09:23:03 +0000 (18:23 +0900)
committerVarun Colbert <vcolbert@nvidia.com>
Wed, 9 Mar 2011 05:06:36 +0000 (21:06 -0800)
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 <vcolbert@nvidia.com>
Tested-by: Varun Colbert <vcolbert@nvidia.com>
drivers/serial/tegra_hsuart.c

index 6c669cb613ecffe6b39a0869f3f8e7f2dc7dcc0a..f57ec8223492e27276f4282bd1f03d4f79a6f250 100644 (file)
@@ -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;