summaryrefslogtreecommitdiff
path: root/drivers/tty/serial
diff options
context:
space:
mode:
authorFugang Duan <fugang.duan@nxp.com>2018-03-05 18:45:51 +0800
committerLeonard Crestez <leonard.crestez@nxp.com>2018-08-24 12:41:33 +0300
commit829533c75408cdcf00af780d4e1468459d7a6162 (patch)
treeb9c52fe4d606e695385c0f42f6c4413fcb83384d /drivers/tty/serial
parent45417e907fbd092b9a4fea51ae409b3c76fb21a6 (diff)
MLK-17738 tty: serial: lpuart: restore console setting after power lost
i.MX7ULP enter VLLS mode that lpuart module power off and registers all lost no matter the port is wakeup source. For console port, console baud rate setting lost and print messy log when enable the console port as wakeup source. To avoid the issue happen, user should not enable uart port as wakeup source in VLLS mode, or restore console setting. The patch is to add one fixup to restore console port register setting for i.MX7ULP platform. Reviewed-by: Gao Pan <pandy.gao@nxp.com> Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Diffstat (limited to 'drivers/tty/serial')
-rw-r--r--drivers/tty/serial/fsl_lpuart.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c
index d71bf1be3356..7bd511c96192 100644
--- a/drivers/tty/serial/fsl_lpuart.c
+++ b/drivers/tty/serial/fsl_lpuart.c
@@ -2502,6 +2502,37 @@ static int lpuart_suspend(struct device *dev)
return 0;
}
+static void lpuart_console_fixup(struct lpuart_port *sport)
+{
+ struct tty_port *port = &sport->port.state->port;
+ struct uart_port *uport = &sport->port;
+ struct device_node *np = sport->port.dev->of_node;
+ struct ktermios termios;
+
+ if (!sport->lpuart32 || !np)
+ return;
+
+ /* i.MX7ULP enter VLLS mode that lpuart module power off and registers
+ * all lost no matter the port is wakeup source.
+ * For console port, console baud rate setting lost and print messy
+ * log when enable the console port as wakeup source. To avoid the
+ * issue happen, user should not enable uart port as wakeup source
+ * in VLLS mode, or restore console setting here.
+ */
+ if (of_device_is_compatible(np, "fsl,imx7ulp-lpuart") &&
+ lpuart_uport_is_active(sport) && console_suspend_enabled &&
+ uart_console(&sport->port)) {
+
+ mutex_lock(&port->mutex);
+ memset(&termios, 0, sizeof(struct ktermios));
+ termios.c_cflag = uport->cons->cflag;
+ if (port->tty && termios.c_cflag == 0)
+ termios = port->tty->termios;
+ uport->ops->set_termios(uport, &termios, NULL);
+ mutex_unlock(&port->mutex);
+ }
+}
+
static inline void lpuart32_resume_init(struct lpuart_port *sport)
{
unsigned long temp;
@@ -2641,6 +2672,7 @@ static int lpuart_resume(struct device *dev)
pm_runtime_enable(sport->port.dev);
}
+ lpuart_console_fixup(sport);
uart_resume_port(&lpuart_reg, &sport->port);
return 0;