From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932864AbdABLNf (ORCPT ); Mon, 2 Jan 2017 06:13:35 -0500 Received: from eusmtp01.atmel.com ([212.144.249.242]:57043 "EHLO eusmtp01.atmel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751307AbdABLNd (ORCPT ); Mon, 2 Jan 2017 06:13:33 -0500 Subject: Re: [PATCH] tty/serial: atmel_serial: BUG: stop DMA from transmitting in stop_tx To: Richard Genoud , Alexandre Belloni , Greg Kroah-Hartman , Cyrille Pitchen References: <20161213162756.16139-1-richard.genoud@gmail.com> CC: , , , "beware, this won't apply before 4.3" From: Nicolas Ferre Organization: atmel Message-ID: <059a5366-c0d4-ab89-d64a-dcf007bc9e91@atmel.com> Date: Mon, 2 Jan 2017 12:13:45 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <20161213162756.16139-1-richard.genoud@gmail.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.145.133.18] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 13/12/2016 à 17:27, Richard Genoud a écrit : > If we don't disable the transmitter in atmel_stop_tx, the DMA buffer > continues to send data until it is emptied. > This cause problems with the flow control (CTS is asserted and data are > still sent). > > So, disabling the transmitter in atmel_stop_tx is a sane thing to do. > > Tested on at91sam9g35-cm(DMA) > Tested for regressions on sama5d2-xplained(Fifo) and at91sam9g20ek(PDC) > > Cc: (beware, this won't apply before 4.3) > Signed-off-by: Richard Genoud Acked-by: Nicolas Ferre > --- > drivers/tty/serial/atmel_serial.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > NB: this is not for the 4.10 merge window, I'm just sending it now to > have some comments if someone is againts it. > > diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c > index 168b10cad47b..f9d42de5ab2d 100644 > --- a/drivers/tty/serial/atmel_serial.c > +++ b/drivers/tty/serial/atmel_serial.c > @@ -481,6 +481,14 @@ static void atmel_stop_tx(struct uart_port *port) > /* disable PDC transmit */ > atmel_uart_writel(port, ATMEL_PDC_PTCR, ATMEL_PDC_TXTDIS); > } > + > + /* > + * Disable the transmitter. > + * This is mandatory when DMA is used, otherwise the DMA buffer > + * is fully transmitted. > + */ > + atmel_uart_writel(port, ATMEL_US_CR, ATMEL_US_TXDIS); > + > /* Disable interrupts */ > atmel_uart_writel(port, ATMEL_US_IDR, atmel_port->tx_done_mask); > > @@ -513,6 +521,9 @@ static void atmel_start_tx(struct uart_port *port) > > /* Enable interrupts */ > atmel_uart_writel(port, ATMEL_US_IER, atmel_port->tx_done_mask); > + > + /* re-enable the transmitter */ > + atmel_uart_writel(port, ATMEL_US_CR, ATMEL_US_TXEN); > } > > /* > -- Nicolas Ferre