public inbox for linux-sh@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix too early disabling of the serial (SCI(F)) ports
@ 2009-12-01  9:54 Guennadi Liakhovetski
  2009-12-04  4:45 ` Paul Mundt
  2009-12-04 10:51 ` Magnus Damm
  0 siblings, 2 replies; 3+ messages in thread
From: Guennadi Liakhovetski @ 2009-12-01  9:54 UTC (permalink / raw)
  To: linux-sh

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>
---
diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c
index 85119fb..70a52a5 100644
--- a/drivers/serial/sh-sci.c
+++ b/drivers/serial/sh-sci.c
@@ -833,8 +833,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)

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-12-04 10:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-01  9:54 [PATCH] Fix too early disabling of the serial (SCI(F)) ports Guennadi Liakhovetski
2009-12-04  4:45 ` Paul Mundt
2009-12-04 10:51 ` Magnus Damm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox