summaryrefslogtreecommitdiffstats
path: root/drivers/serial/atmel_serial.c
diff options
context:
space:
mode:
authorHaavard Skinnemoen <haavard.skinnemoen@atmel.com>2008-07-16 22:52:46 +0200
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-21 02:12:34 +0200
commit9afd561acabe5059ff16d163a176e2350269aba5 (patch)
treefdc8dd1e97c2aff22eb708c8695be58c21b97af9 /drivers/serial/atmel_serial.c
parentSubject: [PATCH 1/2] serial: Add flush_buffer() operation to uart_ops (diff)
downloadlinux-9afd561acabe5059ff16d163a176e2350269aba5.tar.xz
linux-9afd561acabe5059ff16d163a176e2350269aba5.zip
Subject: [PATCH 2/2] atmel_serial: Implement flush_buffer() hook
Avoid dumping garbage to the serial port when the tty is flushed. This tends to happen when rebooting from a serial console. Signed-off-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com> Acked-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/serial/atmel_serial.c')
-rw-r--r--drivers/serial/atmel_serial.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/serial/atmel_serial.c b/drivers/serial/atmel_serial.c
index 6aeef22bd203..c17fcd6085f3 100644
--- a/drivers/serial/atmel_serial.c
+++ b/drivers/serial/atmel_serial.c
@@ -956,6 +956,20 @@ static void atmel_shutdown(struct uart_port *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.
*/
static void atmel_serial_pm(struct uart_port *port, unsigned int state,
@@ -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,