linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 0/1] serial: 8250_dw: Allow hardware flow control to be used
@ 2016-12-06 22:34 Jason Uy
  2016-12-06 22:34 ` [PATCH v1 1/1] " Jason Uy
  0 siblings, 1 reply; 4+ messages in thread
From: Jason Uy @ 2016-12-06 22:34 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Andy Shevchenko, Kefeng Wang, Noam Camus, Heikki Krogerus,
	Wang Hongcheng, Jason Uy, linux-serial, linux-kernel,
	bcm-kernel-feedback-list

This patchset contains changes to allow AUTOCTS to be set for the Synopsys DW UART driver.  There is currently no way to set AUTOCTS unless the platform adds a quirk entry and sets the termios callback function.  

There was a discussion about a similar proposed patch change.  It was mentioned in the discussion that the reason set_termios hook was not set by default is because someone might be using a certain type of clock that can't handle rate rounding and ended up using improper clock frequency for some baud rates.  See discussion thread here.

https://groups.google.com/forum/#!topic/fa.linux.kernel/oWrFOsw3rpQ

The current dw8250_set_termios is set such that it always call the standard serial8250_do_set_termios.  So if there are clock frequency issues, this will be resolved in serial8250_do_set_termios.

This patchset has been tested on Cygnus VOIP board bcm911360_entphn board.

This patchset is based on v4.9-rc1

repo: https://github.com/Broadcom/cygnus-linux.git

branch: cygnus-tty-v1


Jason Uy (1):
  serial: 8250_dw: Allow hardware flow control to be used

 drivers/tty/serial/8250/8250_dw.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

-- 
1.9.1

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

* [PATCH v1 1/1] serial: 8250_dw: Allow hardware flow control to be used
  2016-12-06 22:34 [PATCH v1 0/1] serial: 8250_dw: Allow hardware flow control to be used Jason Uy
@ 2016-12-06 22:34 ` Jason Uy
  2016-12-07 11:09   ` Andy Shevchenko
  2017-01-11  8:00   ` Greg Kroah-Hartman
  0 siblings, 2 replies; 4+ messages in thread
From: Jason Uy @ 2016-12-06 22:34 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Andy Shevchenko, Kefeng Wang, Noam Camus, Heikki Krogerus,
	Wang Hongcheng, Jason Uy, linux-serial, linux-kernel,
	bcm-kernel-feedback-list

In the most common use case, the Synopsys DW UART driver does not
set the set_termios callback function.  This prevents UPSTAT_AUTOCTS
from being set when the UART flag CRTSCTS is set.  As a result, the
driver will use software flow control as opposed to hardware flow
control.

To fix the problem, the set_termios callback function is set to the
DW specific function.  The logic to set UPSTAT_AUTOCTS is moved so
that any clock error will not affect setting the hardware flow
control.

Reviewed-by: Scott Branden <scott.branden@broadcom.com>
Reviewed-by: Ray Jui <ray.jui@broadcom.com>
Signed-off-by: Jason Uy <jason.uy@broadcom.com>
---
 drivers/tty/serial/8250/8250_dw.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
index 459d726..18f1f8b 100644
--- a/drivers/tty/serial/8250/8250_dw.c
+++ b/drivers/tty/serial/8250/8250_dw.c
@@ -246,11 +246,11 @@ static void dw8250_set_termios(struct uart_port *p, struct ktermios *termios,
 	if (!ret)
 		p->uartclk = rate;
 
+out:
 	p->status &= ~UPSTAT_AUTOCTS;
 	if (termios->c_cflag & CRTSCTS)
 		p->status |= UPSTAT_AUTOCTS;
 
-out:
 	serial8250_do_set_termios(p, termios, old);
 }
 
@@ -308,13 +308,11 @@ static void dw8250_quirks(struct uart_port *p, struct dw8250_data *data)
 			p->serial_in = dw8250_serial_in32;
 			data->uart_16550_compatible = true;
 		}
