serial: stm32: fix clearing interrupt error flags
The interrupt clear flag register is a "write 1 to clear" register.
So, only writing ones allows to clear flags:
- Replace buggy stm32_clr_bits() by a simple write to clear error flags
- Replace useless read/modify/write stm32_set_bits() routine by a
simple write to clear TC (transfer complete) flag.
Fixes: 4f01d833fd ("serial: stm32: fix rx error handling")
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/1574323849-1909-1-git-send-email-fabrice.gasnier@st.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
da88ac0bd6
commit
1250ed7114
|
|
@ -240,8 +240,8 @@ static void stm32_receive_chars(struct uart_port *port, bool threaded)
|
||||||
* cleared by the sequence [read SR - read DR].
|
* cleared by the sequence [read SR - read DR].
|
||||||
*/
|
*/
|
||||||
if ((sr & USART_SR_ERR_MASK) && ofs->icr != UNDEF_REG)
|
if ((sr & USART_SR_ERR_MASK) && ofs->icr != UNDEF_REG)
|
||||||
stm32_clr_bits(port, ofs->icr, USART_ICR_ORECF |
|
writel_relaxed(sr & USART_SR_ERR_MASK,
|
||||||
USART_ICR_PECF | USART_ICR_FECF);
|
port->membase + ofs->icr);
|
||||||
|
|
||||||
c = stm32_get_char(port, &sr, &stm32_port->last_res);
|
c = stm32_get_char(port, &sr, &stm32_port->last_res);
|
||||||
port->icount.rx++;
|
port->icount.rx++;
|
||||||
|
|
@ -435,7 +435,7 @@ static void stm32_transmit_chars(struct uart_port *port)
|
||||||
if (ofs->icr == UNDEF_REG)
|
if (ofs->icr == UNDEF_REG)
|
||||||
stm32_clr_bits(port, ofs->isr, USART_SR_TC);
|
stm32_clr_bits(port, ofs->isr, USART_SR_TC);
|
||||||
else
|
else
|
||||||
stm32_set_bits(port, ofs->icr, USART_ICR_TCCF);
|
writel_relaxed(USART_ICR_TCCF, port->membase + ofs->icr);
|
||||||
|
|
||||||
if (stm32_port->tx_ch)
|
if (stm32_port->tx_ch)
|
||||||
stm32_transmit_chars_dma(port);
|
stm32_transmit_chars_dma(port);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue