From 29add68d16474b7e8e3eadd94da4e909533b99d2 Mon Sep 17 00:00:00 2001 From: Martin Fuzzey Date: Tue, 5 Jan 2016 16:53:31 +0100 Subject: [PATCH] serial: imx: Fix suspend / resume. When a non console i.MX UART is enabled in the device tree, system suspend fails due to an unprepared clock: [ 638.794563] PM: Syncing filesystems ... done. [ 638.878902] Freezing user space processes ... (elapsed 0.002 seconds) done. [ 638.888454] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done. [ 638.996697] PM: suspend of devices complete after 97.200 msecs [ 639.002611] PM: suspend devices took 0.100 seconds [ 639.013020] PM: late suspend of devices complete after 2.288 msecs [ 639.021486] ------------[ cut here ]------------ [ 639.026147] WARNING: CPU: 0 PID: 488 at drivers/clk/clk.c:732 clk_core_enable+0xc0/0x12c() [ 639.034413] Modules linked in: [ 639.037490] CPU: 0 PID: 488 Comm: system_server Tainted: G W 4.4.0-rc5-pknbsp-svn2214-atag-v4.4-rc5-121-gebfd9cb #1304 [ 639.049312] Hardware name: Freescale i.MX53 (Device Tree Support) [ 639.055444] [] (unwind_backtrace) from [] (show_stack+0x20/0x24) [ 639.063199] [] (show_stack) from [] (dump_stack+0x20/0x28) [ 639.070442] [] (dump_stack) from [] (warn_slowpath_common+0x88/0xc0) [ 639.078541] [] (warn_slowpath_common) from [] (warn_slowpath_null+0x2c/0x34) [ 639.087332] [] (warn_slowpath_null) from [] (clk_core_enable+0xc0/0x12c) [ 639.095777] [] (clk_core_enable) from [] (clk_enable+0x2c/0x40) [ 639.103441] [] (clk_enable) from [] (imx_serial_port_suspend_noirq+0x20/0xe0) [ 639.112336] [] (imx_serial_port_suspend_noirq) from [] (dpm_run_callback+0x68/0x16c) [ 639.121825] [] (dpm_run_callback) from [] (__device_suspend_noirq+0xf4/0x22c) [ 639.130705] [] (__device_suspend_noirq) from [] (dpm_suspend_noirq+0x148/0x30c) [ 639.139764] [] (dpm_suspend_noirq) from [] (suspend_devices_and_enter+0x2e8/0x6a4) [ 639.149078] [] (suspend_devices_and_enter) from [] (pm_suspend+0x310/0x4b8) [ 639.157782] [] (pm_suspend) from [] (state_store+0x7c/0xcc) [ 639.165099] [] (state_store) from [] (kobj_attr_store+0x1c/0x28) [ 639.172858] [] (kobj_attr_store) from [] (sysfs_kf_write+0x54/0x58) [ 639.180871] [] (sysfs_kf_write) from [] (kernfs_fop_write+0x100/0x1c8) [ 639.189152] [] (kernfs_fop_write) from [] (__vfs_write+0x3c/0xe8) [ 639.196991] [] (__vfs_write) from [] (vfs_write+0xa4/0x160) [ 639.204307] [] (vfs_write) from [] (SyS_write+0x4c/0x98) [ 639.211363] [] (SyS_write) from [] (ret_fast_syscall+0x0/0x3c) This does not happen for the common case of a single UART used as a console (since imx_console_setup() already does a prepare) Signed-off-by: Martin Fuzzey Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/imx.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index 9362f54c..231e7d5 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -2166,7 +2166,8 @@ static int imx_serial_port_suspend(struct device *dev) uart_suspend_port(&imx_reg, &sport->port); - return 0; + /* Needed to enable clock in suspend_noirq */ + return clk_prepare(sport->clk_ipg); } static int imx_serial_port_resume(struct device *dev) @@ -2179,6 +2180,8 @@ static int imx_serial_port_resume(struct device *dev) uart_resume_port(&imx_reg, &sport->port); + clk_unprepare(sport->clk_ipg); + return 0; } -- 2.7.4