diff options
author | Denis V. Lunev <den@openvz.org> | 2012-10-21 00:00:30 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-10-24 14:38:28 -0400 |
commit | e1a9c17969f0aa60cb00f1f777b33a07f4e84883 (patch) | |
tree | 9a9b9308c1fcf1d482ceed19a9ed5513980221fd /drivers | |
parent | c97399418a25b18943c9910fb28e0ee5ecc3c316 (diff) |
tty: serial: KGDB support for PXA
Actually, in order to support KGDB over serial console one must
implement two callbacks for character polling. Clone them from
8250 driver with a bit of tuning.
Signed-off-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: Marko Katic <dromede@gmail.com>
CC: Eric Miao <eric.y.miao@gmail.com>
CC: Russell King <linux@arm.linux.org.uk>
Acked-by: Haojian Zhuang <haojian.zhuang@gmail.com>
drivers/tty/serial/pxa.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 55 insertions(+), 0 deletions(-)
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/tty/serial/pxa.c | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/drivers/tty/serial/pxa.c b/drivers/tty/serial/pxa.c index 9033fc6e0e4e..2764828251f5 100644 --- a/drivers/tty/serial/pxa.c +++ b/drivers/tty/serial/pxa.c | |||
@@ -705,6 +705,57 @@ serial_pxa_console_write(struct console *co, const char *s, unsigned int count) | |||
705 | clk_disable_unprepare(up->clk); | 705 | clk_disable_unprepare(up->clk); |
706 | } | 706 | } |
707 | 707 | ||
708 | #ifdef CONFIG_CONSOLE_POLL | ||
709 | /* | ||
710 | * Console polling routines for writing and reading from the uart while | ||
711 | * in an interrupt or debug context. | ||
712 | */ | ||
713 | |||
714 | static int serial_pxa_get_poll_char(struct uart_port *port) | ||
715 | { | ||
716 | struct uart_pxa_port *up = (struct uart_pxa_port *)port; | ||
717 | unsigned char lsr = serial_in(up, UART_LSR); | ||
718 | |||
719 | while (!(lsr & UART_LSR_DR)) | ||
720 | lsr = serial_in(up, UART_LSR); | ||
721 | |||
722 | return serial_in(up, UART_RX); | ||
723 | } | ||
724 | |||
725 | |||
726 | static void serial_pxa_put_poll_char(struct uart_port *port, | ||
727 | unsigned char c) | ||
728 | { | ||
729 | unsigned int ier; | ||
730 | struct uart_pxa_port *up = (struct uart_pxa_port *)port; | ||
731 | |||
732 | /* | ||
733 | * First save the IER then disable the interrupts | ||
734 | */ | ||
735 | ier = serial_in(up, UART_IER); | ||
736 | serial_out(up, UART_IER, UART_IER_UUE); | ||
737 | |||
738 | wait_for_xmitr(up); | ||
739 | /* | ||
740 | * Send the character out. | ||
741 | * If a LF, also do CR... | ||
742 | */ | ||
743 | serial_out(up, UART_TX, c); | ||
744 | if (c == 10) { | ||
745 | wait_for_xmitr(up); | ||
746 | serial_out(up, UART_TX, 13); | ||
747 | } | ||
748 | |||
749 | /* | ||
750 | * Finally, wait for transmitter to become empty | ||
751 | * and restore the IER | ||
752 | */ | ||
753 | wait_for_xmitr(up); | ||
754 | serial_out(up, UART_IER, ier); | ||
755 | } | ||
756 | |||
757 | #endif /* CONFIG_CONSOLE_POLL */ | ||
758 | |||
708 | static int __init | 759 | static int __init |
709 | serial_pxa_console_setup(struct console *co, char *options) | 760 | serial_pxa_console_setup(struct console *co, char *options) |
710 | { | 761 | { |
@@ -759,6 +810,10 @@ struct uart_ops serial_pxa_pops = { | |||
759 | .request_port = serial_pxa_request_port, | 810 | .request_port = serial_pxa_request_port, |
760 | .config_port = serial_pxa_config_port, | 811 | .config_port = serial_pxa_config_port, |
761 | .verify_port = serial_pxa_verify_port, | 812 | .verify_port = serial_pxa_verify_port, |
813 | #ifdef CONFIG_CONSOLE_POLL | ||
814 | .poll_get_char = serial_pxa_get_poll_char, | ||
815 | .poll_put_char = serial_pxa_put_poll_char, | ||
816 | #endif | ||
762 | }; | 817 | }; |
763 | 818 | ||
764 | static struct uart_driver serial_pxa_reg = { | 819 | static struct uart_driver serial_pxa_reg = { |