Commit 154280fd authored by Magnus Damm's avatar Magnus Damm Committed by Paul Mundt

serial: sh-sci: earlyprintk zero uartclk fix

This establishes a sensible max baud rate for the earlyprintk cases where
the port's uartclk has not yet been determined.
Signed-off-by: default avatarMagnus Damm <damm@opensource.se>
Signed-off-by: default avatarPaul Mundt <lethal@linux-sh.org>
parent 2f99f5c8
...@@ -897,11 +897,21 @@ static void sci_shutdown(struct uart_port *port) ...@@ -897,11 +897,21 @@ static void sci_shutdown(struct uart_port *port)
static void sci_set_termios(struct uart_port *port, struct ktermios *termios, static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
struct ktermios *old) struct ktermios *old)
{ {
unsigned int status, baud, smr_val; unsigned int status, baud, smr_val, max_baud;
int t = -1; int t = -1;
baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16); /*
if (likely(baud)) * earlyprintk comes here early on with port->uartclk set to zero.
* the clock framework is not up and running at this point so here
* we assume that 115200 is the maximum baud rate. please note that
* the baud rate is not programmed during earlyprintk - it is assumed
* that the previous boot loader has enabled required clocks and
* setup the baud rate generator hardware for us already.
*/
max_baud = port->uartclk ? port->uartclk / 16 : 115200;
baud = uart_get_baud_rate(port, termios, old, 0, max_baud);
if (likely(baud && port->uartclk))
t = SCBRR_VALUE(baud, port->uartclk); t = SCBRR_VALUE(baud, port->uartclk);
do { do {
......
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