Skip to contentSkip to conversation

serial: sh-sci: fix deadlock when resuming from S3 sleep

PATCH Applied Alexandre Courbot 2 participants 2 messages Mar 3, 2011 – Mar 4, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 serial: sh-sci: fix deadlock when resuming from S3 sleep

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.

---
 drivers/tty/serial/sh-sci.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
drivers/tty/serial/sh-sci.c +6 -0
index e180bc9..264209c 100644
@@ -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)));
@@ -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)
Signature · 1 line
1.7.4.1
Applied
#1 lore raw
Quoted 11 lines · Alexandre Courbot

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.

Applied, thanks.