Merge git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/v4l-dvb
[pandora-kernel.git] / drivers / serial / atmel_serial.c
index 6aeef22..1fee12c 100644 (file)
@@ -662,14 +662,14 @@ static void atmel_rx_from_ring(struct uart_port *port)
         * uart_start(), which takes the lock.
         */
        spin_unlock(&port->lock);
-       tty_flip_buffer_push(port->info->tty);
+       tty_flip_buffer_push(port->info->port.tty);
        spin_lock(&port->lock);
 }
 
 static void atmel_rx_from_dma(struct uart_port *port)
 {
        struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
-       struct tty_struct *tty = port->info->tty;
+       struct tty_struct *tty = port->info->port.tty;
        struct atmel_dma_buffer *pdc;
        int rx_idx = atmel_port->pdc_rx_idx;
        unsigned int head;
@@ -794,7 +794,7 @@ static void atmel_tasklet_func(unsigned long data)
 static int atmel_startup(struct uart_port *port)
 {
        struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
-       struct tty_struct *tty = port->info->tty;
+       struct tty_struct *tty = port->info->port.tty;
        int retval;
 
        /*
@@ -955,6 +955,20 @@ static void atmel_shutdown(struct uart_port *port)
                atmel_close_hook(port);
 }
 
+/*
+ * Flush any TX data submitted for DMA. Called when the TX circular
+ * buffer is reset.
+ */
+static void atmel_flush_buffer(struct uart_port *port)
+{
+       struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
+
+       if (atmel_use_dma_tx(port)) {
+               UART_PUT_TCR(port, 0);
+               atmel_port->pdc_tx.ofs = 0;
+       }
+}
+
 /*
  * Power / Clock management.
  */
@@ -1189,6 +1203,7 @@ static struct uart_ops atmel_pops = {
        .break_ctl      = atmel_break_ctl,
        .startup        = atmel_startup,
        .shutdown       = atmel_shutdown,
+       .flush_buffer   = atmel_flush_buffer,
        .set_termios    = atmel_set_termios,
        .type           = atmel_type,
        .release_port   = atmel_release_port,