All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tty: serial: Add CONSOLE_POLL support to SiFive UART
@ 2020-03-03  8:41 ` Vincent Chen
  0 siblings, 0 replies; 10+ messages in thread
From: Vincent Chen @ 2020-03-03  8:41 UTC (permalink / raw)
  To: gregkh, jslaby, palmer, paul.walmsley
  Cc: linux-serial, linux-riscv, Vincent Chen

Add CONSOLE_POLL support for future KGDB porting.

Signed-off-by: Vincent Chen <vincent.chen@sifive.com>
---
 drivers/tty/serial/sifive.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/drivers/tty/serial/sifive.c b/drivers/tty/serial/sifive.c
index d5f81b98e4d7..acdbaca4de36 100644
--- a/drivers/tty/serial/sifive.c
+++ b/drivers/tty/serial/sifive.c
@@ -818,6 +818,29 @@ static int __init sifive_serial_console_setup(struct console *co, char *options)
 	return uart_set_options(&ssp->port, co, baud, parity, bits, flow);
 }
 
+#ifdef CONFIG_CONSOLE_POLL
+static int sifive_serial_poll_get_char(struct uart_port *port)
+{
+	struct sifive_serial_port *ssp = port_to_sifive_serial_port(port);
+	char is_empty, ch;
+
+	ch = __ssp_receive_char(ssp, &is_empty);
+	if (is_empty)
+		return NO_POLL_CHAR;
+
+	return ch;
+}
+
+static void sifive_serial_poll_put_char(struct uart_port *port,
+					unsigned char c)
+{
+	struct sifive_serial_port *ssp = port_to_sifive_serial_port(port);
+
+	sifive_serial_console_putchar(port, c);
+	__ssp_wait_for_xmitr(ssp);
+}
+#endif /* CONFIG_CONSOLE_POLL */
+
 static struct uart_driver sifive_serial_uart_driver;
 
 static struct console sifive_serial_console = {
@@ -877,6 +900,10 @@ static const struct uart_ops sifive_serial_uops = {
 	.request_port	= sifive_serial_request_port,
 	.config_port	= sifive_serial_config_port,
 	.verify_port	= sifive_serial_verify_port,
+#ifdef CONFIG_CONSOLE_POLL
+	.poll_get_char	= sifive_serial_poll_get_char,
+	.poll_put_char	= sifive_serial_poll_put_char,
+#endif
 };
 
 static struct uart_driver sifive_serial_uart_driver = {
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH] tty: serial: Add CONSOLE_POLL support to SiFive UART
@ 2020-03-03  8:41 ` Vincent Chen
  0 siblings, 0 replies; 10+ messages in thread
From: Vincent Chen @ 2020-03-03  8:41 UTC (permalink / raw)
  To: gregkh, jslaby, palmer, paul.walmsley
  Cc: Vincent Chen, linux-riscv, linux-serial

Add CONSOLE_POLL support for future KGDB porting.

Signed-off-by: Vincent Chen <vincent.chen@sifive.com>
---
 drivers/tty/serial/sifive.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/drivers/tty/serial/sifive.c b/drivers/tty/serial/sifive.c
index d5f81b98e4d7..acdbaca4de36 100644
--- a/drivers/tty/serial/sifive.c
+++ b/drivers/tty/serial/sifive.c
@@ -818,6 +818,29 @@ static int __init sifive_serial_console_setup(struct console *co, char *options)
 	return uart_set_options(&ssp->port, co, baud, parity, bits, flow);
 }
 
