Skip to content

Commit

Permalink
serial: sh-sci: fix deadlock when resuming from S3 sleep
Browse files Browse the repository at this point in the history
S3 sleep invokes the shutdown callback of the sh-sci driver, which
suspends the clocks until they are reactivated by a call to startup.
However, before the latter is invoked, sci_set_termios may be called on
the port by uart_resume_port. In such cases it will endlessly wait for
the TEND bit to raise, which will never happen since the clocks are
disabled.

This patch ensures that clocks are enabled when ports registers are
manipulated within sci_set_termios.

Signed-off-by: Alexandre Courbot <gnurou@gmail.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
  • Loading branch information
Alexandre Courbot authored and Paul Mundt committed Mar 4, 2011
1 parent 18e9550 commit 3600338
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/tty/serial/sh-sci.c
Original file line number Diff line number Diff line change
Expand Up @@ -1504,6 +1504,9 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
if (likely(baud && port->uartclk))
t = sci_scbrr_calc(s->cfg->scbrr_algo_id, baud, port->uartclk);

if (s->enable)
s->enable(port);

do {
status = sci_in(port, SCxSR);
} while (!(status & SCxSR_TEND(port)));
Expand Down Expand Up @@ -1571,6 +1574,9 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios,

if ((termios->c_cflag & CREAD) != 0)
sci_start_rx(port);

if (s->disable)
s->disable(port);
}

static const char *sci_type(struct uart_port *port)
Expand Down

0 comments on commit 3600338

Please sign in to comment.