Commit 1d1891b4 authored by Alexandre Belloni's avatar Alexandre Belloni Committed by Ben Hutchings

tty/serial: atmel: fix RS485 half duplex with DMA

commit 0058f087 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: default avatarAlexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: default avatarNicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
[bwh: Backported to 3.16:
 - Adjust context
 - Keep using UART_GET_PTSR()]
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent c00c077d
...@@ -434,19 +434,21 @@ static void atmel_start_tx(struct uart_port *port) ...@@ -434,19 +434,21 @@ static void atmel_start_tx(struct uart_port *port)
{ {
struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
if (atmel_use_pdc_tx(port)) { if (atmel_use_pdc_tx(port) && (UART_GET_PTSR(port)
if (UART_GET_PTSR(port) & ATMEL_PDC_TXTEN) & ATMEL_PDC_TXTEN))
/* The transmitter is already running. Yes, we /* The transmitter is already running. Yes, we
really need this.*/ really need this.*/
return; return;
if (atmel_use_pdc_tx(port) || atmel_use_dma_tx(port))
if ((atmel_port->rs485.flags & SER_RS485_ENABLED) && if ((atmel_port->rs485.flags & SER_RS485_ENABLED) &&
!(atmel_port->rs485.flags & SER_RS485_RX_DURING_TX)) !(atmel_port->rs485.flags & SER_RS485_RX_DURING_TX))
atmel_stop_rx(port); atmel_stop_rx(port);
if (atmel_use_pdc_tx(port))
/* re-enable PDC transmit */ /* re-enable PDC transmit */
UART_PUT_PTCR(port, ATMEL_PDC_TXTEN); UART_PUT_PTCR(port, ATMEL_PDC_TXTEN);
}
/* Enable interrupts */ /* Enable interrupts */
UART_PUT_IER(port, atmel_port->tx_done_mask); UART_PUT_IER(port, atmel_port->tx_done_mask);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment