[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190319132035.18481-1-razvan.stefanescu@microchip.com>
Date: Tue, 19 Mar 2019 15:20:33 +0200
From: Razvan Stefanescu <razvan.stefanescu@...rochip.com>
To: Richard Genoud <richard.genoud@...il.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jiri Slaby <jslaby@...e.com>
CC: Gil Weber <webergil@...il.com>,
Nicolas Ferre <nicolas.ferre@...rochip.com>,
Alexandre Belloni <alexandre.belloni@...tlin.com>,
Ludovic Desroches <ludovic.desroches@...rochip.com>,
<linux-serial@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>
Subject: [PATCH v2 0/2] tty/serial: atmel: Fix RS485 half duplex operation
Using a loopback serial cable with RS485 protocol shows that data is
received:
$ stty -F /dev/ttyS3 raw -echo speed 4800
$ cat /dev/ttyS3 &
$ echo "Hello, world" > /dev/ttyS3
Hello, world
Last line should not be displayed, as it indicates that RX was started
before TX finished.
This happens because driver activates RX when the DMA transfer
completes, but that does not necessarily mean the TX FIFO was emptied.
First patch will add a helper that checks if the transmission is
half-duplex and uses it throughout the driver, replacing multiple lines
of code.
Second patch implements the fix by adding a variable to the port struct.
This is used to indicate that RX needs to be started. When the DMA
transfer completes, the variable is set and the ATMEL_US_TXEMPTY is
reactivated. In the interrupt handler, if the variable is set, RX is
started.
Changelog:
v1 -> v2:
- remove wrongly added check;
- start rx and display warning message in case of error
- add fix info
Razvan Stefanescu (2):
tty/serial: atmel: Add is_half_duplex helper
tty/serial: atmel: RS485 HD w/DMA: enable RX after TX is stopped
drivers/tty/serial/atmel_serial.c | 48 +++++++++++++++++++++----------
1 file changed, 33 insertions(+), 15 deletions(-)
--
2.19.1
Powered by blists - more mailing lists