+#ifdef CONFIG_CONSOLE_POLL
+static int sifive_serial_poll_get_char(struct uart_port *port)
+{
+	struct sifive_serial_port *ssp = port_to_sifive_serial_port(port);
+	char is_empty, ch;
+
+	ch = __ssp_receive_char(ssp, &is_empty);
+	if (is_empty)
+		return NO_POLL_CHAR;
+
+	return ch;
+}
+
+static void sifive_serial_poll_put_char(struct uart_port *port,
+					unsigned char c)
+{
+	struct sifive_serial_port *ssp = port_to_sifive_serial_port(port);
+
+	sifive_serial_console_putchar(port, c);
+	__ssp_wait_for_xmitr(ssp);
+}
+#endif /* CONFIG_CONSOLE_POLL */
+
 static struct uart_driver sifive_serial_uart_driver;
 
 static struct console sifive_serial_console = {
@@ -877,6 +900,10 @@ static const struct uart_ops sifive_serial_uops = {
 	.request_port	= sifive_serial_request_port,
 	.config_port	= sifive_serial_config_port,
 	.verify_port	= sifive_serial_verify_port,
+#ifdef CONFIG_CONSOLE_POLL
+	.poll_get_char	= sifive_serial_poll_get_char,
+	.poll_put_char	= sifive_serial_poll_put_char,
+#endif
 };
 
 static struct uart_driver sifive_serial_uart_driver = {
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] tty: serial: Add CONSOLE_POLL support to SiFive UART
  2020-03-03  8:41 ` Vincent Chen
@ 2020-03-06 18:13   ` Palmer Dabbelt
  -1 siblings, 0 replies; 10+ messages in thread
From: Palmer Dabbelt @ 2020-03-06 18:13 UTC (permalink / raw)
  To: vincent.chen, Greg KH, jslaby, Paul Walmsley
  Cc: linux-serial, linux-riscv, vincent.chen

On Tue, 03 Mar 2020 00:41:40 PST (-0800), vincent.chen@sifive.com wrote:
> Add CONSOLE_POLL support for future KGDB porting.
>
> Signed-off-by: Vincent Chen <vincent.chen@sifive.com>
> ---
>  drivers/tty/serial/sifive.c | 27 +++++++++++++++++++++++++++
>  1 file changed, 27 insertions(+)
>
> diff --git a/drivers/tty/serial/sifive.c b/drivers/tty/serial/sifive.c
> index d5f81b98e4d7..acdbaca4de36 100644
> --- a/drivers/tty/serial/sifive.c
> +++ b/drivers/tty/serial/sifive.c
> @@ -818,6 +818,29 @@ static int __init sifive_serial_console_setup(struct console *co, char *options)
>  	return uart_set_options(&ssp->port, co, baud, parity, bits, flow);
>  }
>
> +#ifdef CONFIG_CONSOLE_POLL
> +static int sifive_serial_poll_get_char(struct uart_port *port)
> +{
> +	struct sifive_serial_port *ssp = port_to_sifive_serial_port(port);
> +	char is_empty, ch;
> +
> +	ch = __ssp_receive_char(ssp, &is_empty);
> +	if (is_empty)
> +		return NO_POLL_CHAR;
> +
> +	return ch;
> +}
> +
> +static void sifive_serial_poll_put_char(struct uart_port *port,
> +					unsigned char c)
> +{
> +	struct sifive_serial_port *ssp = port_to_sifive_serial_port(port);
> +
> +	sifive_serial_console_putchar(port, c);
> +	__ssp_wait_for_xmitr(ssp);

So we still have that TX watermark bug in the SiFive UARTs.  If this function
is supposed to wait until the word is actually out on the line then this isn't
sufficient, but if it's just supposed to wait until the next write won't block
then this is fine.

I'm not really a serial person, so mabye someone else knows?  For those
unfamiliar with the issue, there's a pretty good description in the patch to
fix it

    https://github.com/sifive/sifive-blocks/pull/90

Poking around we don't have any PRE_RATE_CHANGE hook, so I'm going to take a
whack at adding one -- not really related to this patch, though.

> +}
> +#endif /* CONFIG_CONSOLE_POLL */
> +
>  static struct uart_driver sifive_serial_uart_driver;
>
>  static struct console sifive_serial_console = {
> @@ -877,6 +900,10 @@ static const struct uart_ops sifive_serial_uops = {
>  	.request_port	= sifive_serial_request_port,
>  	.config_port	= sifive_serial_config_port,
>  	.verify_port	= sifive_serial_verify_port,
> +#ifdef CONFIG_CONSOLE_POLL
> +	.poll_get_char	= sifive_serial_poll_get_char,
> +	.poll_put_char	= sifive_serial_poll_put_char,
> +#endif
>  };
>
>  static struct uart_driver sifive_serial_uart_driver = {

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] tty: serial: Add CONSOLE_POLL support to SiFive UART
@ 2020-03-06 18:13   ` Palmer Dabbelt
  0 siblings, 0 replies; 10+ messages in thread
From: Palmer Dabbelt @ 2020-03-06 18:13 UTC (permalink / raw)
  To: vincent.chen, Greg KH, jslaby, Paul Walmsley
  Cc: vincent.chen, linux-riscv, linux-serial

On Tue, 03 Mar 2020 00:41:40 PST (-0800), vincent.chen@sifive.com wrote:
> Add CONSOLE_POLL support for future KGDB porting.
>
> Signed-off-by: Vincent Chen <vincent.chen@sifive.com>
> ---
>  drivers/tty/serial/sifive.c | 27 +++++++++++++++++++++++++++
>  1 file changed, 27 insertions(+)
>
> diff --git a/drivers/tty/serial/sifive.c b/drivers/tty/serial/sifive.c
> index d5f81b98e4d7..acdbaca4de36 100644
> --- a/drivers/tty/serial/sifive.c
> +++ b/drivers/tty/serial/sifive.c
> @@ -818,6 +818,29 @@ static int __init sifive_serial_console_setup(struct console *co, char *options)
>  	return uart_set_options(&ssp->port, co, baud, parity, bits, flow);
>  }
>
> +#ifdef CONFIG_CONSOLE_POLL
> +static int sifive_serial_poll_get_char(struct uart_port *port)
> +{
> +	struct sifive_serial_port *ssp = port_to_sifive_serial_port(port);
> +	char is_empty, ch;
> +
> +	ch = __ssp_receive_char(ssp, &is_empty);
> +	if (is_empty)
> +		return NO_POLL_CHAR;
> +
> +	return ch;
> +}
> +
> +static void sifive_serial_poll_put_char(struct uart_port *port,
> +					unsigned char c)
> +{
> +	struct sifive_serial_port *ssp = port_to_sifive_serial_port(port);
> +
> +	sifive_serial_console_putchar(port, c);
> +	__ssp_wait_for_xmitr(ssp);

So we still have that TX watermark bug in the SiFive UARTs.  If this function
is supposed to wait until the word is actually out on the line then this isn't
sufficient, but if it's just supposed to wait until the next write won't block
then this is fine.

I'm not really a serial person, so mabye someone else knows?  For those
unfamiliar with the issue, there's a pretty good description in the patch to
fix it

    https://github.com/sifive/sifive-blocks/pull/90

Poking around we don't have any PRE_RATE_CHANGE hook, so I'm going to take a
whack at adding one -- not really related to this patch, though.

> +}
> +#endif /* CONFIG_CONSOLE_POLL */
> +
>  static struct uart_driver sifive_serial_uart_driver;
>
>  static struct console sifive_serial_console = {
> @@ -877,6 +900,10 @@ static const struct uart_ops sifive_serial_uops = {
>  	.request_port	= sifive_serial_request_port,
>  	.config_port	= sifive_serial_config_port,
>  	.verify_port	= sifive_serial_verify_port,
> +#ifdef CONFIG_CONSOLE_POLL
> +	.poll_get_char	= sifive_serial_poll_get_char,
> +	.poll_put_char	= sifive_serial_poll_put_char,
> +#endif
>  };
>
>  static struct uart_driver sifive_serial_uart_driver = {


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] tty: serial: Add CONSOLE_POLL support to SiFive UART
  2020-03-06 18:13   ` Palmer Dabbelt
@ 2020-03-07  8:51     ` Greg KH
  -1 siblings, 0 replies; 10+ messages in thread
From: Greg KH @ 2020-03-07  8:51 UTC (permalink / raw)
  To: Palmer Dabbelt
  Cc: vincent.chen, jslaby, Paul Walmsley, linux-serial, linux-riscv

On Fri, Mar 06, 2020 at 10:13:56AM -0800, Palmer Dabbelt wrote:
> On Tue, 03 Mar 2020 00:41:40 PST (-0800), vincent.chen@sifive.com wrote:
> > Add CONSOLE_POLL support for future KGDB porting.
> > 
> > Signed-off-by: Vincent Chen <vincent.chen@sifive.com>
> > ---
> >  drivers/tty/serial/sifive.c | 27 +++++++++++++++++++++++++++
> >  1 file changed, 27 insertions(+)
> > 
> > diff --git a/drivers/tty/serial/sifive.c b/drivers/tty/serial/sifive.c
> > index d5f81b98e4d7..acdbaca4de36 100644
> > --- a/drivers/tty/serial/sifive.c
> > +++ b/drivers/tty/serial/sifive.c
> > @@ -818,6 +818,29 @@ static int __init sifive_serial_console_setup(struct console *co, char *options)
> >  	return uart_set_options(&ssp->port, co, baud, parity, bits, flow);
> >  }
> > 
> > +#ifdef CONFIG_CONSOLE_POLL
> > +static int sifive_serial_poll_get_char(struct uart_port *port)
> > +{
> > +	struct sifive_serial_port *ssp = port_to_sifive_serial_port(port);
> > +	char is_empty, ch;
> > +
> > +	ch = __ssp_receive_char(ssp, &is_empty);
> > +	if (is_empty)
> > +		return NO_POLL_CHAR;
> > +
> > +	return ch;
> > +}
> > +
> > +static void sifive_serial_poll_put_char(struct uart_port *port,
> > +					unsigned char c)
> > +{
> > +	struct sifive_serial_port *ssp = port_to_sifive_serial_port(port);
> > +
> > +	sifive_serial_console_putchar(port, c);
> > +	__ssp_wait_for_xmitr(ssp);
> 
> So we still have that TX watermark bug in the SiFive UARTs.  If this function
> is supposed to wait until the word is actually out on the line then this isn't
> sufficient, but if it's just supposed to wait until the next write won't block
> then this is fine.
> 
> I'm not really a serial person, so mabye someone else knows?  For those
> unfamiliar with the issue, there's a pretty good description in the patch to
> fix it
> 
>    https://github.com/sifive/sifive-blocks/pull/90
> 
> Poking around we don't have any PRE_RATE_CHANGE hook, so I'm going to take a
> whack at adding one -- not really related to this patch, though.

I do have to drop this patch from my tree, as it breaks the build, so it
needs to be redone anyway :(

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] tty: serial: Add CONSOLE_POLL support to SiFive UART
@ 2020-03-07  8:51     ` Greg KH
  0 siblings, 0 replies; 10+ messages in thread
From: Greg KH @ 2020-03-07  8:51 UTC (permalink / raw)
  To: Palmer Dabbelt
  Cc: vincent.chen, linux-riscv, Paul Walmsley, linux-serial, jslaby

On Fri, Mar 06, 2020 at 10:13:56AM -0800, Palmer Dabbelt wrote:
> On Tue, 03 Mar 2020 00:41:40 PST (-0800), vincent.chen@sifive.com wrote:
> > Add CONSOLE_POLL support for future KGDB porting.
> > 
> > Signed-off-by: Vincent Chen <vincent.chen@sifive.com>
> > ---
> >  drivers/tty/serial/sifive.c | 27 +++++++++++++++++++++++++++
> >  1 file changed, 27 insertions(+)
> > 
> > diff --git a/drivers/tty/serial/sifive.c b/drivers/tty/serial/sifive.c
> > index d5f81b98e4d7..acdbaca4de36 100644
> > --- a/drivers/tty/serial/sifive.c
> > +++ b/drivers/tty/serial/sifive.c
> > @@ -818,6 +818,29 @@ static int __init sifive_serial_console_setup(struct console *co, char *options)
> >  	return uart_set_options(&ssp->port, co, baud, parity, bits, flow);
> >  }
> > 
> > +#ifdef CONFIG_CONSOLE_POLL
> > +static int sifive_serial_poll_get_char(struct uart_port *port)
> > +{
> > +	struct sifive_serial_port *ssp = port_to_sifive_serial_port(port);
> > +	char is_empty, ch;
> > +
> > +	ch = __ssp_receive_char(ssp, &is_empty);
> > +	if (is_empty)
> > +		return NO_POLL_CHAR;
> > +
> > +	return ch;
> > +}
> > +
> > +static void sifive_serial_poll_put_char(struct uart_port *port,
> > +					unsigned char c)
> > +{
> > +	struct sifive_serial_port *ssp = port_to_sifive_serial_port(port);
> > +
> > +	sifive_serial_console_putchar(port, c);
> > +	__ssp_wait_for_xmitr(ssp);
> 
> So we still have that TX watermark bug in the SiFive UARTs.  If this function
> is supposed to wait until the word is actually out on the line then this isn't
> sufficient, but if it's just supposed to wait until the next write won't block
> then this is fine.
> 
> I'm not really a serial person, so mabye someone else knows?  For those
> unfamiliar with the issue, there's a pretty good description in the patch to
> fix it
> 
>    https://github.com/sifive/sifive-blocks/pull/90
> 
> Poking around we don't have any PRE_RATE_CHANGE hook, so I'm going to take a
> whack at adding one -- not really related to this patch, though.

I do have to drop this patch from my tree, as it breaks the build, so it
needs to be redone anyway :(

thanks,

greg k-h


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] tty: serial: Add CONSOLE_POLL support to SiFive UART
  2020-03-06 18:13   ` Palmer Dabbelt
@ 2020-03-12  2:31     ` Vincent Chen
  -1 siblings, 0 replies; 10+ messages in thread
From: Vincent Chen @ 2020-03-12  2:31 UTC (permalink / raw)
  To: Palmer Dabbelt; +Cc: Greg KH, jslaby, Paul Walmsley, linux-serial, linux-riscv

On Sat, Mar 7, 2020 at 2:13 AM Palmer Dabbelt <palmer@dabbelt.com> wrote:
>
> On Tue, 03 Mar 2020 00:41:40 PST (-0800), vincent.chen@sifive.com wrote:
> > Add CONSOLE_POLL support for future KGDB porting.
> >
> > Signed-off-by: Vincent Chen <vincent.chen@sifive.com>
> > ---
> >  drivers/tty/serial/sifive.c | 27 +++++++++++++++++++++++++++
> >  1 file changed, 27 insertions(+)
> >
> > diff --git a/drivers/tty/serial/sifive.c b/drivers/tty/serial/sifive.c
> > index d5f81b98e4d7..acdbaca4de36 100644
> > --- a/drivers/tty/serial/sifive.c
> > +++ b/drivers/tty/serial/sifive.c
> > @@ -818,6 +818,29 @@ static int __init sifive_serial_console_setup(struct console *co, char *options)
> >       return uart_set_options(&ssp->port, co, baud, parity, bits, flow);
> >  }
> >
> > +#ifdef CONFIG_CONSOLE_POLL
> > +static int sifive_serial_poll_get_char(struct uart_port *port)
> > +{
> > +     struct sifive_serial_port *ssp = port_to_sifive_serial_port(port);
> > +     char is_empty, ch;
> > +
> > +     ch = __ssp_receive_char(ssp, &is_empty);
> > +     if (is_empty)
> > +             return NO_POLL_CHAR;
> > +
> > +     return ch;
> > +}
> > +
> > +static void sifive_serial_poll_put_char(struct uart_port *port,
> > +                                     unsigned char c)
> > +{
> > +     struct sifive_serial_port *ssp = port_to_sifive_serial_port(port);
> > +
> > +     sifive_serial_console_putchar(port, c);
> > +     __ssp_wait_for_xmitr(ssp);
>
> So we still have that TX watermark bug in the SiFive UARTs.  If this function
> is supposed to wait until the word is actually out on the line then this isn't
> sufficient, but if it's just supposed to wait until the next write won't block
> then this is fine.
>
> I'm not really a serial person, so mabye someone else knows?  For those
> unfamiliar with the issue, there's a pretty good description in the patch to
> fix it
>
>     https://github.com/sifive/sifive-blocks/pull/90
>
I read the description is this patch and it is very clear to
understand the issue.
Thanks for your sharing.

In this case, the __ssp_wait_for_xmitr() is used to prevent the word in the
TX FIFO buffer from being corrupted by the next write. Therefore, I
think it might
be sufficient to check thetxdata.full bit.

Thanks for your comment.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] tty: serial: Add CONSOLE_POLL support to SiFive UART
@ 2020-03-12  2:31     ` Vincent Chen
  0 siblings, 0 replies; 10+ messages in thread
From: Vincent Chen @ 2020-03-12  2:31 UTC (permalink / raw)
  To: Palmer Dabbelt; +Cc: Greg KH, linux-riscv, Paul Walmsley, linux-serial, jslaby

On Sat, Mar 7, 2020 at 2:13 AM Palmer Dabbelt <palmer@dabbelt.com> wrote:
>
> On Tue, 03 Mar 2020 00:41:40 PST (-0800), vincent.chen@sifive.com wrote:
> > Add CONSOLE_POLL support for future KGDB porting.
> >
> > Signed-off-by: Vincent Chen <vincent.chen@sifive.com>
> > ---
> >  drivers/tty/serial/sifive.c | 27 +++++++++++++++++++++++++++
> >  1 file changed, 27 insertions(+)
> >
> > diff --git a/drivers/tty/serial/sifive.c b/drivers/tty/serial/sifive.c
> > index d5f81b98e4d7..acdbaca4de36 100644
> > --- a/drivers/tty/serial/sifive.c
> > +++ b/drivers/tty/serial/sifive.c
> > @@ -818,6 +818,29 @@ static int __init sifive_serial_console_setup(struct console *co, char *options)
> >       return uart_set_options(&ssp->port, co, baud, parity, bits, flow);
> >  }
> >
> > +#ifdef CONFIG_CONSOLE_POLL
> > +static int sifive_serial_poll_get_char(struct uart_port *port)
> > +{
> > +     struct sifive_serial_port *ssp = port_to_sifive_serial_port(port);
> > +     char is_empty, ch;
> > +
> > +     ch = __ssp_receive_char(ssp, &is_empty);
> > +     if (is_empty)
> > +             return NO_POLL_CHAR;
> > +
> > +     return ch;
> > +}
> > +
> > +static void sifive_serial_poll_put_char(struct uart_port *port,
> > +                                     unsigned char c)
> > +{
> > +     struct sifive_serial_port *ssp = port_to_sifive_serial_port(port);
> > +
> > +     sifive_serial_console_putchar(port, c);
> > +     __ssp_wait_for_xmitr(ssp);
>
> So we still have that TX watermark bug in the SiFive UARTs.  If this function
> is supposed to wait until the word is actually out on the line then this isn't
> sufficient, but if it's just supposed to wait until the next write won't block
> then this is fine.
>
> I'm not really a serial person, so mabye someone else knows?  For those
> unfamiliar with the issue, there's a pretty good description in the patch to
> fix it
>
>     https://github.com/sifive/sifive-blocks/pull/90
>
I read the description is this patch and it is very clear to
understand the issue.
Thanks for your sharing.

In this case, the __ssp_wait_for_xmitr() is used to prevent the word in the
TX FIFO buffer from being corrupted by the next write. Therefore, I
think it might
be sufficient to check thetxdata.full bit.

Thanks for your comment.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] tty: serial: Add CONSOLE_POLL support to SiFive UART
  2020-03-07  8:51     ` Greg KH
