tty/serial: atmel: fix RS485 half duplex with DMA
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> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
637ba54f60
commit
0058f0871e
1 changed files with 8 additions and 6 deletions
|
@ -487,19 +487,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) && (atmel_uart_readl(port, ATMEL_PDC_PTSR)
|
||||||
if (atmel_uart_readl(port, ATMEL_PDC_PTSR) & 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 ((port->rs485.flags & SER_RS485_ENABLED) &&
|
if ((port->rs485.flags & SER_RS485_ENABLED) &&
|
||||||
!(port->rs485.flags & SER_RS485_RX_DURING_TX))
|
!(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 */
|
||||||
atmel_uart_writel(port, ATMEL_PDC_PTCR, ATMEL_PDC_TXTEN);
|
atmel_uart_writel(port, ATMEL_PDC_PTCR, ATMEL_PDC_TXTEN);
|
||||||
}
|
|
||||||
/* Enable interrupts */
|
/* Enable interrupts */
|
||||||
atmel_uart_writel(port, ATMEL_US_IER, atmel_port->tx_done_mask);
|
atmel_uart_writel(port, ATMEL_US_IER, atmel_port->tx_done_mask);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue