From: Bryan Wu <cooloney@kernel.org>
To: alan@redhat.com
Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
Graf Yang <graf.yang@analog.com>, Bryan Wu <cooloney@kernel.org>
Subject: [PATCH 2/6] Blackfin Serial Driver: Add a debug function to serial driver.
Date: Mon, 13 Oct 2008 17:46:21 +0800 [thread overview]
Message-ID: <1223891185-13924-3-git-send-email-cooloney@kernel.org> (raw)
In-Reply-To: <1223891185-13924-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 | 47 ++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 46 insertions(+), 1 deletions(-)
diff --git a/drivers/serial/bfin_5xx.c b/drivers/serial/bfin_5xx.c
index d63fad7..aea3a53 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>
#if defined(CONFIG_KGDB_SERIAL_CONSOLE) || \
defined(CONFIG_KGDB_SERIAL_CONSOLE_MODULE)
@@ -1106,7 +1107,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);
}
@@ -1155,6 +1157,49 @@ 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);
+#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-10-13 9:45 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-13 9:46 [PATCH 0/6] Blackfin Serial Driver updates for 2.6.28 Bryan Wu
2008-10-13 9:46 ` [PATCH 1/6] Blackfin Serial Driver: updates kgdb over Blackfin serial driver with kgdb framework Bryan Wu
2008-10-13 9:46 ` Bryan Wu [this message]
2008-10-14 13:27 ` [PATCH 2/6] Blackfin Serial Driver: Add a debug function to serial driver Alan Cox
2008-10-14 13:27 ` Alan Cox
2008-10-15 2:23 ` gyang
2008-10-15 2:23 ` gyang
2008-10-15 8:38 ` Alan Cox
2008-10-16 13:58 ` Bryan Wu
2008-10-13 9:46 ` [PATCH 3/6] Blackfin Serial Driver: fix bug - SIR driver stop receiving randomly Bryan Wu
2008-10-13 9:46 ` [PATCH 4/6] Blackfin Serial Driver: Clean serial console and early prink code` Bryan Wu
2008-10-13 9:46 ` [PATCH 5/6] Blackfin Serial Driver: Fix bug - BF527-EZKIT unable to receive large files over UART in DMA mode Bryan Wu
2008-10-13 9:46 ` [PATCH 6/6] Blackfin Serial Driver: Remove BI status for known_good_char Bryan Wu
2008-10-13 10:16 ` [PATCH 0/6] Blackfin Serial Driver updates for 2.6.28 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=1223891185-13924-3-git-send-email-cooloney@kernel.org \
--to=cooloney@kernel.org \
--cc=alan@redhat.com \
--cc=graf.yang@analog.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.