@ 2020-03-12  2:36       ` Vincent Chen
  -1 siblings, 0 replies; 10+ messages in thread
From: Vincent Chen @ 2020-03-12  2:36 UTC (permalink / raw)
  To: Greg KH; +Cc: Palmer Dabbelt, jslaby, Paul Walmsley, linux-serial, linux-riscv

On Sat, Mar 7, 2020 at 4:51 PM Greg KH <gregkh@linuxfoundation.org> wrote:
>
> On Fri, Mar 06, 2020 at 10:13:56AM -0800, Palmer Dabbelt wrote:
> > On Tue, 03 Mar 2020 00:41:40 PST (-0800), vincent.chen@sifive.com wrote:
> > > Add CONSOLE_POLL support for future KGDB porting.
> > >
> > > Signed-off-by: Vincent Chen <vincent.chen@sifive.com>
> > > ---
> > >  drivers/tty/serial/sifive.c | 27 +++++++++++++++++++++++++++
> > >  1 file changed, 27 insertions(+)
> > >
> > > diff --git a/drivers/tty/serial/sifive.c b/drivers/tty/serial/sifive.c
> > > index d5f81b98e4d7..acdbaca4de36 100644
> > > --- a/drivers/tty/serial/sifive.c
> > > +++ b/drivers/tty/serial/sifive.c
> > > @@ -818,6 +818,29 @@ static int __init sifive_serial_console_setup(struct console *co, char *options)
> > >     return uart_set_options(&ssp->port, co, baud, parity, bits, flow);
> > >  }
> > >
> > > +#ifdef CONFIG_CONSOLE_POLL
> > > +static int sifive_serial_poll_get_char(struct uart_port *port)
> > > +{
> > > +   struct sifive_serial_port *ssp = port_to_sifive_serial_port(port);
> > > +   char is_empty, ch;
> > > +
> > > +   ch = __ssp_receive_char(ssp, &is_empty);
> > > +   if (is_empty)
> > > +           return NO_POLL_CHAR;
> > > +
> > > +   return ch;
> > > +}
> > > +
> > > +static void sifive_serial_poll_put_char(struct uart_port *port,
> > > +                                   unsigned char c)
> > > +{
> > > +   struct sifive_serial_port *ssp = port_to_sifive_serial_port(port);
> > > +
> > > +   sifive_serial_console_putchar(port, c);
> > > +   __ssp_wait_for_xmitr(ssp);
> >
> > So we still have that TX watermark bug in the SiFive UARTs.  If this function
> > is supposed to wait until the word is actually out on the line then this isn't
> > sufficient, but if it's just supposed to wait until the next write won't block
> > then this is fine.
> >
> > I'm not really a serial person, so mabye someone else knows?  For those
> > unfamiliar with the issue, there's a pretty good description in the patch to
> > fix it
> >
> >    https://github.com/sifive/sifive-blocks/pull/90
> >
> > Poking around we don't have any PRE_RATE_CHANGE hook, so I'm going to take a
> > whack at adding one -- not really related to this patch, though.
>
> I do have to drop this patch from my tree, as it breaks the build, so it
> needs to be redone anyway :(
>

Thanks for the test to find out my mistake.
I will fix it and resend the 2nd version patch.
Thanks

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] tty: serial: Add CONSOLE_POLL support to SiFive UART
@ 2020-03-12  2:36       ` Vincent Chen
  0 siblings, 0 replies; 10+ messages in thread
