tty: serial: fsl_lpuart: correct the count of break characters

[ Upstream commit 707f816f25 ]

The LPUART can't distinguish between a break signal and a framing error,
so need to count the break characters if there is a framing error and
received data is zero instead of the parity error.

Fixes: 5541a9bacf ("serial: fsl_lpuart: handle break and make sysrq work")
Reviewed-by: Michael Walle <michael@walle.cc>
Signed-off-by: Sherry Sun <sherry.sun@nxp.com>
Link: https://lore.kernel.org/r/20220725050115.12396-1-sherry.sun@nxp.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Sherry Sun 2022-07-25 13:01:15 +08:00 committed by Greg Kroah-Hartman
parent b6fe0365f1
commit c139aa934b

View file

@ -990,12 +990,12 @@ static void lpuart32_rxint(struct lpuart_port *sport)
if (sr & (UARTSTAT_PE | UARTSTAT_OR | UARTSTAT_FE)) { if (sr & (UARTSTAT_PE | UARTSTAT_OR | UARTSTAT_FE)) {
if (sr & UARTSTAT_PE) { if (sr & UARTSTAT_PE) {
sport->port.icount.parity++;
} else if (sr & UARTSTAT_FE) {
if (is_break) if (is_break)
sport->port.icount.brk++; sport->port.icount.brk++;
else else
sport->port.icount.parity++; sport->port.icount.frame++;
} else if (sr & UARTSTAT_FE) {
sport->port.icount.frame++;
} }
if (sr & UARTSTAT_OR) if (sr & UARTSTAT_OR)
@ -1010,12 +1010,12 @@ static void lpuart32_rxint(struct lpuart_port *sport)
sr &= sport->port.read_status_mask; sr &= sport->port.read_status_mask;
if (sr & UARTSTAT_PE) { if (sr & UARTSTAT_PE) {
flg = TTY_PARITY;
} else if (sr & UARTSTAT_FE) {
if (is_break) if (is_break)
flg = TTY_BREAK; flg = TTY_BREAK;
else else
flg = TTY_PARITY; flg = TTY_FRAME;
} else if (sr & UARTSTAT_FE) {
flg = TTY_FRAME;
} }
if (sr & UARTSTAT_OR) if (sr & UARTSTAT_OR)