aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial
diff options
context:
space:
mode:
authorCosmin Cojocar <cosmin.cojocar@gmail.com>2010-12-05 10:15:10 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2010-12-10 18:17:19 -0500
commit1b41dbc1296269797efbb2b0837732b74de4731d (patch)
tree96281f7869f5b98f7cd9082d52d781ed86b85ebb /drivers/serial
parent5ac387d983149d4658aad17242d24eef85a43fa8 (diff)
serial: omap-serial: Add support for kernel debugger
The kgdb invokes the poll_put_char and poll_get_char when communicating with the host. This patch also changes the initialization order because the kgdb will check at the very beginning, if there is a valid serial driver. Signed-off-by: Cosmin Cojocar <cosmin.cojocar@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/serial')
-rw-r--r--drivers/serial/Makefile2
-rw-r--r--drivers/serial/omap-serial.c38
2 files changed, 33 insertions, 7 deletions
diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile
index f9b26dfb175d..8ea92e9c73b0 100644
--- a/drivers/serial/Makefile
+++ b/drivers/serial/Makefile
@@ -80,6 +80,7 @@ obj-$(CONFIG_SERIAL_NETX) += netx-serial.o
80obj-$(CONFIG_SERIAL_OF_PLATFORM) += of_serial.o 80obj-$(CONFIG_SERIAL_OF_PLATFORM) += of_serial.o
81obj-$(CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL) += nwpserial.o 81obj-$(CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL) += nwpserial.o
82obj-$(CONFIG_SERIAL_KS8695) += serial_ks8695.o 82obj-$(CONFIG_SERIAL_KS8695) += serial_ks8695.o
83obj-$(CONFIG_SERIAL_OMAP) += omap-serial.o
83obj-$(CONFIG_KGDB_SERIAL_CONSOLE) += kgdboc.o 84obj-$(CONFIG_KGDB_SERIAL_CONSOLE) += kgdboc.o
84obj-$(CONFIG_SERIAL_QE) += ucc_uart.o 85obj-$(CONFIG_SERIAL_QE) += ucc_uart.o
85obj-$(CONFIG_SERIAL_TIMBERDALE) += timbuart.o 86obj-$(CONFIG_SERIAL_TIMBERDALE) += timbuart.o
@@ -89,6 +90,5 @@ obj-$(CONFIG_SERIAL_ALTERA_UART) += altera_uart.o
89obj-$(CONFIG_SERIAL_VT8500) += vt8500_serial.o 90obj-$(CONFIG_SERIAL_VT8500) += vt8500_serial.o
90obj-$(CONFIG_SERIAL_MRST_MAX3110) += mrst_max3110.o 91obj-$(CONFIG_SERIAL_MRST_MAX3110) += mrst_max3110.o
91obj-$(CONFIG_SERIAL_MFD_HSU) += mfd.o 92obj-$(CONFIG_SERIAL_MFD_HSU) += mfd.o
92obj-$(CONFIG_SERIAL_OMAP) += omap-serial.o
93obj-$(CONFIG_SERIAL_IFX6X60) += ifx6x60.o 93obj-$(CONFIG_SERIAL_IFX6X60) += ifx6x60.o
94obj-$(CONFIG_SERIAL_PCH_UART) += pch_uart.o 94obj-$(CONFIG_SERIAL_PCH_UART) += pch_uart.o
diff --git a/drivers/serial/omap-serial.c b/drivers/serial/omap-serial.c
index 14365f72b664..54239f5a9948 100644
--- a/drivers/serial/omap-serial.c
+++ b/drivers/serial/omap-serial.c
@@ -866,12 +866,6 @@ serial_omap_type(struct uart_port *port)
866 return up->name; 866 return up->name;
867} 867}
868 868
869#ifdef CONFIG_SERIAL_OMAP_CONSOLE
870
871static struct uart_omap_port *serial_omap_console_ports[4];
872
873static struct uart_driver serial_omap_reg;
874
875#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE) 869#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
876 870
877static inline void wait_for_xmitr(struct uart_omap_port *up) 871static inline void wait_for_xmitr(struct uart_omap_port *up)
@@ -905,6 +899,34 @@ static inline void wait_for_xmitr(struct uart_omap_port *up)
905 } 899 }
906} 900}
907 901
902#ifdef CONFIG_CONSOLE_POLL
903
904static void serial_omap_poll_put_char(struct uart_port *port, unsigned char ch)
905{
906 struct uart_omap_port *up = (struct uart_omap_port *)port;
907 wait_for_xmitr(up);
908 serial_out(up, UART_TX, ch);
909}
910
911static int serial_omap_poll_get_char(struct uart_port *port)
912{
913 struct uart_omap_port *up = (struct uart_omap_port *)port;
914 unsigned int status = serial_in(up, UART_LSR);
915
916 if (!(status & UART_LSR_DR))
917 return NO_POLL_CHAR;
918
919 return serial_in(up, UART_RX);
920}
921
922#endif /* CONFIG_CONSOLE_POLL */
923
924#ifdef CONFIG_SERIAL_OMAP_CONSOLE
925
926static struct uart_omap_port *serial_omap_console_ports[4];
927
928static struct uart_driver serial_omap_reg;
929
908static void serial_omap_console_putchar(struct uart_port *port, int ch) 930static void serial_omap_console_putchar(struct uart_port *port, int ch)
909{ 931{
910 struct uart_omap_port *up = (struct uart_omap_port *)port; 932 struct uart_omap_port *up = (struct uart_omap_port *)port;
@@ -1022,6 +1044,10 @@ static struct uart_ops serial_omap_pops = {
1022 .request_port = serial_omap_request_port, 1044 .request_port = serial_omap_request_port,
1023 .config_port = serial_omap_config_port, 1045 .config_port = serial_omap_config_port,
1024 .verify_port = serial_omap_verify_port, 1046 .verify_port = serial_omap_verify_port,
1047#ifdef CONFIG_CONSOLE_POLL
1048 .poll_put_char = serial_omap_poll_put_char,
1049 .poll_get_char = serial_omap_poll_get_char,
1050#endif
1025}; 1051};
1026 1052
1027static struct uart_driver serial_omap_reg = { 1053static struct uart_driver serial_omap_reg = {