All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] serial: imx: Fix suspend / resume.
@ 2016-01-04 18:22 ` Martin Fuzzey
  0 siblings, 0 replies; 7+ messages in thread
From: Martin Fuzzey @ 2016-01-04 18:22 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-arm-kernel, linux-serial

Suspend fails due to 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] [<c0016d54>] (unwind_backtrace) from [<c00140f8>] (show_stack+0x20/0x24)
[  639.063199] [<c00140f8>] (show_stack) from [<c02c99a0>] (dump_stack+0x20/0x28)
[  639.070442] [<c02c99a0>] (dump_stack) from [<c0024ca8>] (warn_slowpath_common+0x88/0xc0)
[  639.078541] [<c0024ca8>] (warn_slowpath_common) from [<c0024d0c>] (warn_slowpath_null+0x2c/0x34)
[  639.087332] [<c0024d0c>] (warn_slowpath_null) from [<c05171e8>] (clk_core_enable+0xc0/0x12c)
[  639.095777] [<c05171e8>] (clk_core_enable) from [<c05172f8>] (clk_enable+0x2c/0x40)
[  639.103441] [<c05172f8>] (clk_enable) from [<c0349880>] (imx_serial_port_suspend_noirq+0x20/0xe0)
[  639.112336] [<c0349880>] (imx_serial_port_suspend_noirq) from [<c03a26a0>] (dpm_run_callback+0x68/0x16c)
[  639.121825] [<c03a26a0>] (dpm_run_callback) from [<c03a2898>] (__device_suspend_noirq+0xf4/0x22c)
[  639.130705] [<c03a2898>] (__device_suspend_noirq) from [<c03a4b0c>] (dpm_suspend_noirq+0x148/0x30c)
[  639.139764] [<c03a4b0c>] (dpm_suspend_noirq) from [<c00511d4>] (suspend_devices_and_enter+0x2e8/0x6a4)
[  639.149078] [<c00511d4>] (suspend_devices_and_enter) from [<c00518a0>] (pm_suspend+0x310/0x4b8)
[  639.157782] [<c00518a0>] (pm_suspend) from [<c00500ec>] (state_store+0x7c/0xcc)
[  639.165099] [<c00500ec>] (state_store) from [<c02cb6dc>] (kobj_attr_store+0x1c/0x28)
[  639.172858] [<c02cb6dc>] (kobj_attr_store) from [<c01633d4>] (sysfs_kf_write+0x54/0x58)
[  639.180871] [<c01633d4>] (sysfs_kf_write) from [<c01629b4>] (kernfs_fop_write+0x100/0x1c8)
[  639.189152] [<c01629b4>] (kernfs_fop_write) from [<c00fb8b8>] (__vfs_write+0x3c/0xe8)
[  639.196991] [<c00fb8b8>] (__vfs_write) from [<c00fc810>] (vfs_write+0xa4/0x160)
[  639.204307] [<c00fc810>] (vfs_write) from [<c00fcac4>] (SyS_write+0x4c/0x98)
[  639.211363] [<c00fcac4>] (SyS_write) from [<c0010760>] (ret_fast_syscall+0x0/0x3c)

Signed-off-by: Martin Fuzzey <mfuzzey@parkeon.com>
---
 drivers/tty/serial/imx.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 016e4be..16a551b 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -2071,13 +2071,13 @@ static int imx_serial_port_suspend_noirq(struct device *dev)
 	struct imx_port *sport = platform_get_drvdata(pdev);
 	int ret;
 
-	ret = clk_enable(sport->clk_ipg);
+	ret = clk_prepare_enable(sport->clk_ipg);
 	if (ret)
 		return ret;
 
 	serial_imx_save_context(sport);
 
-	clk_disable(sport->clk_ipg);
+	clk_disable_unprepare(sport->clk_ipg);
 
 	return 0;
 }
@@ -2088,13 +2088,13 @@ static int imx_serial_port_resume_noirq(struct device *dev)
 	struct imx_port *sport = platform_get_drvdata(pdev);
 	int ret;
 
-	ret = clk_enable(sport->clk_ipg);
+	ret = clk_prepare_enable(sport->clk_ipg);
 	if (ret)
 		return ret;
 
 	serial_imx_restore_context(sport);
 
-	clk_disable(sport->clk_ipg);
+	clk_disable_unprepare(sport->clk_ipg);
 
 	return 0;
 }

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH] serial: imx: Fix suspend / resume.
@ 2016-01-04 18:22 ` Martin Fuzzey
  0 siblings, 0 replies; 7+ messages in thread
From: Martin Fuzzey @ 2016-01-04 18:22 UTC (permalink / raw)
  To: linux-arm-kernel

Suspend fails due to 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] [<c0016d54>] (unwind_backtrace) from [<c00140f8>] (show_stack+0x20/0x24)
[  639.063199] [<c00140f8>] (show_stack) from [<c02c99a0>] (dump_stack+0x20/0x28)
[  639.070442] [<c02c99a0>] (dump_stack) from [<c0024ca8>] (warn_slowpath_common+0x88/0xc0)
[  639.078541] [<c0024ca8>] (warn_slowpath_common) from [<c0024d0c>] (warn_slowpath_null+0x2c/0x34)
[  639.087332] [<c0024d0c>] (warn_slowpath_null) from [<c05171e8>] (clk_core_enable+0xc0/0x12c)
[  639.095777] [<c05171e8>] (clk_core_enable) from [<c05172f8>] (clk_enable+0x2c/0x40)
[  639.103441] [<c05172f8>] (clk_enable) from [<c0349880>] (imx_serial_port_suspend_noirq+0x20/0xe0)
[  639.112336] [<c0349880>] (imx_serial_port_suspend_noirq) from [<c03a26a0>] (dpm_run_callback+0x68/0x16c)
[  639.121825] [<c03a26a0>] (dpm_run_callback) from [<c03a2898>] (__device_suspend_noirq+0xf4/0x22c)
[  639.130705] [<c03a2898>] (__device_suspend_noirq) from [<c03a4b0c>] (dpm_suspend_noirq+0x148/0x30c)
[  639.139764] [<c03a4b0c>] (dpm_suspend_noirq) from [<c00511d4>] (suspend_devices_and_enter+0x2e8/0x6a4)
[  639.149078] [<c00511d4>] (suspend_devices_and_enter) from [<c00518a0>] (pm_suspend+0x310/0x4b8)
[  639.157782] [<c00518a0>] (pm_suspend) from [<c00500ec>] (state_store+0x7c/0xcc)
[  639.165099] [<c00500ec>] (state_store) from [<c02cb6dc>] (kobj_attr_store+0x1c/0x28)
[  639.172858] [<c02cb6dc>] (kobj_attr_store) from [<c01633d4>] (sysfs_kf_write+0x54/0x58)
[  639.180871] [<c01633d4>] (sysfs_kf_write) from [<c01629b4>] (kernfs_fop_write+0x100/0x1c8)
[  639.189152] [<c01629b4>] (kernfs_fop_write) from [<c00fb8b8>] (__vfs_write+0x3c/0xe8)
[  639.196991] [<c00fb8b8>] (__vfs_write) from [<c00fc810>] (vfs_write+0xa4/0x160)
[  639.204307] [<c00fc810>] (vfs_write) from [<c00fcac4>] (SyS_write+0x4c/0x98)
[  639.211363] [<c00fcac4>] (SyS_write) from [<c0010760>] (ret_fast_syscall+0x0/0x3c)

Signed-off-by: Martin Fuzzey <mfuzzey@parkeon.com>
---
 drivers/tty/serial/imx.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 016e4be..16a551b 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -2071,13 +2071,13 @@ static int imx_serial_port_suspend_noirq(struct device *dev)
 	struct imx_port *sport = platform_get_drvdata(pdev);
 	int ret;
 
-	ret = clk_enable(sport->clk_ipg);
+	ret = clk_prepare_enable(sport->clk_ipg);
 	if (ret)
 		return ret;
 
 	serial_imx_save_context(sport);
 
-	clk_disable(sport->clk_ipg);
+	clk_disable_unprepare(sport->clk_ipg);
 
 	return 0;
 }
@@ -2088,13 +2088,13 @@ static int imx_serial_port_resume_noirq(struct device *dev)
 	struct imx_port *sport = platform_get_drvdata(pdev);
 	int ret;
 
