serial: Add CONSOLE_POLL support for uartlite
PATCH 1/1 serial: Add CONSOLE_POLL support for uartlite
CONSOLE_POLL support for uartlite enables
KGDB debugging over serial line.
--- drivers/serial/uartlite.c | 26 +++++++++++++++++++++++++- 1 files changed, 25 insertions(+), 1 deletions(-)
drivers/serial/uartlite.c +25 -1
@@ -322,6 +322,26 @@ static int ulite_verify_port(struct uart_port *port, struct serial_struct *ser)return -EINVAL ; } +#ifdef CONFIG_CONSOLE_POLL +static int ulite_get_poll_char (struct uart_port *port) +{ +while (!(ioread32be (port->membase +ULITE_STATUS ) + &ULITE_STATUS_RXVALID )) +cpu_relax (); + +return ioread32be (port->membase +ULITE_RX ); +} + +static void ulite_put_poll_char (struct uart_port *port,unsigned char ch) +{ +while (ioread32be (port->membase +ULITE_STATUS ) &ULITE_STATUS_TXFULL ) +cpu_relax (); + +/* write char to device */ +iowrite32be (ch, port->membase +ULITE_TX ); +} +#endif +static struct uart_ops ulite_ops = { .tx_empty = ulite_tx_empty, .set_mctrl = ulite_set_mctrl,
@@ -338,7 +358,11 @@ static struct uart_ops ulite_ops = { .release_port = ulite_release_port, .request_port = ulite_request_port, .config_port = ulite_config_port, - .verify_port = ulite_verify_port + .verify_port = ulite_verify_port, +#ifdef CONFIG_CONSOLE_POLL + .poll_get_char = ulite_get_poll_char, + .poll_put_char = ulite_put_poll_char, +#endif };/* ---------------------------------------------------------------------
Signature · 1 line
1.5.5.6
Quoted 15 lines · Michal Simek
CONSOLE_POLLsupport for uartlite enables
KGDB debugging over serial line.Signed-off-by Michal Simek <[email protected]>--- drivers/serial/uartlite.c | 26 +++++++++++++++++++++++++- 1 files changed, 25 insertions(+), 1 deletions(-)drivers/serial/uartlite.c +0
-0@@ -322,6 +322,26 @@ static int ulite_verify_port(struct uart_port *port, struct serial_struct *ser)return -EINVAL ; }
drivers/serial/uartlite.c static int ulite_verify_port(struct uart_port *port, struct serial_struct *ser) · line 333
Quoted 10 lines
drivers/serial/uartlite.c +9
-0+#ifdef CONFIG_CONSOLE_POLL +static int ulite_get_poll_char (struct uart_port *port) +{ +while (!(ioread32be (port->membase +ULITE_STATUS ) + &ULITE_STATUS_RXVALID )) +cpu_relax (); + +return ioread32be (port->membase +ULITE_RX ); +}
After kdb was merged, the CONSOLE_POLL API had a subtle change where all I/O drivers should return immediately with a return of NO_POLL_CHAR in order to allow more than one I/O driver to operate in the same poll loop.
The patch should look like the following for the get_poll_char.
+static int ulite_get_poll_char(struct uart_port *port) +{
+ if (!(ioread32be(port->membase + ULITE_STATUS)
+ & ULITE_STATUS_RXVALID))
+ return NO_POLL_CHAR;
+
+ return ioread32be(port->membase + ULITE_RX);
+}
If you agree to the change you can add my SOB.
Cheers,
Jason.
------------------------------------------------------------------------------
This SF.net email is sponsored by
Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev
Quoted 47 lines · Jason Wessel
Quoted 15 lines · Michal Simek
CONSOLE_POLLsupport for uartlite enables
KGDB debugging over serial line.Signed-off-by Michal Simek <[email protected]>--- drivers/serial/uartlite.c | 26 +++++++++++++++++++++++++- 1 files changed, 25 insertions(+), 1 deletions(-)drivers/serial/uartlite.c +0
-0@@ -322,6 +322,26 @@ static int ulite_verify_port(struct uart_port *port, struct serial_struct *ser)return -EINVAL ; }drivers/serial/uartlite.c static int ulite_verify_port(struct uart_port *port, struct serial_struct *ser) · line 333
Quoted 10 lines
drivers/serial/uartlite.c +9
-0+#ifdef CONFIG_CONSOLE_POLL +static int ulite_get_poll_char (struct uart_port *port) +{ +while (!(ioread32be (port->membase +ULITE_STATUS ) + &ULITE_STATUS_RXVALID )) +cpu_relax (); + +return ioread32be (port->membase +ULITE_RX ); +}After kdb was merged, the
CONSOLE_POLLAPI had a subtle change where all I/O drivers should return immediately with a return ofNO_POLL_CHARin order to allow more than one I/O driver to operate in the same poll loop.The patch should look like the following for the
get_poll_char.drivers/serial/uartlite.c +8
-0+static int ulite_get_poll_char (struct uart_port *port) +{ +if (!(ioread32be (port->membase +ULITE_STATUS ) + &ULITE_STATUS_RXVALID )) +return NO_POLL_CHAR ; + +return ioread32be (port->membase +ULITE_RX ); +}
Quoted 3 lines
If you agree to the change you can add my SOB.
Signed-off-by Jason Wessel <[email protected]>
I have no problem with it.
Thanks,
Michal
Signature · 4 lines
Michal Simek, Ing. (M.Eng) w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/ Microblaze U-BOOT custodian