diff options
author | Alexey Charkov <alchark@gmail.com> | 2014-09-06 21:21:15 +0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-09-08 16:29:36 -0700 |
commit | 1db894ecfa73759b1fde359562b9b4ef0e66e23d (patch) | |
tree | 359aae45a135c23c19fd7c89de2961d18f4d9aff | |
parent | 8c986d3e20bcbf33c680130a5798f25429c53e31 (diff) | |
download | blackbird-op-linux-1db894ecfa73759b1fde359562b9b4ef0e66e23d.tar.gz blackbird-op-linux-1db894ecfa73759b1fde359562b9b4ef0e66e23d.zip |
tty: vt8500_serial: add polled console functions
This adds simple polling functions for single-character transmit
and receive, as used by kgdb.
Signed-off-by: Alexey Charkov <alchark@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/tty/serial/vt8500_serial.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/drivers/tty/serial/vt8500_serial.c b/drivers/tty/serial/vt8500_serial.c index 47e74f9b01ae..4203862ef6cb 100644 --- a/drivers/tty/serial/vt8500_serial.c +++ b/drivers/tty/serial/vt8500_serial.c @@ -558,6 +558,33 @@ static struct console vt8500_console = { #define VT8500_CONSOLE NULL #endif +#ifdef CONFIG_CONSOLE_POLL +static int vt8500_get_poll_char(struct uart_port *port) +{ + unsigned int status = vt8500_read(port, VT8500_URFIDX); + + if (!(status & 0x1f00)) + return NO_POLL_CHAR; + + return vt8500_read(port, VT8500_RXFIFO) & 0xff; +} + +static void vt8500_put_poll_char(struct uart_port *port, unsigned char c) +{ + unsigned int status, tmout = 10000; + + do { + status = vt8500_read(port, VT8500_URFIDX); + + if (--tmout == 0) + break; + udelay(1); + } while (status & 0x10); + + vt8500_write(port, c, VT8500_TXFIFO); +} +#endif + static struct uart_ops vt8500_uart_pops = { .tx_empty = vt8500_tx_empty, .set_mctrl = vt8500_set_mctrl, @@ -575,6 +602,10 @@ static struct uart_ops vt8500_uart_pops = { .request_port = vt8500_request_port, .config_port = vt8500_config_port, .verify_port = vt8500_verify_port, +#ifdef CONFIG_CONSOLE_POLL + .poll_get_char = vt8500_get_poll_char, + .poll_put_char = vt8500_put_poll_char, +#endif }; static struct uart_driver vt8500_uart_driver = { |