]> git.baikalelectronics.ru Git - kernel.git/commit
tty/serial: atmel: RS485 half duplex w/DMA: enable RX after TX is done
authorRichard Genoud <richard.genoud@gmail.com>
Tue, 6 Dec 2016 12:05:33 +0000 (13:05 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 11 Jan 2017 07:18:45 +0000 (08:18 +0100)
commit2175a4014c4d021e368a13438f20753f08840090
treed702ef5021258fc6894bec24dcb2e68a06a3c0a5
parent17d2dff4057f897aaaade4f0b4e163cc190492cc
tty/serial: atmel: RS485 half duplex w/DMA: enable RX after TX is done

When using RS485 in half duplex, RX should be enabled when TX is
finished, and stopped when TX starts.

Before commit 1bd6a266188ec4dfc4 ("tty/serial: atmel: fix RS485 half
duplex with DMA"), RX was not disabled in atmel_start_tx() if the DMA
was used. So, collisions could happened.

But disabling RX in atmel_start_tx() uncovered another bug:
RX was enabled again in the wrong place (in atmel_tx_dma) instead of
being enabled when TX is finished (in atmel_complete_tx_dma), so the
transmission simply stopped.

This bug was not triggered before commit 1bd6a266188ec4dfc4
("tty/serial: atmel: fix RS485 half duplex with DMA") because RX was
never disabled before.

Moving atmel_start_rx() in atmel_complete_tx_dma() corrects the problem.

Cc: stable@vger.kernel.org
Reported-by: Gil Weber <webergil@gmail.com>
Fixes: 1bd6a266188ec4dfc4
Tested-by: Gil Weber <webergil@gmail.com>
Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/atmel_serial.c