From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Ferre Subject: Re: [PATCH] tty/serial: atmel: fix hardware handshake selection Date: Fri, 15 Apr 2016 14:52:10 +0200 Message-ID: <5710E3FA.6040203@atmel.com> References: <1460465500-25396-1-git-send-email-alexandre.belloni@free-electrons.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: In-Reply-To: <1460465500-25396-1-git-send-email-alexandre.belloni@free-electrons.com> Sender: linux-kernel-owner@vger.kernel.org To: Alexandre Belloni , Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Jiri Slaby , linux-serial@vger.kernel.org, Cyrille Pitchen List-Id: linux-serial@vger.kernel.org Le 12/04/2016 14:51, Alexandre Belloni a =E9crit : > Commit 1cf6e8fc8341 ("tty/serial: at91: fix RTS line management when > hardware handshake is enabled") actually allowed to enable hardware > handshaking. > Before, the CRTSCTS flags was silently ignored. >=20 > As the DMA controller can't drive RTS (as explain in the commit messa= ge). > Ensure that hardware flow control stays disabled when DMA is used and= FIFOs > are not available. >=20 > Signed-off-by: Alexandre Belloni Yes, I agree with the fix: Acked-by: Nicolas Ferre We can also add the following tags: =46ixes: 1cf6e8fc8341 ("tty/serial: at91: fix RTS line management when hardware handshake is enabled") Cc: stable # v4.0+ Bye, > --- > drivers/tty/serial/atmel_serial.c | 14 +++++++++++++- > 1 file changed, 13 insertions(+), 1 deletion(-) >=20 > diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/a= tmel_serial.c > index d9439e6ab719..954941dd8124 100644 > --- a/drivers/tty/serial/atmel_serial.c > +++ b/drivers/tty/serial/atmel_serial.c > @@ -274,6 +274,13 @@ static bool atmel_use_dma_rx(struct uart_port *p= ort) > return atmel_port->use_dma_rx; > } > =20 > +static bool atmel_use_fifo(struct uart_port *port) > +{ > + struct atmel_uart_port *atmel_port =3D to_atmel_uart_port(port); > + > + return atmel_port->fifo_size; > +} > + > static unsigned int atmel_get_lines_status(struct uart_port *port) > { > struct atmel_uart_port *atmel_port =3D to_atmel_uart_port(port); > @@ -2090,7 +2097,12 @@ static void atmel_set_termios(struct uart_port= *port, struct ktermios *termios, > mode |=3D ATMEL_US_USMODE_RS485; > } else if (termios->c_cflag & CRTSCTS) { > /* RS232 with hardware handshake (RTS/CTS) */ > - mode |=3D ATMEL_US_USMODE_HWHS; > + if (atmel_use_dma_rx(port) && !atmel_use_fifo(port)) { > + dev_info(port->dev, "not enabling hardware flow control because D= MA is used"); > + termios->c_cflag &=3D ~CRTSCTS; > + } else { > + mode |=3D ATMEL_US_USMODE_HWHS; > + } > } else { > /* RS232 without hadware handshake */ > mode |=3D ATMEL_US_USMODE_NORMAL; >=20 --=20 Nicolas Ferre From mboxrd@z Thu Jan 1 00:00:00 1970 From: nicolas.ferre@atmel.com (Nicolas Ferre) Date: Fri, 15 Apr 2016 14:52:10 +0200 Subject: [PATCH] tty/serial: atmel: fix hardware handshake selection In-Reply-To: <1460465500-25396-1-git-send-email-alexandre.belloni@free-electrons.com> References: <1460465500-25396-1-git-send-email-alexandre.belloni@free-electrons.com> Message-ID: <5710E3FA.6040203@atmel.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org Le 12/04/2016 14:51, Alexandre Belloni a ?crit : > Commit 1cf6e8fc8341 ("tty/serial: at91: fix RTS line management when > hardware handshake is enabled") actually allowed to enable hardware > handshaking. > Before, the CRTSCTS flags was silently ignored. > > As the DMA controller can't drive RTS (as explain in the commit message). > Ensure that hardware flow control stays disabled when DMA is used and FIFOs > are not available. > > Signed-off-by: Alexandre Belloni Yes, I agree with the fix: Acked-by: Nicolas Ferre We can also add the following tags: Fixes: 1cf6e8fc8341 ("tty/serial: at91: fix RTS line management when hardware handshake is enabled") Cc: stable # v4.0+ Bye, > --- > drivers/tty/serial/atmel_serial.c | 14 +++++++++++++- > 1 file changed, 13 insertions(+), 1 deletion(-) > > diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c > index d9439e6ab719..954941dd8124 100644 > --- a/drivers/tty/serial/atmel_serial.c > +++ b/drivers/tty/serial/atmel_serial.c > @@ -274,6 +274,13 @@ static bool atmel_use_dma_rx(struct uart_port *port) > return atmel_port->use_dma_rx; > } > > +static bool atmel_use_fifo(struct uart_port *port) > +{ > + struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); > + > + return atmel_port->fifo_size; > +} > + > static unsigned int atmel_get_lines_status(struct uart_port *port) > { > struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); > @@ -2090,7 +2097,12 @@ static void atmel_set_termios(struct uart_port *port, struct ktermios *termios, > mode |= ATMEL_US_USMODE_RS485; > } else if (termios->c_cflag & CRTSCTS) { > /* RS232 with hardware handshake (RTS/CTS) */ > - mode |= ATMEL_US_USMODE_HWHS; > + if (atmel_use_dma_rx(port) && !atmel_use_fifo(port)) { > + dev_info(port->dev, "not enabling hardware flow control because DMA is used"); > + termios->c_cflag &= ~CRTSCTS; > + } else { > + mode |= ATMEL_US_USMODE_HWHS; > + } > } else { > /* RS232 without hadware handshake */ > mode |= ATMEL_US_USMODE_NORMAL; > -- Nicolas Ferre From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751222AbcDOMv7 (ORCPT ); Fri, 15 Apr 2016 08:51:59 -0400 Received: from eusmtp01.atmel.com ([212.144.249.243]:42422 "EHLO eusmtp01.atmel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750820AbcDOMv5 (ORCPT ); Fri, 15 Apr 2016 08:51:57 -0400 Subject: Re: [PATCH] tty/serial: atmel: fix hardware handshake selection To: Alexandre Belloni , "Greg Kroah-Hartman" References: <1460465500-25396-1-git-send-email-alexandre.belloni@free-electrons.com> CC: , , Jiri Slaby , , Cyrille Pitchen From: Nicolas Ferre Organization: atmel Message-ID: <5710E3FA.6040203@atmel.com> Date: Fri, 15 Apr 2016 14:52:10 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <1460465500-25396-1-git-send-email-alexandre.belloni@free-electrons.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.161.30.18] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 12/04/2016 14:51, Alexandre Belloni a écrit : > Commit 1cf6e8fc8341 ("tty/serial: at91: fix RTS line management when > hardware handshake is enabled") actually allowed to enable hardware > handshaking. > Before, the CRTSCTS flags was silently ignored. > > As the DMA controller can't drive RTS (as explain in the commit message). > Ensure that hardware flow control stays disabled when DMA is used and FIFOs > are not available. > > Signed-off-by: Alexandre Belloni Yes, I agree with the fix: Acked-by: Nicolas Ferre We can also add the following tags: Fixes: 1cf6e8fc8341 ("tty/serial: at91: fix RTS line management when hardware handshake is enabled") Cc: stable # v4.0+ Bye, > --- > drivers/tty/serial/atmel_serial.c | 14 +++++++++++++- > 1 file changed, 13 insertions(+), 1 deletion(-) > > diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c > index d9439e6ab719..954941dd8124 100644 > --- a/drivers/tty/serial/atmel_serial.c > +++ b/drivers/tty/serial/atmel_serial.c > @@ -274,6 +274,13 @@ static bool atmel_use_dma_rx(struct uart_port *port) > return atmel_port->use_dma_rx; > } > > +static bool atmel_use_fifo(struct uart_port *port) > +{ > + struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); > + > + return atmel_port->fifo_size; > +} > + > static unsigned int atmel_get_lines_status(struct uart_port *port) > { > struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); > @@ -2090,7 +2097,12 @@ static void atmel_set_termios(struct uart_port *port, struct ktermios *termios, > mode |= ATMEL_US_USMODE_RS485; > } else if (termios->c_cflag & CRTSCTS) { > /* RS232 with hardware handshake (RTS/CTS) */ > - mode |= ATMEL_US_USMODE_HWHS; > + if (atmel_use_dma_rx(port) && !atmel_use_fifo(port)) { > + dev_info(port->dev, "not enabling hardware flow control because DMA is used"); > + termios->c_cflag &= ~CRTSCTS; > + } else { > + mode |= ATMEL_US_USMODE_HWHS; > + } > } else { > /* RS232 without hadware handshake */ > mode |= ATMEL_US_USMODE_NORMAL; > -- Nicolas Ferre