diff options
author | Erwan Le Ray <erwan.leray@foss.st.com> | 2021-03-04 17:23:06 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-03-10 09:34:11 +0100 |
commit | 9f77d19207a0e8ba814c8ceb22e90ce7cb2aef64 (patch) | |
tree | d2515a7d0aff02332181d872b6db1284637c0b24 /drivers/tty/serial/stm32-usart.c | |
parent | 315e2d8a125ad77a1bc28f621162713f3e7aef48 (diff) | |
download | linux-stable-9f77d19207a0e8ba814c8ceb22e90ce7cb2aef64.tar.gz linux-stable-9f77d19207a0e8ba814c8ceb22e90ce7cb2aef64.tar.bz2 linux-stable-9f77d19207a0e8ba814c8ceb22e90ce7cb2aef64.zip |
serial: stm32: add FIFO flush when port is closed
Transmission complete error is sent when ISR_TC is not set. If port closure
is requested despite data in TDR / TX FIFO has not been sent (because of
flow control), ISR_TC is not set and error message is sent on port closure
but also when a new port is opened.
Flush the data when port is closed, so the error isn't printed twice upon
next port opening.
Fixes: 64c32eab6603 ("serial: stm32: Add support of TC bit status check")
Signed-off-by: Erwan Le Ray <erwan.leray@foss.st.com>
Link: https://lore.kernel.org/r/20210304162308.8984-12-erwan.leray@foss.st.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/stm32-usart.c')
-rw-r--r-- | drivers/tty/serial/stm32-usart.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/tty/serial/stm32-usart.c b/drivers/tty/serial/stm32-usart.c index 183c76ddb165..d205fce1950a 100644 --- a/drivers/tty/serial/stm32-usart.c +++ b/drivers/tty/serial/stm32-usart.c @@ -691,6 +691,11 @@ static void stm32_usart_shutdown(struct uart_port *port) if (ret) dev_err(port->dev, "Transmission is not complete\n"); + /* flush RX & TX FIFO */ + if (ofs->rqr != UNDEF_REG) + writel_relaxed(USART_RQR_TXFRQ | USART_RQR_RXFRQ, + port->membase + ofs->rqr); + stm32_usart_clr_bits(port, ofs->cr1, val); free_irq(port->irq, port); |