Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756853AbcCXIFV (ORCPT ); Thu, 24 Mar 2016 04:05:21 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:33356 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751419AbcCXIFF (ORCPT ); Thu, 24 Mar 2016 04:05:05 -0400 From: yegorslists@googlemail.com To: linux-serial@vger.kernel.org Cc: gregkh@linuxfoundation.org, peter@hurleysoftware.com, bigeasy@linutronix.de, linux-kernel@vger.kernel.org, u.kleine-koenig@pengutronix.de, Yegor Yefremov , "Matwey V. Kornilov" Subject: [PATCH v2] tty/serial/8250: fix RS485 half-duplex RX Date: Thu, 24 Mar 2016 09:03:45 +0100 Message-Id: <1458806625-29300-1-git-send-email-yegorslists@googlemail.com> X-Mailer: git-send-email 2.1.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1391 Lines: 42 From: Yegor Yefremov When in half-duplex mode RX will be disabled before TX, but not enabled after deactivating transmitter. This patch enables UART_IER_RLSI and UART_IER_RDI interrupts after TX is over. Cc: Matwey V. Kornilov Signed-off-by: Yegor Yefremov Fixes: e490c9144cfa ("tty: Add software emulated RS485 support for 8250") --- Changes: v2: change subject and add 'Fixes' tag drivers/tty/serial/8250/8250_port.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c index e213da0..00ad263 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -1403,9 +1403,18 @@ static void __do_stop_tx_rs485(struct uart_8250_port *p) /* * Empty the RX FIFO, we are not interested in anything * received during the half-duplex transmission. + * Enable previously disabled RX interrupts. */ - if (!(p->port.rs485.flags & SER_RS485_RX_DURING_TX)) + if (!(p->port.rs485.flags & SER_RS485_RX_DURING_TX)) { serial8250_clear_fifos(p); + + serial8250_rpm_get(p); + + p->ier |= UART_IER_RLSI | UART_IER_RDI; + serial_port_out(&p->port, UART_IER, p->ier); + + serial8250_rpm_put(p); + } } static void serial8250_em485_handle_stop_tx(unsigned long arg) -- 2.1.4