From f09e64beded2766b12fe0aeeab9dc96c0c043741 Mon Sep 17 00:00:00 2001 From: Shinya Kuribayashi Date: Fri, 16 Nov 2012 10:54:15 +0900 Subject: [PATCH] --- yaml --- r: 338433 b: refs/heads/master c: 40f70c03e33a1eed3f3fcd13418e76abad77d117 h: refs/heads/master i: 338431: 14bfec141efa94b75f4c1fd2ab14006e695763ba v: v3 --- [refs] | 2 +- trunk/drivers/tty/serial/sh-sci.c | 23 ++++++++++++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index 425040615d28..a39ec581d39c 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 8c66d6d2a1a572768616ddca2c3863384b14d846 +refs/heads/master: 40f70c03e33a1eed3f3fcd13418e76abad77d117 diff --git a/trunk/drivers/tty/serial/sh-sci.c b/trunk/drivers/tty/serial/sh-sci.c index 107801b1279a..63a23eadd7e8 100644 --- a/trunk/drivers/tty/serial/sh-sci.c +++ b/trunk/drivers/tty/serial/sh-sci.c @@ -2203,7 +2203,21 @@ static void serial_console_write(struct console *co, const char *s, { struct sci_port *sci_port = &sci_ports[co->index]; struct uart_port *port = &sci_port->port; - unsigned short bits; + unsigned short bits, ctrl; + unsigned long flags; + int locked = 1; + + local_irq_save(flags); + if (port->sysrq) + locked = 0; + else if (oops_in_progress) + locked = spin_trylock(&port->lock); + else + spin_lock(&port->lock); + + /* first save the SCSCR then disable the interrupts */ + ctrl = serial_port_in(port, SCSCR); + serial_port_out(port, SCSCR, sci_port->cfg->scscr); uart_console_write(port, s, count, serial_console_putchar); @@ -2211,6 +2225,13 @@ static void serial_console_write(struct console *co, const char *s, bits = SCxSR_TDxE(port) | SCxSR_TEND(port); while ((serial_port_in(port, SCxSR) & bits) != bits) cpu_relax(); + + /* restore the SCSCR */ + serial_port_out(port, SCSCR, ctrl); + + if (locked) + spin_unlock(&port->lock); + local_irq_restore(flags); } static int __devinit serial_console_setup(struct console *co, char *options)