diff mbox

Fix SCI console output

Message ID 4.2.0.58.J.20090601123439.00b52740@router.itonet.co.jp (mailing list archive)
State Accepted
Headers show

Commit Message

SUGIOKA Toshinobu June 1, 2009, 3:53 a.m. UTC
Fix SCI transmission sequence in console output function.

Signed-off-by: Toshinobu Sugioka <sugioka@itonet.co.jp>


SUGIOKA Toshinobu

--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Paul Mundt June 1, 2009, 4:59 a.m. UTC | #1
On Mon, Jun 01, 2009 at 12:53:41PM +0900, SUGIOKA Toshinobu wrote:
> Fix SCI transmission sequence in console output function.
> 
> Signed-off-by: Toshinobu Sugioka <sugioka@itonet.co.jp>
> 
This change was intentional. Do you have a use case where this causes a
problem?
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
SUGIOKA Toshinobu June 1, 2009, 11:34 a.m. UTC | #2
At 13:59 09/06/01 +0900, Paul Mundt <lethal@linux-sh.org> wrote:
>On Mon, Jun 01, 2009 at 12:53:41PM +0900, SUGIOKA Toshinobu wrote:
>> Fix SCI transmission sequence in console output function.
>> 
>> Signed-off-by: Toshinobu Sugioka <sugioka@itonet.co.jp>
>> 
>This change was intentional. Do you have a use case where this causes a
>problem? 

On my SH7709S board, after switching to console(SCI), output is not correct.
Linefeed code output twice, and the first character of the next line is
not seen.

Like follows.
--- console output ----
SuperH SCI(F) driver initialized
sh-sci: ttySC0 at MMIO 0xfffffe80 (irq = 25) is a sci
console handover: boot [bios0] -> real [ttySC0]

h-sci: ttySC1 at MMIO 0xa4000150 (irq = 59) is a scif

h-sci: ttySC2 at MMIO 0xa4000140 (irq = 55) is a irda

oop: module loaded
---------------------------
Atfer applying the patch, I got normal output.

According to sh7709s hardware manual, SCI tx flow-chart says
 (1) wait until TDRE=1
 (2) write data to TDR
 (3) clear TDRE

Why did you changed the sequence ?

SUGIOKA Toshinobu

--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Paul Mundt June 1, 2009, 3:38 p.m. UTC | #3
On Mon, Jun 01, 2009 at 08:34:52PM +0900, SUGIOKA Toshinobu wrote:
> At 13:59 09/06/01 +0900, Paul Mundt <lethal@linux-sh.org> wrote:
> >On Mon, Jun 01, 2009 at 12:53:41PM +0900, SUGIOKA Toshinobu wrote:
> >> Fix SCI transmission sequence in console output function.
> >> 
> >> Signed-off-by: Toshinobu Sugioka <sugioka@itonet.co.jp>
> >> 
> >This change was intentional. Do you have a use case where this causes a
> >problem? 
> 
> On my SH7709S board, after switching to console(SCI), output is not correct.
> Linefeed code output twice, and the first character of the next line is
> not seen.
> 
> Like follows.
> --- console output ----
> SuperH SCI(F) driver initialized
> sh-sci: ttySC0 at MMIO 0xfffffe80 (irq = 25) is a sci
> console handover: boot [bios0] -> real [ttySC0]
> 
> h-sci: ttySC1 at MMIO 0xa4000150 (irq = 59) is a scif
> 
> h-sci: ttySC2 at MMIO 0xa4000140 (irq = 55) is a irda
> 
> oop: module loaded
> ---------------------------
> Atfer applying the patch, I got normal output.
> 
Interesting, so it seems to be a SCI issue. I've never seen that on any
SCIF or SCIFA at least.

> According to sh7709s hardware manual, SCI tx flow-chart says
>  (1) wait until TDRE=1
>  (2) write data to TDR
>  (3) clear TDRE
> 
> Why did you changed the sequence ?
> 
We changed it as there is an inherent race with that sequence under QEMU,
and as no hardware seemed to have an issue with the ordering change, it
was easier to do that than try to fix up the QEMU mess. But in light of
the fact SH-3 SCI has issues, we will have to revert to the previous
ordering with your patch and give the QEMU issues a bit of a rethink.

Thanks for the report!
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c
index fa4d52a..a4cf107 100644
--- a/drivers/serial/sh-sci.c
+++ b/drivers/serial/sh-sci.c
@@ -151,9 +151,8 @@  static void sci_poll_put_char(struct uart_port *port, unsigned char c)
 		status = sci_in(port, SCxSR);
 	} while (!(status & SCxSR_TDxE(port)));
 
-	sci_in(port, SCxSR);            /* Dummy read */
-	sci_out(port, SCxSR, SCxSR_TDxE_CLEAR(port) & ~SCxSR_TEND(port));
 	sci_out(port, SCxTDR, c);
+	sci_out(port, SCxSR, SCxSR_TDxE_CLEAR(port) & ~SCxSR_TEND(port));
 }
 #endif /* CONFIG_CONSOLE_POLL || CONFIG_SERIAL_SH_SCI_CONSOLE */