serial: stm32: add FIFO flush when port is closed
[ Upstream commit9f77d19207] 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:64c32eab66("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> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
01ce9c5d17
commit
566901ba50
1 changed files with 5 additions and 0 deletions
|
|
@ -689,6 +689,11 @@ static void stm32_usart_shutdown(struct uart_port *port)
|
|||
if (ret)
|
||||
dev_err(port->dev, "transmission complete not set\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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue