Skip to contentSkip to conversation

Uartlite - poll support

PATCH In review Michal Simek 3 participants 5 messages Aug 17, 2010 – Aug 23, 2010 TTY layer and serial drivers

lore
Share & tools
lore
#0 lore raw

Hi Greg,

I am not sure who is responsible for drivers/serial but I see that your tty tree contains a lot of serial patches. Could you please add the uartlite poll patch to your tree?

Thanks,
Michal

#1 lore raw

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
index 9b03d7b..c0fae0d 100644
@@ -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))
+		return NO_POLL_CHAR;
+
+	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
Acked-by on v1 1/1
#2 lore raw

Re: [PATCH] serial: Add CONSOLE_POLL support for uartlite

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Michal" == Michal Simek <[email protected]> writes:

Michal> CONSOLE_POLL support for uartlite enables Michal> KGDB debugging over serial line.

Please CC me on uartlite patches in the future, thanks.

Michal> Signed-off-by: Michal Simek <[email protected]> Michal> Signed-off-by: Jason Wessel <[email protected]> Michal> ---

 Michal>  drivers/serial/uartlite.c |   26 +++++++++++++++++++++++++-

Michal> 1 files changed, 25 insertions(+), 1 deletions(-)

Michal> diff --git a/drivers/serial/uartlite.c b/drivers/serial/uartlite.c
Michal> index 9b03d7b..c0fae0d 100644
Michal> --- a/drivers/serial/uartlite.c
Michal> +++ b/drivers/serial/uartlite.c
Michal> @@ -322,6 +322,26 @@ static int ulite_verify_port(struct uart_port *port, struct serial_struct *ser)
Michal> return -EINVAL;
Michal> }

Michal> +#ifdef CONFIG_CONSOLE_POLL
Michal> +static int ulite_get_poll_char(struct uart_port *port) Michal> +{
Michal> + while (!(ioread32be(port->membase + ULITE_STATUS)
Michal> + & ULITE_STATUS_RXVALID))
Michal> + return NO_POLL_CHAR;
Michal> +

Using while instead of 'if' is imho pretty obscure here.

Michal> + return ioread32be(port->membase + ULITE_RX);
Michal> +}
Michal> +
Michal> +static void ulite_put_poll_char(struct uart_port *port, unsigned char ch) Michal> +{
Michal> + while (ioread32be(port->membase + ULITE_STATUS) & ULITE_STATUS_TXFULL)
Michal> + cpu_relax();

You could reuse ulite_console_wait_tx() like ulite_console_putchar() does.

Otherwise it looks fine.

Signature · 1 line
Bye, Peter Korsgaard
#3 lore raw

Re: [PATCH] serial: Add CONSOLE_POLL support for uartlite

Quoted 6 lines · Peter Korsgaard
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Michal" == Michal Simek <[email protected]> writes:

Michal> CONSOLE_POLL support for uartlite enables Michal> KGDB debugging over serial line.

Please CC me on uartlite patches in the future, thanks.

Oou sorry.

Quoted 23 lines

Michal> Signed-off-by: Michal Simek <[email protected]> Michal> Signed-off-by: Jason Wessel <[email protected]> Michal> ---

 Michal>  drivers/serial/uartlite.c |   26 +++++++++++++++++++++++++-

Michal> 1 files changed, 25 insertions(+), 1 deletions(-)

Michal> diff --git a/drivers/serial/uartlite.c b/drivers/serial/uartlite.c
Michal> index 9b03d7b..c0fae0d 100644
Michal> --- a/drivers/serial/uartlite.c
Michal> +++ b/drivers/serial/uartlite.c
Michal> @@ -322,6 +322,26 @@ static int ulite_verify_port(struct uart_port *port, struct serial_struct *ser)
Michal> return -EINVAL;
Michal> }

Michal> +#ifdef CONFIG_CONSOLE_POLL
Michal> +static int ulite_get_poll_char(struct uart_port *port) Michal> +{
Michal> + while (!(ioread32be(port->membase + ULITE_STATUS)
Michal> + & ULITE_STATUS_RXVALID))
Michal> + return NO_POLL_CHAR;
Michal> +

Quoted 1 line

Using while instead of 'if' is imho pretty obscure here.

Agree that if is the better solution.

Quoted 10 lines

Michal> + return ioread32be(port->membase + ULITE_RX);
Michal> +}
Michal> +
Michal> +static void ulite_put_poll_char(struct uart_port *port, unsigned char ch) Michal> +{
Michal> + while (ioread32be(port->membase + ULITE_STATUS) & ULITE_STATUS_TXFULL)
Michal> + cpu_relax();

Quoted 2 lines

You could reuse ulite_console_wait_tx() like ulite_console_putchar() does.

yes, but ulite_console_wait_tx is used only when uartlite console is used. Not sure if I tried to setup console and KGDB but in this case I will have to add some ifdef that's why was easier for me to write on ioread.

Quoted 5 lines

Otherwise it looks fine.

I will changed driver and send v2.

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
#4 lore raw
In reply to Michal Simek
Quoted 5 lines · Michal Simek

Hi Greg,

I am not sure who is responsible for drivers/serial but I see that your tty tree contains a lot of serial patches. Could you please add the uartlite poll patch to your tree?

Sure, I'll queue it up for .37.

thanks,

greg k-h