]> git.itanic.dy.fi Git - linux-stable/commit
tty/serial: atmel: RS485 & ISO7816: wait for TXRDY before sending data
authorCodrin.Ciubotariu@microchip.com <Codrin.Ciubotariu@microchip.com>
Tue, 7 Jan 2020 11:17:47 +0000 (11:17 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 28 Sep 2022 09:04:02 +0000 (11:04 +0200)
commit85a64208b319183cf565fda94a3db427f6eb1d54
tree3fa22abce5f16afa7fb6506d12b959b47611ef74
parent9ad48cbf8b07f10c1e4a7a262b32a9179ae9dd2d
tty/serial: atmel: RS485 & ISO7816: wait for TXRDY before sending data

[ Upstream commit 477b8383100023ea0769979cff67e9be3a720397 ]

At this moment, TXEMPTY is checked before sending data on RS485 and ISO7816
modes. However, TXEMPTY is risen when FIFO (if used) or the Transmit Shift
Register are empty, even though TXRDY might be up and controller is able to
receive data. Since the controller sends data only when TXEMPTY is ready,
on RS485, when DMA is not used, the RTS pin is driven low after each byte.
With this patch, the characters will be transmitted when TXRDY is up and
so, RTS pin will remain high between bytes.
The performance improvement on RS485 is about 8% with a baudrate of 300.

Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
Acked-by: Richard Genoud <richard.genoud@gmail.com>
Link: https://lore.kernel.org/r/20200107111656.26308-1-codrin.ciubotariu@microchip.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Stable-dep-of: 692a8ebcfc24 ("tty: serial: atmel: Preserve previous USART mode if RS485 disabled")
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/tty/serial/atmel_serial.c