Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760126AbcJ1MLj (ORCPT ); Fri, 28 Oct 2016 08:11:39 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:57246 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756570AbcJ1MLg (ORCPT ); Fri, 28 Oct 2016 08:11:36 -0400 Date: Fri, 28 Oct 2016 08:11:44 -0400 From: Greg Kroah-Hartman To: Richard Genoud Cc: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= , Alexandre Belloni , Nicolas Ferre , "linux-kernel@vger.kernel.org" , "#4 . 4+" , "linux-serial@vger.kernel.org" , Cyrille Pitchen , "linux-arm-kernel@lists.infradead.org" Subject: Re: [PATCH v6] tty/serial: at91: fix hardware handshake on Atmel platforms Message-ID: <20161028121144.GA3948@kroah.com> References: <20161027160406.25738-1-richard.genoud@gmail.com> <20161027180229.5faqrvxa2a4pos7i@pengutronix.de> <20161027231331.gngekbg22wfvnolr@piout.net> <20161028095151.f24lhelfknzrpy6c@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.7.1 (2016-10-04) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3553 Lines: 74 On Fri, Oct 28, 2016 at 12:56:09PM +0200, Richard Genoud wrote: > 2016-10-28 11:51 GMT+02:00 Uwe Kleine-K?nig : > > On Fri, Oct 28, 2016 at 01:13:31AM +0200, Alexandre Belloni wrote: > >> On 27/10/2016 at 20:02:29 +0200, Uwe Kleine-K?nig wrote : > >> > Hello Richard, > >> > > >> > On Thu, Oct 27, 2016 at 06:04:06PM +0200, Richard Genoud wrote: > >> > > diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c > >> > > index fd8aa1f4ba78..168b10cad47b 100644 > >> > > --- a/drivers/tty/serial/atmel_serial.c > >> > > +++ b/drivers/tty/serial/atmel_serial.c > >> > > @@ -2132,11 +2132,29 @@ 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) */ > >> > > - 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 { > >> > > + if (atmel_use_fifo(port) && > >> > > + !mctrl_gpio_to_gpiod(atmel_port->gpios, UART_GPIO_CTS)) { > >> > > + /* > >> > > + * with ATMEL_US_USMODE_HWHS set, the controller will > >> > > + * be able to drive the RTS pin high/low when the RX > >> > > + * FIFO is above RXFTHRES/below RXFTHRES2. > >> > > + * It will also disable the transmitter when the CTS > >> > > + * pin is high. > >> > > + * This mode is not activated if CTS pin is a GPIO > >> > > + * because in this case, the transmitter is always > >> > > + * disabled (there must be an internal pull-up > >> > > + * responsible for this behaviour). > >> > > + * If the RTS pin is a GPIO, the controller won't be > >> > > + * able to drive it according to the FIFO thresholds, > >> > > + * but it will be handled by the driver. > >> > > + */ > >> > > mode |= ATMEL_US_USMODE_HWHS; > >> > > >> > You use > >> > > >> > !mctrl_gpio_to_gpiod(atmel_port->gpios, UART_GPIO_CTS) > >> > > >> > as indicator that the cts mode of the respective pin is used. Is this > >> > reliable? (It's not if there are machines that don't use CTS, neither as > >> > gpio nor using the hardware function.) Maybe this needs a dt property to > >> > indicate that there is no (hw)handshaking available? > >> > > >> > >> We had a call today were we agreed that this should be added in a future > >> patch. Let's fix the regression for now. > > > > A machine without CTS (neither gpio nor hw function) used to work fine > > before the breaking commit, right? So this case is part of the > > regression and needs a fix? > Actually, a machine with a FIFO and without CTS didn't even exist at the > time of the breaking commit (v4.0), the FIFO handling was introduced later, > so it's not even a regression ! > > > Anyhow, this probably shouldn't stop the commit entering mainline > > because there are probably very few such machines (if any). > > > > So: > > Acked-by: Uwe Kleine-K?nig > > > > Best regards > > Uwe > > > Thanks ! > > Greg, could you take this in your tree ? Now applied, thanks for working through all of this. greg k-h