Skip to content

Commit

Permalink
serial: sh-sci: Fix too early port disabling.
Browse files Browse the repository at this point in the history
Currently serial ports on SH CPUs get disabled too early, because the
sci_tx_empty() routine claims to not be able to detect whether the
transmission has been completed and just always returns TIOCSER_TEMT. This
results in corrupt output of last characters if the port is not open for
reading at the same time. It is however possible to detect whether
transmission has been completed. Use the TEND bit of the status register
for this.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
  • Loading branch information
Guennadi Liakhovetski authored and Paul Mundt committed Dec 4, 2009
1 parent fd2cb0c commit b151680
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/serial/sh-sci.c
Original file line number Diff line number Diff line change
Expand Up @@ -799,8 +799,8 @@ static void sci_free_irq(struct sci_port *port)

static unsigned int sci_tx_empty(struct uart_port *port)
{
/* Can't detect */
return TIOCSER_TEMT;
unsigned short status = sci_in(port, SCxSR);
return status & SCxSR_TEND(port) ? TIOCSER_TEMT : 0;
}

static void sci_set_mctrl(struct uart_port *port, unsigned int mctrl)
Expand Down

0 comments on commit b151680

Please sign in to comment.