]> git.baikalelectronics.ru Git - kernel.git/commit
Clearing FIFOs in RS485 emulation mode causes subsequent transmits to break
authorDaniel Jedrychowski <avistel@gmail.com>
Sun, 11 Dec 2016 22:18:28 +0000 (09:18 +1100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 11 Jan 2017 07:35:17 +0000 (08:35 +0100)
commit96622b89cc01db9b27703eba26534695d6899889
treebef2d20e174c126ea18ad33cb4f7c0a9790b08a2
parentd778fd82d84d1fd49bf9b8d3e5a69b143bd7fb1a
Clearing FIFOs in RS485 emulation mode causes subsequent transmits to break

When in RS485 emulation mode, __do_stop_tx_rs485() calls
serial8250_clear_fifos().  This not only clears the FIFOs, but also sets
all bits in their control register (UART_FCR) to 0.

One of the effects of this is the disabling of the FIFOs, which turns
them into single-byte holding registers.  The rest of the driver doesn't
know this, which results in the lions share of characters passed into a
write call to be dropped.

(I can supply logic analyzer screenshots if necessary)

This fix replaces the serial8250_clear_fifos() call to
serial8250_clear_and_reinit_fifos() - this prevents the "dropped
characters" issue from manifesting again while retaining the requirement
of clearing the RX FIFO after transmission if the SER_RS485_RX_DURING_TX
flag is disabled.

Signed-off-by: Daniel Jedrychowski <avistel@gmail.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/8250/8250_port.c