-		p->set_termios = dw8250_set_termios;
 	}
 
 	/* Platforms with iDMA */
 	if (platform_get_resource_byname(to_platform_device(p->dev),
 					 IORESOURCE_MEM, "lpss_priv")) {
-		p->set_termios = dw8250_set_termios;
 		data->dma.rx_param = p->dev->parent;
 		data->dma.tx_param = p->dev->parent;
 		data->dma.fn = dw8250_idma_filter;
@@ -392,6 +390,7 @@ static int dw8250_probe(struct platform_device *pdev)
 	p->iotype	= UPIO_MEM;
 	p->serial_in	= dw8250_serial_in;
 	p->serial_out	= dw8250_serial_out;
+	p->set_termios	= dw8250_set_termios;
 
 	p->membase = devm_ioremap(dev, regs->start, resource_size(regs));
 	if (!p->membase)
-- 
1.9.1

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

* Re: [PATCH v1 1/1] serial: 8250_dw: Allow hardware flow control to be used
  2016-12-06 22:34 ` [PATCH v1 1/1] " Jason Uy
@ 2016-12-07 11:09   ` Andy Shevchenko
  2017-01-11  8:00   ` Greg Kroah-Hartman
  1 sibling, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2016-12-07 11:09 UTC (permalink / raw)
  To: Jason Uy, Greg Kroah-Hartman, Jiri Slaby
  Cc: Kefeng Wang, Noam Camus, Heikki Krogerus, Wang Hongcheng,
	linux-serial, linux-kernel, bcm-kernel-feedback-list

On Tue, 2016-12-06 at 14:34 -0800, Jason Uy wrote:
> In the most common use case, the Synopsys DW UART driver does not
> set the set_termios callback function.  This prevents UPSTAT_AUTOCTS
> from being set when the UART flag CRTSCTS is set.  As a result, the
> driver will use software flow control as opposed to hardware flow
> control.
> 
> To fix the problem, the set_termios callback function is set to the
> DW specific function.  The logic to set UPSTAT_AUTOCTS is moved so
> that any clock error will not affect setting the hardware flow
> control.
> 

It should not affect Intel HW since we are using clock for it (see
drivers/mfd/intel-lpss-pci.c, drivers/acpi/acpi_lpss.c).

Thus, I'm okay with the change.

> Reviewed-by: Scott Branden <scott.branden@broadcom.com>
> Reviewed-by: Ray Jui <ray.jui@broadcom.com>
> Signed-off-by: Jason Uy <jason.uy@broadcom.com>
> ---
>  drivers/tty/serial/8250/8250_dw.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/tty/serial/8250/8250_dw.c
> b/drivers/tty/serial/8250/8250_dw.c
> index 459d726..18f1f8b 100644
> --- a/drivers/tty/serial/8250/8250_dw.c
> +++ b/drivers/tty/serial/8250/8250_dw.c
> @@ -246,11 +246,11 @@ static void dw8250_set_termios(struct uart_port
> *p, struct ktermios *termios,
>  	if (!ret)
>  		p->uartclk = rate;
>  
> +out:
>  	p->status &= ~UPSTAT_AUTOCTS;
>  	if (termios->c_cflag & CRTSCTS)
>  		p->status |= UPSTAT_AUTOCTS;
>  
> -out:
>  	serial8250_do_set_termios(p, termios, old);
>  }
>  
> @@ -308,13 +308,11 @@ static void dw8250_quirks(struct uart_port *p,
> struct dw8250_data *data)
>  			p->serial_in = dw8250_serial_in32;
>  			data->uart_16550_compatible = true;
>  		}
> -		p->set_termios = dw8250_set_termios;
>  	}
>  
>  	/* Platforms with iDMA */
>  	if (platform_get_resource_byname(to_platform_device(p->dev),
>  					 IORESOURCE_MEM,
> "lpss_priv")) {
> -		p->set_termios = dw8250_set_termios;
>  		data->dma.rx_param = p->dev->parent;
>  		data->dma.tx_param = p->dev->parent;
>  		data->dma.fn = dw8250_idma_filter;
> @@ -392,6 +390,7 @@ static int dw8250_probe(struct platform_device
> *pdev)
>  	p->iotype	= UPIO_MEM;
>  	p->serial_in	= dw8250_serial_in;
>  	p->serial_out	= dw8250_serial_out;
> +	p->set_termios	= dw8250_set_termios;
>  
>  	p->membase = devm_ioremap(dev, regs->start,
> resource_size(regs));
>  	if (!p->membase)

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

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

* Re: [PATCH v1 1/1] serial: 8250_dw: Allow hardware flow control to be used
  2016-12-06 22:34 ` [PATCH v1 1/1] " Jason Uy
  2016-12-07 11:09   ` Andy Shevchenko
@ 2017-01-11  8:00   ` Greg Kroah-Hartman
  1 sibling, 0 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-11  8:00 UTC (permalink / raw)
  To: Jason Uy
  Cc: Jiri Slaby, Andy Shevchenko, Kefeng Wang, Noam Camus,
	Heikki Krogerus, Wang Hongcheng, linux-serial, linux-kernel,
	bcm-kernel-feedback-list

On Tue, Dec 06, 2016 at 02:34:03PM -0800, Jason Uy wrote:
> In the most common use case, the Synopsys DW UART driver does not
> set the set_termios callback function.  This prevents UPSTAT_AUTOCTS
> from being set when the UART flag CRTSCTS is set.  As a result, the
> driver will use software flow control as opposed to hardware flow
> control.
> 
> To fix the problem, the set_termios callback function is set to the
> DW specific function.  The logic to set UPSTAT_AUTOCTS is moved so
> that any clock error will not affect setting the hardware flow
> control.
> 
> Reviewed-by: Scott Branden <scott.branden@broadcom.com>
> Reviewed-by: Ray Jui <ray.jui@broadcom.com>
> Signed-off-by: Jason Uy <jason.uy@broadcom.com>
> ---
>  drivers/tty/serial/8250/8250_dw.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)

This patch doesn't apply at all to the latest kernel tree.  Can you
please refresh it and resend?

thanks,

greg k-h

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

end of thread, other threads:[~2017-01-11  8:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-06 22:34 [PATCH v1 0/1] serial: 8250_dw: Allow hardware flow control to be used Jason Uy
2016-12-06 22:34 ` [PATCH v1 1/1] " Jason Uy
2016-12-07 11:09   ` Andy Shevchenko
2017-01-11  8:00   ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).