serial: tegra_hsuart: Make sure current byte rx complete in suspend
authorAndrei Warkentin <andreiw@motorola.com>
Tue, 22 Mar 2011 18:37:47 +0000 (11:37 -0700)
committerColin Cross <ccross@android.com>
Tue, 22 Mar 2011 18:40:08 +0000 (11:40 -0700)
Make sure that the last byte has been received by the uart during
suspend after RTS is deasserted.

Change-Id: I3517ec058fdca912ff5ad8770d2b1c5015385385
Signed-off-by: Andrei Warkentin <andreiw@motorola.com>
Signed-off-by: Colin Cross <ccross@android.com>
drivers/serial/tegra_hsuart.c

index a7c7220b854b415ec1c20ef472117dc776a026d0..b3b8eeaf8cf6aa8a87846f222c6d6c4caf634183 100644 (file)
@@ -599,16 +599,20 @@ static void tegra_stop_rx(struct uart_port *u)
                set_rts(t, false);
 
        if (t->rx_in_progress) {
+               wait_sym_time(t, 1); /* wait a character interval */
+
                ier = t->ier_shadow;
                ier &= ~(UART_IER_RDI | UART_IER_RLSI | UART_IER_RTOIE | UART_IER_EORD);
                t->ier_shadow = ier;
                uart_writeb(t, ier, UART_IER);
                t->rx_in_progress = 0;
-       }
-       if (t->use_rx_dma && t->rx_dma) {
-               if (!tegra_dma_dequeue_req(t->rx_dma, &t->rx_dma_req))
-                       tegra_rx_dma_complete_req(t, &t->rx_dma_req);
 
+               if (t->use_rx_dma && t->rx_dma) {
+                       if (!tegra_dma_dequeue_req(t->rx_dma, &t->rx_dma_req))
+                               tegra_rx_dma_complete_req(t, &t->rx_dma_req);
+               } else {
+                       do_handle_rx_pio(t);
+               }
                tty_flip_buffer_push(u->state->port.tty);
        }