-	ret = clk_enable(sport->clk_ipg);
+	ret = clk_prepare_enable(sport->clk_ipg);
 	if (ret)
 		return ret;
 
 	serial_imx_restore_context(sport);
 
-	clk_disable(sport->clk_ipg);
+	clk_disable_unprepare(sport->clk_ipg);
 
 	return 0;
 }

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] serial: imx: Fix suspend / resume.
  2016-01-04 18:22 ` Martin Fuzzey
@ 2016-01-04 19:10   ` Russell King - ARM Linux
  -1 siblings, 0 replies; 7+ messages in thread
From: Russell King - ARM Linux @ 2016-01-04 19:10 UTC (permalink / raw)
  To: Martin Fuzzey; +Cc: Greg Kroah-Hartman, linux-serial, linux-arm-kernel

On Mon, Jan 04, 2016 at 07:22:06PM +0100, Martin Fuzzey wrote:
> diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
> index 016e4be..16a551b 100644
> --- a/drivers/tty/serial/imx.c
> +++ b/drivers/tty/serial/imx.c
> @@ -2071,13 +2071,13 @@ static int imx_serial_port_suspend_noirq(struct device *dev)
>  	struct imx_port *sport = platform_get_drvdata(pdev);
>  	int ret;
>  
> -	ret = clk_enable(sport->clk_ipg);
> +	ret = clk_prepare_enable(sport->clk_ipg);
>  	if (ret)
>  		return ret;
>  
>  	serial_imx_save_context(sport);
>  
> -	clk_disable(sport->clk_ipg);
> +	clk_disable_unprepare(sport->clk_ipg);

NAK.  If this is _noirq, then it's a context which can't sleep.  Therefore,
calling functions that do sleep is not permitted.

> @@ -2088,13 +2088,13 @@ static int imx_serial_port_resume_noirq(struct device *dev)
>  	struct imx_port *sport = platform_get_drvdata(pdev);
>  	int ret;
>  
> -	ret = clk_enable(sport->clk_ipg);
> +	ret = clk_prepare_enable(sport->clk_ipg);
>  	if (ret)
>  		return ret;
>  
>  	serial_imx_restore_context(sport);
>  
> -	clk_disable(sport->clk_ipg);
> +	clk_disable_unprepare(sport->clk_ipg);

Ditto.

-- 
RMK's Patch system: http://www.arm.linux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] serial: imx: Fix suspend / resume.
@ 2016-01-04 19:10   ` Russell King - ARM Linux
  0 siblings, 0 replies; 7+ messages in thread
From: Russell King - ARM Linux @ 2016-01-04 19:10 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Jan 04, 2016 at 07:22:06PM +0100, Martin Fuzzey wrote:
> diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
> index 016e4be..16a551b 100644
> --- a/drivers/tty/serial/imx.c
> +++ b/drivers/tty/serial/imx.c
> @@ -2071,13 +2071,13 @@ static int imx_serial_port_suspend_noirq(struct device *dev)
>  	struct imx_port *sport = platform_get_drvdata(pdev);
>  	int ret;
>  
> -	ret = clk_enable(sport->clk_ipg);
> +	ret = clk_prepare_enable(sport->clk_ipg);
>  	if (ret)
>  		return ret;
>  
>  	serial_imx_save_context(sport);
>  
> -	clk_disable(sport->clk_ipg);
> +	clk_disable_unprepare(sport->clk_ipg);

NAK.  If this is _noirq, then it's a context which can't sleep.  Therefore,
calling functions that do sleep is not permitted.

> @@ -2088,13 +2088,13 @@ static int imx_serial_port_resume_noirq(struct device *dev)
>  	struct imx_port *sport = platform_get_drvdata(pdev);
>  	int ret;
>  
> -	ret = clk_enable(sport->clk_ipg);
> +	ret = clk_prepare_enable(sport->clk_ipg);
>  	if (ret)
>  		return ret;
>  
>  	serial_imx_restore_context(sport);
>  
> -	clk_disable(sport->clk_ipg);
> +	clk_disable_unprepare(sport->clk_ipg);

Ditto.

-- 
RMK's Patch system: http://www.arm.linux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] serial: imx: Fix suspend / resume.
  2016-01-04 19:10   ` Russell King - ARM Linux
