Commit a67969b5 authored by Geert Uytterhoeven's avatar Geert Uytterhoeven

serial: sh-sci: Don't overwrite clock selection in serial_console_write()

Blindly writing the default configuration value into the SCSCR register
may change the clock selection bits, breaking the serial console if the
current driver settings differ from the default settings.

Keep the current clock selection bits to prevent this from happening
on e.g. r8a7791/koelsch when support for the BRG will be added.
Signed-off-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent bdcb3826
...@@ -2420,7 +2420,7 @@ static void serial_console_write(struct console *co, const char *s, ...@@ -2420,7 +2420,7 @@ static void serial_console_write(struct console *co, const char *s,
{ {
struct sci_port *sci_port = &sci_ports[co->index]; struct sci_port *sci_port = &sci_ports[co->index];
struct uart_port *port = &sci_port->port; struct uart_port *port = &sci_port->port;
unsigned short bits, ctrl; unsigned short bits, ctrl, ctrl_temp;
unsigned long flags; unsigned long flags;
int locked = 1; int locked = 1;
...@@ -2432,9 +2432,11 @@ static void serial_console_write(struct console *co, const char *s, ...@@ -2432,9 +2432,11 @@ static void serial_console_write(struct console *co, const char *s,
else else
spin_lock(&port->lock); spin_lock(&port->lock);
/* first save the SCSCR then disable the interrupts */ /* first save SCSCR then disable interrupts, keep clock source */
ctrl = serial_port_in(port, SCSCR); ctrl = serial_port_in(port, SCSCR);
serial_port_out(port, SCSCR, sci_port->cfg->scscr); ctrl_temp = (sci_port->cfg->scscr & ~(SCSCR_CKE1 | SCSCR_CKE0)) |
(ctrl & (SCSCR_CKE1 | SCSCR_CKE0));
serial_port_out(port, SCSCR, ctrl_temp);
uart_console_write(port, s, count, serial_console_putchar); uart_console_write(port, s, count, serial_console_putchar);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment