mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Albin Tonnerre <albin.tonnerre@gmail.com>
To: hskinnemoen@atmel.com
Cc: linux-kernel@vger.kernel.org,
	Albin Tonnerre <albin.tonnerre@free-electrons.com>
Subject: [PATCH] Add poll_get_char and poll_put_char uart_ops to atmel_serial.
Date: Tue, 30 Jun 2009 11:05:45 +0200	[thread overview]
Message-ID: <1246352745-31323-1-git-send-email-albin.tonnerre@free-electrons.com> (raw)

[Please CC: me on replies, I'm not subscribed]

This patch allows using KGDB over the console with the atmel_serial
driver.

Signed-off-by: Albin Tonnerre <albin.tonnerre@free-electrons.com>
---
 drivers/serial/atmel_serial.c |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/drivers/serial/atmel_serial.c b/drivers/serial/atmel_serial.c
index b3497d7..aaab321 100644
--- a/drivers/serial/atmel_serial.c
+++ b/drivers/serial/atmel_serial.c
@@ -1211,6 +1211,29 @@ static int atmel_verify_port(struct uart_port *port, struct serial_struct *ser)
 	return ret;
 }
 
+#ifdef CONFIG_CONSOLE_POLL
+static int atmel_poll_get_char(struct uart_port *port)
+{
+	struct atmel_uart_port *aup = to_atmel_uart_port(port);
+
+	while (!(readb(aup->uart.membase + ATMEL_US_CSR) & ATMEL_US_RXRDY))
+		barrier();
+
+	return readb(aup->uart.membase + ATMEL_US_RHR);
+}
+
+static void atmel_poll_put_char(struct uart_port *port, unsigned char ch)
+{
+	struct atmel_uart_port *aup = to_atmel_uart_port(port);
+	unsigned int status;
+
+	while (!(readb(aup->uart.membase + ATMEL_US_CSR) & ATMEL_US_TXRDY))
+		barrier();
+
+	writeb(ch, aup->uart.membase + ATMEL_US_THR);
+}
+#endif
+
 static struct uart_ops atmel_pops = {
 	.tx_empty	= atmel_tx_empty,
 	.set_mctrl	= atmel_set_mctrl,
@@ -1230,6 +1253,10 @@ static struct uart_ops atmel_pops = {
 	.config_port	= atmel_config_port,
 	.verify_port	= atmel_verify_port,
 	.pm		= atmel_serial_pm,
+#ifdef CONFIG_CONSOLE_POLL
+	.poll_get_char	= atmel_poll_get_char,
+	.poll_put_char	= atmel_poll_put_char,
+#endif
 };
 
 /*
-- 
1.6.0.4


             reply	other threads:[~2009-06-30  9:05 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-30  9:05 Albin Tonnerre [this message]
2009-07-27 14:23 ` Haavard Skinnemoen
2009-07-27 15:19   ` Albin Tonnerre
2009-07-28 16:09     ` Haavard Skinnemoen
2009-09-04 15:34       ` Albin Tonnerre
2009-09-07  6:22     ` Andrew Victor
2009-09-07  9:52       ` [PATCH v2] " Albin Tonnerre
2009-09-07 18:17         ` Andrew Victor
2009-09-08  8:30         ` Haavard Skinnemoen
2009-09-11 11:31           ` Albin Tonnerre
2009-10-10 18:57             ` Albin Tonnerre
2009-11-11 11:37         ` Albin Tonnerre
2009-11-12 22:24         ` Andrew Morton

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=1246352745-31323-1-git-send-email-albin.tonnerre@free-electrons.com \
    --to=albin.tonnerre@gmail.com \
    --cc=albin.tonnerre@free-electrons.com \
    --cc=hskinnemoen@atmel.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

all inboxes | Powered by JetHome®