Commit 8fe2d54145a51238308d333f9dc57c5df575ff78

Authored by Albin Tonnerre
Committed by Greg Kroah-Hartman
1 parent 8b505ca8e2

serial: atmel_serial: add poll_get_char and poll_put_char uart_ops

Permits using KGDB over the console with the atmel_serial driver.

[akpm@linux-foundation.org: s/barrier/cpu_relax/]
Signed-off-by: Albin Tonnerre <albin.tonnerre@free-electrons.com>
Acked-by: Andrew Victor <linux@maxim.org.za>
Acked-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

Showing 1 changed file with 22 additions and 0 deletions Side-by-side Diff

drivers/serial/atmel_serial.c
... ... @@ -1213,6 +1213,24 @@
1213 1213 return ret;
1214 1214 }
1215 1215  
  1216 +#ifdef CONFIG_CONSOLE_POLL
  1217 +static int atmel_poll_get_char(struct uart_port *port)
  1218 +{
  1219 + while (!(UART_GET_CSR(port) & ATMEL_US_RXRDY))
  1220 + cpu_relax();
  1221 +
  1222 + return UART_GET_CHAR(port);
  1223 +}
  1224 +
  1225 +static void atmel_poll_put_char(struct uart_port *port, unsigned char ch)
  1226 +{
  1227 + while (!(UART_GET_CSR(port) & ATMEL_US_TXRDY))
  1228 + cpu_relax();
  1229 +
  1230 + UART_PUT_CHAR(port, ch);
  1231 +}
  1232 +#endif
  1233 +
1216 1234 static struct uart_ops atmel_pops = {
1217 1235 .tx_empty = atmel_tx_empty,
1218 1236 .set_mctrl = atmel_set_mctrl,
... ... @@ -1232,6 +1250,10 @@
1232 1250 .config_port = atmel_config_port,
1233 1251 .verify_port = atmel_verify_port,
1234 1252 .pm = atmel_serial_pm,
  1253 +#ifdef CONFIG_CONSOLE_POLL
  1254 + .poll_get_char = atmel_poll_get_char,
  1255 + .poll_put_char = atmel_poll_put_char,
  1256 +#endif
1235 1257 };
1236 1258  
1237 1259 /*