From: Cosmin Cojocar <cosmin.cojocar@gmail.com>
To: govindraj.raja@ti.com
Cc: manjugk@ti.com, khilman@deeprootsystems.com, ben-linux@fluff.org,
tklauser@distanz.ch, feng.tang@intel.com, gregkh@suse.de,
alan@linux.intel.com, linux-omap@vger.kernel.org,
Cosmin Cojocar <cosmin.cojocar@gmail.com>
Subject: [PATCH 1/1] serial: omap-serial: Add support for kernel debugger
Date: Sat, 20 Nov 2010 21:51:36 +0100 [thread overview]
Message-ID: <1290286296-3589-1-git-send-email-cosmin.cojocar@gmail.com> (raw)
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>
---
drivers/serial/Makefile | 2 +-
drivers/serial/omap-serial.c | 38 ++++++++++++++++++++++++++++++++++++--
2 files changed, 37 insertions(+), 3 deletions(-)
diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile
index c570576..ad86113 100644
--- a/drivers/serial/Makefile
+++ b/drivers/serial/Makefile
@@ -80,6 +80,7 @@ obj-$(CONFIG_SERIAL_NETX) += netx-serial.o
obj-$(CONFIG_SERIAL_OF_PLATFORM) += of_serial.o
obj-$(CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL) += nwpserial.o
obj-$(CONFIG_SERIAL_KS8695) += serial_ks8695.o
+obj-$(CONFIG_SERIAL_OMAP) += omap-serial.o
obj-$(CONFIG_KGDB_SERIAL_CONSOLE) += kgdboc.o
obj-$(CONFIG_SERIAL_QE) += ucc_uart.o
obj-$(CONFIG_SERIAL_TIMBERDALE) += timbuart.o
@@ -88,4 +89,3 @@ obj-$(CONFIG_SERIAL_ALTERA_JTAGUART) += altera_jtaguart.o
obj-$(CONFIG_SERIAL_ALTERA_UART) += altera_uart.o
obj-$(CONFIG_SERIAL_MRST_MAX3110) += mrst_max3110.o
obj-$(CONFIG_SERIAL_MFD_HSU) += mfd.o
-obj-$(CONFIG_SERIAL_OMAP) += omap-serial.o
diff --git a/drivers/serial/omap-serial.c b/drivers/serial/omap-serial.c
index 03a96db..df6ba03 100644
--- a/drivers/serial/omap-serial.c
+++ b/drivers/serial/omap-serial.c
@@ -866,14 +866,44 @@ serial_omap_type(struct uart_port *port)
return up->name;
}
+#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
+
+#ifdef CONFIG_CONSOLE_POLL
+static void serial_omap_poll_put_char(struct uart_port *port, unsigned char ch)
+{
+ struct uart_omap_port *up = (struct uart_omap_port *)port;
+ unsigned int status;
+
+ do {
+ status = serial_in(up, UART_LSR);
+ udelay(1);
+ } while ((status & BOTH_EMPTY) != BOTH_EMPTY);
+
+ serial_out(up, UART_TX, ch);
+}
+
+static int serial_omap_poll_get_char(struct uart_port *port)
+{
+ struct uart_omap_port *up = (struct uart_omap_port *)port;
+ unsigned int status;
+ int ch;
+
+ do {
+ status = serial_in(up, UART_LSR);
+ udelay(1);
+ } while ((status & UART_LSR_DR) != UART_LSR_DR);
+
+ ch = (int)serial_in(up, UART_RX);
+ return ch;
+}
+#endif
+
#ifdef CONFIG_SERIAL_OMAP_CONSOLE
static struct uart_omap_port *serial_omap_console_ports[4];
static struct uart_driver serial_omap_reg;
-#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
-
static inline void wait_for_xmitr(struct uart_omap_port *up)
{
unsigned int status, tmout = 10000;
@@ -1022,6 +1052,10 @@ static struct uart_ops serial_omap_pops = {
.request_port = serial_omap_request_port,
.config_port = serial_omap_config_port,
.verify_port = serial_omap_verify_port,
+#ifdef CONFIG_CONSOLE_POLL
+ .poll_put_char = serial_omap_poll_put_char,
+ .poll_get_char = serial_omap_poll_get_char,
+#endif
};
static struct uart_driver serial_omap_reg = {
--
1.6.3.3
next reply other threads:[~2010-11-20 20:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-20 20:51 Cosmin Cojocar [this message]
2010-11-21 10:56 ` [PATCH 1/1] serial: omap-serial: Add support for kernel debugger Ionut Nicu
2010-11-21 13:12 ` Cosmin Cojocar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1290286296-3589-1-git-send-email-cosmin.cojocar@gmail.com \
--to=cosmin.cojocar@gmail.com \
--cc=alan@linux.intel.com \
--cc=ben-linux@fluff.org \
--cc=feng.tang@intel.com \
--cc=govindraj.raja@ti.com \
--cc=gregkh@suse.de \
--cc=khilman@deeprootsystems.com \
--cc=linux-omap@vger.kernel.org \
--cc=manjugk@ti.com \
--cc=tklauser@distanz.ch \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox