From: Bryan Wu <cooloney@kernel.org>
To: alan@lxorguk.ukuu.org.uk
Cc: linux-kernel@vger.kernel.org, Graf Yang <graf.yang@analog.com>,
Bryan Wu <cooloney@kernel.org>
Subject: [PATCH 2/2] Blackfin Serial Driver: Add a debug function to serial driver.
Date: Fri, 15 Aug 2008 16:23:37 +0800 [thread overview]
Message-ID: <1218788617-8302-3-git-send-email-cooloney@kernel.org> (raw)
In-Reply-To: <1218788617-8302-1-git-send-email-cooloney@kernel.org>
From: Graf Yang <graf.yang@analog.com>
Signed-off-by: Graf Yang <graf.yang@analog.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
---
drivers/serial/bfin_5xx.c | 53 ++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 52 insertions(+), 1 deletions(-)
diff --git a/drivers/serial/bfin_5xx.c b/drivers/serial/bfin_5xx.c
index a5ff54e..1917904 100644
--- a/drivers/serial/bfin_5xx.c
+++ b/drivers/serial/bfin_5xx.c
@@ -21,6 +21,7 @@
#include <linux/tty.h>
#include <linux/tty_flip.h>
#include <linux/serial_core.h>
+#include <stdarg.h>
#ifdef CONFIG_KGDB_UART
#include <linux/kgdb.h>
@@ -1101,7 +1102,8 @@ static __init void early_serial_putc(struct uart_port *port, int ch)
struct bfin_serial_port *uart = (struct bfin_serial_port *)port;
while ((!(UART_GET_LSR(uart) & THRE)) && --timeout)
- cpu_relax();
+ barrier();
+
UART_PUT_CHAR(uart, ch);
}
@@ -1150,6 +1152,55 @@ struct console __init *bfin_earlyserial_init(unsigned int port,
#endif /* CONFIG_SERIAL_BFIN_CONSOLE */
+#ifdef CONFIG_DEBUG_KERNEL
+void bfin_serial_debug(const char *fmt, ...)
+{
+ struct bfin_serial_port *uart = &bfin_serial_ports[0];
+ unsigned short status, tmp;
+ int flags, i, count;
+ char buf[128];
+ va_list ap;
+
+ if (bfin_serial_console.index < 0)
+ return; /* Too early. */
+
+ va_start(ap, fmt);
+ vsprintf(buf, fmt, ap);
+ va_end(ap);
+ count = strlen(buf);
+
+ spin_lock_irqsave(&uart->port.lock, flags);
+
+ for (i = 0; i < count; i++) {
+ do {
+ status = UART_GET_LSR(uart);
+ } while (!(status & THRE));
+
+#ifndef CONFIG_BF54x
+ tmp = UART_GET_LCR(uart);
+ tmp &= ~DLAB;
+ UART_PUT_LCR(uart, tmp);
+#endif
+ UART_PUT_CHAR(uart, buf[i]);
+ if (buf[i] == '\n') {
+ do {
+ status = UART_GET_LSR(uart);
+ } while (!(status & THRE));
+ UART_PUT_CHAR(uart, '\r');
+ }
+ }
+
+ spin_unlock_irqrestore(&uart->port.lock, flags);
+}
+EXPORT_SYMBOL(bfin_serial_debug);
+#else
+void bfin_serial_debug(const char *fmt, ...)
+{
+ return;
+}
+EXPORT_SYMBOL(bfin_serial_debug);
+#endif
+
static struct uart_driver bfin_serial_reg = {
.owner = THIS_MODULE,
.driver_name = "bfin-uart",
--
1.5.6
next prev parent reply other threads:[~2008-08-15 8:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-15 8:23 [PATCH 0/2] Blackfin Serial Drivers bug fixing (v2) Bryan Wu
2008-08-15 8:23 ` [PATCH 1/2] Blackfin Serial Driver: fix bug - Avoid null point exception in kgdb over UART Bryan Wu
2008-08-15 8:23 ` Bryan Wu [this message]
2008-08-15 12:47 ` [PATCH 2/2] Blackfin Serial Driver: Add a debug function to serial driver Mike Frysinger
2008-08-15 9:03 ` [PATCH 0/2] Blackfin Serial Drivers bug fixing (v2) Alan Cox
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=1218788617-8302-3-git-send-email-cooloney@kernel.org \
--to=cooloney@kernel.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=graf.yang@analog.com \
--cc=linux-kernel@vger.kernel.org \
/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
Powered by JetHome