aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial/atmel_serial.c
diff options
context:
space:
mode:
authorSiftar, Gabe <Gabe.Siftar@getingeusa.com>2012-03-29 09:40:05 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-04-09 13:30:39 -0400
commit57c3686842114de3b0c00633591e9605c46fb769 (patch)
treec90d5dda0cf538951e3598cc4b9cbe160d0f440e /drivers/tty/serial/atmel_serial.c
parentacede70d6561f2d042d9dbb153d9a3469479c0ed (diff)
tty/serial: atmel_serial: fix RS485 half-duplex problem
On our custom board, we are using RS485 in half-duplex mode on an AT91SAM9G45. SER_RS485_RX_DURING_TX is not set as we do not want to receive the data we transmit (our transceiver will receive transmitted data). Although the current driver attempts to disable and enable the receiver at the appropriate points, incoming data is still loaded into the receive register causing our code to receive the very last byte that was sent once the receiver is enabled. I ran this by Atmel support and they wrote: "The issue comes from the fact that you disable the PDC/DMA Reception and not the USART Reception channel. In your case, the[n] you will still receive data into the USART_RHR register, and maybe you [h]ave the overrun flag set. So please disable the USART reception channel." The following patch should force the driver to enable/disable the receiver via RXEN/RXDIS fields of the USART control register. It fixed the issue I was having. Signed-off-by: Gabe Siftar <gabe.siftar@getingeusa.com> [nicolas.ferre@atmel.com: slightly modify commit message] Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/atmel_serial.c')
-rw-r--r--drivers/tty/serial/atmel_serial.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
index f9a6be7a9bed..3d7e1ee2fa57 100644
--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -389,6 +389,8 @@ static void atmel_start_rx(struct uart_port *port)
389{ 389{
390 UART_PUT_CR(port, ATMEL_US_RSTSTA); /* reset status and receiver */ 390 UART_PUT_CR(port, ATMEL_US_RSTSTA); /* reset status and receiver */
391 391
392 UART_PUT_CR(port, ATMEL_US_RXEN);
393
392 if (atmel_use_dma_rx(port)) { 394 if (atmel_use_dma_rx(port)) {
393 /* enable PDC controller */ 395 /* enable PDC controller */
394 UART_PUT_IER(port, ATMEL_US_ENDRX | ATMEL_US_TIMEOUT | 396 UART_PUT_IER(port, ATMEL_US_ENDRX | ATMEL_US_TIMEOUT |
@@ -404,6 +406,8 @@ static void atmel_start_rx(struct uart_port *port)
404 */ 406 */
405static void atmel_stop_rx(struct uart_port *port) 407static void atmel_stop_rx(struct uart_port *port)
406{ 408{
409 UART_PUT_CR(port, ATMEL_US_RXDIS);
410
407 if (atmel_use_dma_rx(port)) { 411 if (atmel_use_dma_rx(port)) {
408 /* disable PDC receive */ 412 /* disable PDC receive */
409 UART_PUT_PTCR(port, ATMEL_PDC_RXTDIS); 413 UART_PUT_PTCR(port, ATMEL_PDC_RXTDIS);