@ 2016-01-12 18:41     ` Grygorii Strashko
  -1 siblings, 0 replies; 7+ messages in thread
From: Grygorii Strashko @ 2016-01-12 18:41 UTC (permalink / raw)
  To: Russell King - ARM Linux, Martin Fuzzey
  Cc: Greg Kroah-Hartman, linux-arm-kernel, linux-serial

Hi Russell,

On 01/04/2016 09:10 PM, Russell King - ARM Linux wrote:
> On Mon, Jan 04, 2016 at 07:22:06PM +0100, Martin Fuzzey wrote:
>> diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
>> index 016e4be..16a551b 100644
>> --- a/drivers/tty/serial/imx.c
>> +++ b/drivers/tty/serial/imx.c
>> @@ -2071,13 +2071,13 @@ static int imx_serial_port_suspend_noirq(struct device *dev)
>>   	struct imx_port *sport = platform_get_drvdata(pdev);
>>   	int ret;
>>   
>> -	ret = clk_enable(sport->clk_ipg);
>> +	ret = clk_prepare_enable(sport->clk_ipg);
>>   	if (ret)
>>   		return ret;
>>   
>>   	serial_imx_save_context(sport);
>>   
>> -	clk_disable(sport->clk_ipg);
>> +	clk_disable_unprepare(sport->clk_ipg);
> 
> NAK.  If this is _noirq, then it's a context which can't sleep.  Therefore,
> calling functions that do sleep is not permitted.

That's not not exactly correct. At suspend_noirq time only SPI(device's) IRQs are disabled
while syscore (systimers, scheduler, main irq controllers, nonboot cpus) is still active.

-- 
regards,
-grygorii

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] serial: imx: Fix suspend / resume.
@ 2016-01-12 18:41     ` Grygorii Strashko
  0 siblings, 0 replies; 7+ messages in thread
From: Grygorii Strashko @ 2016-01-12 18:41 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Russell,

On 01/04/2016 09:10 PM, Russell King - ARM Linux wrote:
> On Mon, Jan 04, 2016 at 07:22:06PM +0100, Martin Fuzzey wrote:
>> diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
>> index 016e4be..16a551b 100644
>> --- a/drivers/tty/serial/imx.c
>> +++ b/drivers/tty/serial/imx.c
>> @@ -2071,13 +2071,13 @@ static int imx_serial_port_suspend_noirq(struct device *dev)
>>   	struct imx_port *sport = platform_get_drvdata(pdev);
>>   	int ret;
>>   
>> -	ret = clk_enable(sport->clk_ipg);
>> +	ret = clk_prepare_enable(sport->clk_ipg);
>>   	if (ret)
>>   		return ret;
>>   
>>   	serial_imx_save_context(sport);
>>   
>> -	clk_disable(sport->clk_ipg);
>> +	clk_disable_unprepare(sport->clk_ipg);
> 
> NAK.  If this is _noirq, then it's a context which can't sleep.  Therefore,
> calling functions that do sleep is not permitted.

That's not not exactly correct. At suspend_noirq time only SPI(device's) IRQs are disabled
while syscore (systimers, scheduler, main irq controllers, nonboot cpus) is still active.

-- 
regards,
-grygorii

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] serial: imx: Fix suspend / resume.
  2016-01-12 18:41     ` Grygorii Strashko
  (?)
@ 2016-03-29 11:38     ` Dirk
  -1 siblings, 0 replies; 7+ messages in thread
From: Dirk @ 2016-03-29 11:38 UTC (permalink / raw)
  To: linux-arm-kernel

Have you tried this patch:

http://lists.infradead.org/pipermail/linux-arm-kernel/2016-January/397389.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-03-29 11:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-04 18:22 [PATCH] serial: imx: Fix suspend / resume Martin Fuzzey
2016-01-04 18:22 ` Martin Fuzzey
2016-01-04 19:10 ` Russell King - ARM Linux
2016-01-04 19:10   ` Russell King - ARM Linux
2016-01-12 18:41   ` Grygorii Strashko
2016-01-12 18:41     ` Grygorii Strashko
2016-03-29 11:38     ` Dirk

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.