* [PATCH] serial: imx: add console polling routines for kgdboc
@ 2008-08-13 8:27 Atsuo Igarashi
2008-08-15 6:31 ` Sascha Hauer
2008-08-15 15:10 ` Andrew Dyer
0 siblings, 2 replies; 3+ messages in thread
From: Atsuo Igarashi @ 2008-08-13 8:27 UTC (permalink / raw)
To: linux-serial; +Cc: linux-arm-kernel, kernel
[-- Attachment #1: Type: text/plain, Size: 123 bytes --]
Add console polling routines for the imx uart with kgdboc.
Signed-off-by Atsuo Igarashi <atsuo_igarashi@tripeaks.co.jp>
[-- Attachment #2: imx_serial_for_kgdb.diff --]
[-- Type: text/x-diff, Size: 1228 bytes --]
--- linux-2.6.orig/drivers/serial/imx.c 2008-08-13 15:06:45.000000000 +0900
+++ linux-2.6/drivers/serial/imx.c 2008-08-13 15:10:59.000000000 +0900
@@ -646,6 +646,29 @@ static void imx_shutdown(struct uart_por
writel(temp, sport->port.membase + UCR1);
}
+#ifdef CONFIG_CONSOLE_POLL
+
+static int imx_get_poll_char(struct uart_port *port)
+{
+ struct imx_port *sport = (struct imx_port *)port;
+
+ while (!(readl(sport->port.membase + USR2) & USR2_RDR));
+
+ return readl(sport->port.membase + URXD0);
+}
+
+static void imx_put_poll_char(struct uart_port *port, unsigned char ch)
+{
+ struct imx_port *sport = (struct imx_port *)port;
+
+ while (readl(sport->port.membase + UTS) & UTS_TXFULL)
+ barrier();
+
+ writel(ch, sport->port.membase + URTX0);
+}
+
+#endif /* CONFIG_CONSOLE_POLL */
+
static void
imx_set_termios(struct uart_port *port, struct ktermios *termios,
struct ktermios *old)
@@ -892,6 +915,10 @@ static struct uart_ops imx_pops = {
.request_port = imx_request_port,
.config_port = imx_config_port,
.verify_port = imx_verify_port,
+#ifdef CONFIG_CONSOLE_POLL
+ .poll_get_char = imx_get_poll_char,
+ .poll_put_char = imx_put_poll_char,
+#endif
};
static struct imx_port *imx_ports[UART_NR];
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] serial: imx: add console polling routines for kgdboc
2008-08-13 8:27 [PATCH] serial: imx: add console polling routines for kgdboc Atsuo Igarashi
@ 2008-08-15 6:31 ` Sascha Hauer
2008-08-15 15:10 ` Andrew Dyer
1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2008-08-15 6:31 UTC (permalink / raw)
To: Atsuo Igarashi; +Cc: linux-serial, linux-arm-kernel, kernel
On Wed, Aug 13, 2008 at 05:27:39PM +0900, Atsuo Igarashi wrote:
> Add console polling routines for the imx uart with kgdboc.
Thanks very much. I've never tried kgdb, so I cannot say if this patch
does the right thing, but it looks like it does ;)
I added it to our git tree.
Sascha
--
Pengutronix - Linux Solutions for Science and Industry
Handelsregister: Amtsgericht Hildesheim, HRA 2686
Hannoversche Str. 2, 31134 Hildesheim, Germany
Phone: +49-5121-206917-0 | Fax: +49-5121-206917-9
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] serial: imx: add console polling routines for kgdboc
2008-08-13 8:27 [PATCH] serial: imx: add console polling routines for kgdboc Atsuo Igarashi
2008-08-15 6:31 ` Sascha Hauer
@ 2008-08-15 15:10 ` Andrew Dyer
1 sibling, 0 replies; 3+ messages in thread
From: Andrew Dyer @ 2008-08-15 15:10 UTC (permalink / raw)
To: Atsuo Igarashi; +Cc: linux-serial, linux-arm-kernel, kernel
On Wed, Aug 13, 2008 at 3:27 AM, Atsuo Igarashi
<atsuo_igarashi@tripeaks.co.jp> wrote:
> Add console polling routines for the imx uart with kgdboc.
>
> Signed-off-by Atsuo Igarashi <atsuo_igarashi@tripeaks.co.jp>
>
In imx_get_poll_char() the code returns the result of reading the urxd
register. That register has the 8 bits of receive data in it, but in
the next byte up also has 4 bits of error flags (overrun, frame,
break, parity) and an error summary bit which are being ignored.
Maybe something like this?
static int imx_get_poll_char(struct uart_port *port)
{
struct imx_port *sport = (struct imx_port *)port;
int ch;
while (1) {
while (!(readl(sport->port.membase + USR2) & USR2_RDR));
ch = readl(sport->port.membase + URXD0);
if (!(ch & URXD_ERR))
return(ch & 0xff);
/* else throw away the char with the error and try
again (or return an error value?) */
}
}
--
Hardware, n.:
The parts of a computer system that can be kicked.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-08-15 15:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-13 8:27 [PATCH] serial: imx: add console polling routines for kgdboc Atsuo Igarashi
2008-08-15 6:31 ` Sascha Hauer
2008-08-15 15:10 ` Andrew Dyer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox