drivers: serial: uart_sam0: fix |= incorrectly clearing all INTFLAGS.

fix uart_sam0_irq_update to only clear the RXS bit by writing only the
RXS bitflag to the INTFLAG register. Performing an |= opperation
with the bitflag for RXS incorrectly clears all pending interrupts set
since writing 1 to a INTFLAG clears that bit field. This causes a race
condition on when TXC will be cleared before all bytes have finished
being clocked out on tx and TXC being set 1 again. If tx finishes first,
any driver using uart_irq_tx_complete will deadlock the system.

Signed-off-by: Ron Smith <rockyowl171@gmail.com>
This commit is contained in:
Ron Smith 2021-09-03 21:15:00 -04:00 committed by Anas Nashif
parent 847b3205d6
commit 863fef4a54

View file

@ -889,7 +889,7 @@ static int uart_sam0_irq_update(const struct device *dev)
| SERCOM_USART_INTENCLR_CTSIC
| SERCOM_USART_INTENCLR_RXS;
#else
regs->INTFLAG.reg |= SERCOM_USART_INTENCLR_RXS;
regs->INTFLAG.reg = SERCOM_USART_INTENCLR_RXS;
#endif
return 1;
}