aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial/uartlite.c
diff options
context:
space:
mode:
authorMichal Simek <monstr@monstr.eu>2010-08-17 04:42:05 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2010-10-22 13:19:58 -0400
commit8a28af7f7e42cd0f107e0d84e4ece89e7ef24d3f (patch)
treecb327d95ce6ed0ef7c511c69e190d7026c8245b6 /drivers/serial/uartlite.c
parenta95898114059e1038f3f7ee9bd2e43aefa62709a (diff)
serial: Add CONSOLE_POLL support for uartlite
CONSOLE_POLL support for uartlite enables KGDB debugging over serial line. Signed-off-by: Michal Simek <monstr@monstr.eu> Signed-off-by: Jason Wessel <jason.wessel@windriver.com> Acked-by: Peter Korsgaard <jacmet@sunsite.dk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/serial/uartlite.c')
-rw-r--r--drivers/serial/uartlite.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/drivers/serial/uartlite.c b/drivers/serial/uartlite.c
index 9b03d7b3e456..c4bf54bb3fc7 100644
--- a/drivers/serial/uartlite.c
+++ b/drivers/serial/uartlite.c
@@ -322,6 +322,26 @@ static int ulite_verify_port(struct uart_port *port, struct serial_struct *ser)
322 return -EINVAL; 322 return -EINVAL;
323} 323}
324 324
325#ifdef CONFIG_CONSOLE_POLL
326static int ulite_get_poll_char(struct uart_port *port)
327{
328 if (!(ioread32be(port->membase + ULITE_STATUS)
329 & ULITE_STATUS_RXVALID))
330 return NO_POLL_CHAR;
331
332 return ioread32be(port->membase + ULITE_RX);
333}
334
335static void ulite_put_poll_char(struct uart_port *port, unsigned char ch)
336{
337 while (ioread32be(port->membase + ULITE_STATUS) & ULITE_STATUS_TXFULL)
338 cpu_relax();
339
340 /* write char to device */
341 iowrite32be(ch, port->membase + ULITE_TX);
342}
343#endif
344
325static struct uart_ops ulite_ops = { 345static struct uart_ops ulite_ops = {
326 .tx_empty = ulite_tx_empty, 346 .tx_empty = ulite_tx_empty,
327 .set_mctrl = ulite_set_mctrl, 347 .set_mctrl = ulite_set_mctrl,
@@ -338,7 +358,11 @@ static struct uart_ops ulite_ops = {
338 .release_port = ulite_release_port, 358 .release_port = ulite_release_port,
339 .request_port = ulite_request_port, 359 .request_port = ulite_request_port,
340 .config_port = ulite_config_port, 360 .config_port = ulite_config_port,
341 .verify_port = ulite_verify_port 361 .verify_port = ulite_verify_port,
362#ifdef CONFIG_CONSOLE_POLL
363 .poll_get_char = ulite_get_poll_char,
364 .poll_put_char = ulite_put_poll_char,
365#endif
342}; 366};
343 367
344/* --------------------------------------------------------------------- 368/* ---------------------------------------------------------------------