tty/serial: omap: empty the RX FIFO at the end of half-duplex TX
authorDimitris Lampridis <dlampridis@logikonlabs.com>
Thu, 13 Mar 2014 13:11:47 +0000 (15:11 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 17 Mar 2014 23:23:08 +0000 (16:23 -0700)
Provided that the SER_RS485_RX_DURING_TX flag is not set, empty the
RX FIFO to prevent reading back the transmitted data.

Signed-off-by: Dimitris Lampridis <dlampridis@logikonlabs.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/omap-serial.c

index 65abea2c6e470ec61fdf5bb79bc64aeeaf039ffa..dd8b1a5458ff4365c14a857a45db4cea1b20539e 100644 (file)
@@ -342,6 +342,12 @@ static void serial_omap_stop_tx(struct uart_port *port)
 
        if ((up->rs485.flags & SER_RS485_ENABLED) &&
            !(up->rs485.flags & SER_RS485_RX_DURING_TX)) {
+               /*
+                * Empty the RX FIFO, we are not interested in anything
+                * received during the half-duplex transmission.
+                */
+               serial_out(up, UART_FCR, up->fcr | UART_FCR_CLEAR_RCVR);
+               /* Re-enable RX interrupts */
                up->ier |= UART_IER_RLSI | UART_IER_RDI;
                up->port.read_status_mask |= UART_LSR_DR;
                serial_out(up, UART_IER, up->ier);