|
@@ -2219,8 +2219,10 @@ static void serial_imx_enable_wakeup(struct imx_port *sport, bool on)
|
|
|
unsigned int val;
|
|
|
|
|
|
val = readl(sport->port.membase + UCR3);
|
|
|
- if (on)
|
|
|
+ if (on) {
|
|
|
+ writel(USR1_AWAKE, sport->port.membase + USR1);
|
|
|
val |= UCR3_AWAKEN;
|
|
|
+ }
|
|
|
else
|
|
|
val &= ~UCR3_AWAKEN;
|
|
|
writel(val, sport->port.membase + UCR3);
|
|
@@ -2239,11 +2241,6 @@ static int imx_serial_port_suspend_noirq(struct device *dev)
|
|
|
{
|
|
|
struct platform_device *pdev = to_platform_device(dev);
|
|
|
struct imx_port *sport = platform_get_drvdata(pdev);
|
|
|
- int ret;
|
|
|
-
|
|
|
- ret = clk_enable(sport->clk_ipg);
|
|
|
- if (ret)
|
|
|
- return ret;
|
|
|
|
|
|
serial_imx_save_context(sport);
|
|
|
|
|
@@ -2264,8 +2261,6 @@ static int imx_serial_port_resume_noirq(struct device *dev)
|
|
|
|
|
|
serial_imx_restore_context(sport);
|
|
|
|
|
|
- clk_disable(sport->clk_ipg);
|
|
|
-
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
@@ -2273,15 +2268,19 @@ static int imx_serial_port_suspend(struct device *dev)
|
|
|
{
|
|
|
struct platform_device *pdev = to_platform_device(dev);
|
|
|
struct imx_port *sport = platform_get_drvdata(pdev);
|
|
|
-
|
|
|
- /* enable wakeup from i.MX UART */
|
|
|
- serial_imx_enable_wakeup(sport, true);
|
|
|
+ int ret;
|
|
|
|
|
|
uart_suspend_port(&imx_reg, &sport->port);
|
|
|
disable_irq(sport->port.irq);
|
|
|
|
|
|
- /* Needed to enable clock in suspend_noirq */
|
|
|
- return clk_prepare(sport->clk_ipg);
|
|
|
+ ret = clk_prepare_enable(sport->clk_ipg);
|
|
|
+ if (ret)
|
|
|
+ return ret;
|
|
|
+
|
|
|
+ /* enable wakeup from i.MX UART */
|
|
|
+ serial_imx_enable_wakeup(sport, true);
|
|
|
+
|
|
|
+ return 0;
|
|
|
}
|
|
|
|
|
|
static int imx_serial_port_resume(struct device *dev)
|
|
@@ -2295,7 +2294,7 @@ static int imx_serial_port_resume(struct device *dev)
|
|
|
uart_resume_port(&imx_reg, &sport->port);
|
|
|
enable_irq(sport->port.irq);
|
|
|
|
|
|
- clk_unprepare(sport->clk_ipg);
|
|
|
+ clk_disable_unprepare(sport->clk_ipg);
|
|
|
|
|
|
return 0;
|
|
|
}
|
|
@@ -2307,8 +2306,7 @@ static int imx_serial_port_freeze(struct device *dev)
|
|
|
|
|
|
uart_suspend_port(&imx_reg, &sport->port);
|
|
|
|
|
|
- /* Needed to enable clock in suspend_noirq */
|
|
|
- return clk_prepare(sport->clk_ipg);
|
|
|
+ return clk_prepare_enable(sport->clk_ipg);
|
|
|
}
|
|
|
|
|
|
static int imx_serial_port_thaw(struct device *dev)
|
|
@@ -2318,7 +2316,7 @@ static int imx_serial_port_thaw(struct device *dev)
|
|
|
|
|
|
uart_resume_port(&imx_reg, &sport->port);
|
|
|
|
|
|
- clk_unprepare(sport->clk_ipg);
|
|
|
+ clk_disable_unprepare(sport->clk_ipg);
|
|
|
|
|
|
return 0;
|
|
|
}
|