From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965310AbcFMJvs (ORCPT ); Mon, 13 Jun 2016 05:51:48 -0400 Received: from eusmtp01.atmel.com ([212.144.249.242]:31589 "EHLO eusmtp01.atmel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964824AbcFMJvq (ORCPT ); Mon, 13 Jun 2016 05:51:46 -0400 From: Nicolas Ferre Subject: Re: [PATCH] tty/serial: atmel: fix RS485 half duplex with DMA To: Greg Kroah-Hartman , References: <1464389648-4820-1-git-send-email-alexandre.belloni@free-electrons.com> <57500D60.2000900@atmel.com> CC: Alexandre Belloni , , Organization: atmel Message-ID: <575E822F.7050501@atmel.com> Date: Mon, 13 Jun 2016 11:51:43 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 MIME-Version: 1.0 In-Reply-To: <57500D60.2000900@atmel.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 02/06/2016 12:41, Nicolas Ferre a écrit : > Le 28/05/2016 00:54, Alexandre Belloni a écrit : >> When using DMA, half duplex doesn't work properly because rx is not stopped >> before starting tx. Ensure we call atmel_stop_rx() in the DMA case. >> >> Signed-off-by: Alexandre Belloni > > Acked-by: Nicolas Ferre > > We can also add: > Cc: # v4.3+ > > > Thanks Alexandre! Greg, It's not a regression but a good fix for this rs485 mode. So I suspect it can still be queued for 4.7-rc... (aka: gentle ping). Bye, >> --- >> drivers/tty/serial/atmel_serial.c | 14 ++++++++------ >> 1 file changed, 8 insertions(+), 6 deletions(-) >> >> diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c >> index 954941dd8124..f9c798cba83f 100644 >> --- a/drivers/tty/serial/atmel_serial.c >> +++ b/drivers/tty/serial/atmel_serial.c >> @@ -482,19 +482,21 @@ static void atmel_start_tx(struct uart_port *port) >> { >> struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); >> >> - if (atmel_use_pdc_tx(port)) { >> - if (atmel_uart_readl(port, ATMEL_PDC_PTSR) & ATMEL_PDC_TXTEN) >> - /* The transmitter is already running. Yes, we >> - really need this.*/ >> - return; >> + if (atmel_use_pdc_tx(port) && (atmel_uart_readl(port, ATMEL_PDC_PTSR) >> + & ATMEL_PDC_TXTEN)) >> + /* The transmitter is already running. Yes, we >> + really need this.*/ >> + return; >> >> + if (atmel_use_pdc_tx(port) || atmel_use_dma_tx(port)) >> if ((port->rs485.flags & SER_RS485_ENABLED) && >> !(port->rs485.flags & SER_RS485_RX_DURING_TX)) >> atmel_stop_rx(port); >> >> + if (atmel_use_pdc_tx(port)) >> /* re-enable PDC transmit */ >> atmel_uart_writel(port, ATMEL_PDC_PTCR, ATMEL_PDC_TXTEN); >> - } >> + >> /* Enable interrupts */ >> atmel_uart_writel(port, ATMEL_US_IER, atmel_port->tx_done_mask); >> } >> > > -- Nicolas Ferre