]> Git Repo - linux.git/commitdiff
serial: atmel_serial: add poll_get_char and poll_put_char uart_ops
authorAlbin Tonnerre <[email protected]>
Wed, 9 Dec 2009 20:31:32 +0000 (12:31 -0800)
committerGreg Kroah-Hartman <[email protected]>
Tue, 2 Mar 2010 22:43:08 +0000 (14:43 -0800)
Permits using KGDB over the console with the atmel_serial driver.

[[email protected]: s/barrier/cpu_relax/]
Signed-off-by: Albin Tonnerre <[email protected]>
Acked-by: Andrew Victor <[email protected]>
Acked-by: Haavard Skinnemoen <[email protected]>
Cc: Alan Cox <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
drivers/serial/atmel_serial.c

index 9d948bccafafa50bd13534ff330b6535cde29996..2c9bf9b68327e7266c12fbd98d2ca64d022f4cdc 100644 (file)
@@ -1213,6 +1213,24 @@ static int atmel_verify_port(struct uart_port *port, struct serial_struct *ser)
        return ret;
 }
 
+#ifdef CONFIG_CONSOLE_POLL
+static int atmel_poll_get_char(struct uart_port *port)
+{
+       while (!(UART_GET_CSR(port) & ATMEL_US_RXRDY))
+               cpu_relax();
+
+       return UART_GET_CHAR(port);
+}
+
+static void atmel_poll_put_char(struct uart_port *port, unsigned char ch)
+{
+       while (!(UART_GET_CSR(port) & ATMEL_US_TXRDY))
+               cpu_relax();
+
+       UART_PUT_CHAR(port, ch);
+}
+#endif
+
 static struct uart_ops atmel_pops = {
        .tx_empty       = atmel_tx_empty,
        .set_mctrl      = atmel_set_mctrl,
@@ -1232,6 +1250,10 @@ static struct uart_ops atmel_pops = {
        .config_port    = atmel_config_port,
        .verify_port    = atmel_verify_port,
        .pm             = atmel_serial_pm,
+#ifdef CONFIG_CONSOLE_POLL
+       .poll_get_char  = atmel_poll_get_char,
+       .poll_put_char  = atmel_poll_put_char,
+#endif
 };
 
 /*
This page took 0.056424 seconds and 4 git commands to generate.