From: Vincent Chen @ 2020-03-12  2:36 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-riscv, Paul Walmsley, Palmer Dabbelt, linux-serial, jslaby

On Sat, Mar 7, 2020 at 4:51 PM Greg KH <gregkh@linuxfoundation.org> wrote:
>
> On Fri, Mar 06, 2020 at 10:13:56AM -0800, Palmer Dabbelt wrote:
> > On Tue, 03 Mar 2020 00:41:40 PST (-0800), vincent.chen@sifive.com wrote:
> > > Add CONSOLE_POLL support for future KGDB porting.
> > >
> > > Signed-off-by: Vincent Chen <vincent.chen@sifive.com>
> > > ---
> > >  drivers/tty/serial/sifive.c | 27 +++++++++++++++++++++++++++
> > >  1 file changed, 27 insertions(+)
> > >
> > > diff --git a/drivers/tty/serial/sifive.c b/drivers/tty/serial/sifive.c
> > > index d5f81b98e4d7..acdbaca4de36 100644
> > > --- a/drivers/tty/serial/sifive.c
> > > +++ b/drivers/tty/serial/sifive.c
> > > @@ -818,6 +818,29 @@ static int __init sifive_serial_console_setup(struct console *co, char *options)
> > >     return uart_set_options(&ssp->port, co, baud, parity, bits, flow);
> > >  }
> > >
> > > +#ifdef CONFIG_CONSOLE_POLL
> > > +static int sifive_serial_poll_get_char(struct uart_port *port)
> > > +{
> > > +   struct sifive_serial_port *ssp = port_to_sifive_serial_port(port);
> > > +   char is_empty, ch;
> > > +
> > > +   ch = __ssp_receive_char(ssp, &is_empty);
> > > +   if (is_empty)
> > > +           return NO_POLL_CHAR;
> > > +
> > > +   return ch;
> > > +}
> > > +
> > > +static void sifive_serial_poll_put_char(struct uart_port *port,
> > > +                                   unsigned char c)
> > > +{
> > > +   struct sifive_serial_port *ssp = port_to_sifive_serial_port(port);
> > > +
> > > +   sifive_serial_console_putchar(port, c);
> > > +   __ssp_wait_for_xmitr(ssp);
> >
> > So we still have that TX watermark bug in the SiFive UARTs.  If this function
> > is supposed to wait until the word is actually out on the line then this isn't
> > sufficient, but if it's just supposed to wait until the next write won't block
> > then this is fine.
> >
> > I'm not really a serial person, so mabye someone else knows?  For those
> > unfamiliar with the issue, there's a pretty good description in the patch to
> > fix it
> >
> >    https://github.com/sifive/sifive-blocks/pull/90
> >
> > Poking around we don't have any PRE_RATE_CHANGE hook, so I'm going to take a
> > whack at adding one -- not really related to this patch, though.
>
> I do have to drop this patch from my tree, as it breaks the build, so it
> needs to be redone anyway :(
>

Thanks for the test to find out my mistake.
I will fix it and resend the 2nd version patch.
Thanks


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-03-12  2:37 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-03  8:41 [PATCH] tty: serial: Add CONSOLE_POLL support to SiFive UART Vincent Chen
2020-03-03  8:41 ` Vincent Chen
2020-03-06 18:13 ` Palmer Dabbelt
2020-03-06 18:13   ` Palmer Dabbelt
2020-03-07  8:51   ` Greg KH
2020-03-07  8:51     ` Greg KH
2020-03-12  2:36     ` Vincent Chen
2020-03-12  2:36       ` Vincent Chen
2020-03-12  2:31   ` Vincent Chen
2020-03-12  2:31     ` Vincent Chen

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.