summaryrefslogtreecommitdiffstats
path: root/drivers/tty
diff options
context:
space:
mode:
authorAlexandre Belloni <alexandre.belloni@free-electrons.com>2016-05-28 00:54:08 +0200
committerBen Hutchings <ben@decadent.org.uk>2016-11-20 01:16:42 +0000
commit1d1891b424f02e68c2115092cbd3bad6b2af4fe6 (patch)
treefef040a2d6f64e895d4b2da9c5a1647748315e13 /drivers/tty
parentc00c077d747e4ef053a8e877f061953380c4fe8a (diff)
downloadlinux-stable-1d1891b424f02e68c2115092cbd3bad6b2af4fe6.tar.gz
linux-stable-1d1891b424f02e68c2115092cbd3bad6b2af4fe6.tar.bz2
linux-stable-1d1891b424f02e68c2115092cbd3bad6b2af4fe6.zip
tty/serial: atmel: fix RS485 half duplex with DMA
commit 0058f0871efe7b01c6f2b3046c68196ab73e96da upstream. 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 <alexandre.belloni@free-electrons.com> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> [bwh: Backported to 3.16: - Adjust context - Keep using UART_GET_PTSR()] Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/serial/atmel_serial.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
index 0d39ae4ff533..d806657ca53e 100644
--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -434,19 +434,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 (UART_GET_PTSR(port) & ATMEL_PDC_TXTEN)
- /* The transmitter is already running. Yes, we
- really need this.*/
- return;
+ if (atmel_use_pdc_tx(port) && (UART_GET_PTSR(port)
+ & 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 ((atmel_port->rs485.flags & SER_RS485_ENABLED) &&
!(atmel_port->rs485.flags & SER_RS485_RX_DURING_TX))
atmel_stop_rx(port);
+ if (atmel_use_pdc_tx(port))
/* re-enable PDC transmit */
UART_PUT_PTCR(port, ATMEL_PDC_TXTEN);
- }
+
/* Enable interrupts */
UART_PUT_IER(port, atmel_port->tx_done_mask);
}