MLK-16789 tty: serial: lpuart: keep ipg clock enable during .uart_resume_port()
authorFugang Duan <fugang.duan@nxp.com>
Thu, 9 Nov 2017 06:38:32 +0000 (14:38 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 20:39:12 +0000 (15:39 -0500)
Ensure ipg clock enable during .uart_resume_port() that call set
ops->set_mctrl() before ops->startup().

BuildInfo:
 - SCFW daf9431c, IMX-MKIMAGE 1c6fc7d8, ATF f2547fb
 - U-Boot 2017.03-00097-gd7599cf

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Reviewed-by: Robin Gong <yibin.gong@nxp.com>
drivers/tty/serial/fsl_lpuart.c

index 9a3b925..68200ca 100644 (file)
@@ -2546,6 +2546,7 @@ static int lpuart_resume(struct device *dev)
 {
        struct lpuart_port *sport = dev_get_drvdata(dev);
        struct tty_port *port = &sport->port.state->port;
+       bool ipgclk_on = false;
        int ret;
 
        if (sport->lpuart32)
@@ -2555,15 +2556,17 @@ static int lpuart_resume(struct device *dev)
 
        if (uart_console(&sport->port) ||
            (sport->port.irq_wake && tty_port_initialized(port))) {
+               ipgclk_on = true;
                ret = clk_prepare_enable(sport->per_clk);
                if (ret)
                        return ret;
-       } else {
-               clk_disable_unprepare(sport->ipg_clk);
        }
 
        uart_resume_port(&lpuart_reg, &sport->port);
 
+       if (!ipgclk_on)
+               clk_disable_unprepare(sport->ipg_clk);
+
        return 0;
 }