提交 f5ba5c90 编写于 作者: M Marek Vasut

serial: sh: Improve FIFO empty check on RX

If the SCIF is receiving data quickly enough, it may happen that the
SCxSR_RDxF flag is cleared in sh_serial_getc_generic(), while the
FIFO still contains data. If that happens, the serial_getc_check()
reports no data in the FIFO as the flag is no longer set. Add one
more check, if the SCxSR_RDxF is not set, read out the FIFO level
and if there are still characters in the FIFO, permit reading them
out.
Signed-off-by: NMarek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
上级 23e333a5
......@@ -116,7 +116,10 @@ static int serial_getc_check(struct uart_port *port)
handle_error(port);
if (sci_in(port, SCLSR) & SCxSR_ORER(port))
handle_error(port);
return status & (SCIF_DR | SCxSR_RDxF(port));
status &= (SCIF_DR | SCxSR_RDxF(port));
if (status)
return status;
return scif_rxfill(port);
}
static int sh_serial_getc_generic(struct uart_port *port)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册