summaryrefslogtreecommitdiff
path: root/drivers/tty
diff options
context:
space:
mode:
authorFugang Duan <fugang.duan@nxp.com>2018-03-05 18:45:51 +0800
committerJason Liu <jason.hui.liu@nxp.com>2019-02-12 10:30:55 +0800
commit13d6cd1020359e17b988f187708fd2664669604c (patch)
tree03c7f47c8e6557d8e92b380b6c71f005b223a952 /drivers/tty
parentb8b41cc8793cf7a2ecdcc9017732ec76356bd8a7 (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')
-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 904f5f2b406b..3cf799c8e46d 100644
--- a/drivers/tty/serial/fsl_lpuart.c
+++ b/drivers/tty/serial/fsl_lpuart.c
@@ -2703,6 +2703,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 (!lpuart_is_32(sport) || !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;
@@ -2842,6 +2873,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;