All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] serial: of-serial: fix up PM ops on no_console_suspend
@ 2014-10-09  9:10 ` Jingchang Lu
  0 siblings, 0 replies; 16+ messages in thread
From: Jingchang Lu @ 2014-10-09  9:10 UTC (permalink / raw)
  To: gregkh
  Cc: arnd, linux-serial, linux-arm-kernel, linux-kernel, Jingchang Lu,
	Joseph Lo

Mandatorily disabling the uart clock will cause register access
hung on "no_console_suspend". This patch add condition check on
it and only disable the clock with console_suspend_enabled true.

Signed-off-by: Joseph Lo <josephl@nvidia.com>
Signed-off-by: Jingchang Lu <jingchang.lu@freescale.com>
---
 drivers/tty/serial/of_serial.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/of_serial.c b/drivers/tty/serial/of_serial.c
index 8bc2563..a765399 100644
--- a/drivers/tty/serial/of_serial.c
+++ b/drivers/tty/serial/of_serial.c
@@ -246,7 +246,7 @@ static int of_serial_suspend(struct device *dev)
 	struct of_serial_info *info = dev_get_drvdata(dev);
 
 	serial8250_suspend_port(info->line);
-	if (info->clk)
+	if (info->clk && console_suspend_enabled)
 		clk_disable_unprepare(info->clk);
 
 	return 0;
@@ -256,7 +256,7 @@ static int of_serial_resume(struct device *dev)
 {
 	struct of_serial_info *info = dev_get_drvdata(dev);
 
-	if (info->clk)
+	if (info->clk && console_suspend_enabled)
 		clk_prepare_enable(info->clk);
 
 	serial8250_resume_port(info->line);
-- 
1.8.0


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

* [PATCH] serial: of-serial: fix up PM ops on no_console_suspend
@ 2014-10-09  9:10 ` Jingchang Lu
  0 siblings, 0 replies; 16+ messages in thread
From: Jingchang Lu @ 2014-10-09  9:10 UTC (permalink / raw)
  To: gregkh
  Cc: arnd, Joseph Lo, linux-kernel, linux-serial, Jingchang Lu,
	linux-arm-kernel

Mandatorily disabling the uart clock will cause register access
hung on "no_console_suspend". This patch add condition check on
it and only disable the clock with console_suspend_enabled true.

Signed-off-by: Joseph Lo <josephl@nvidia.com>
Signed-off-by: Jingchang Lu <jingchang.lu@freescale.com>
---
 drivers/tty/serial/of_serial.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/of_serial.c b/drivers/tty/serial/of_serial.c
index 8bc2563..a765399 100644
--- a/drivers/tty/serial/of_serial.c
+++ b/drivers/tty/serial/of_serial.c
@@ -246,7 +246,7 @@ static int of_serial_suspend(struct device *dev)
 	struct of_serial_info *info = dev_get_drvdata(dev);
 
 	serial8250_suspend_port(info->line);
-	if (info->clk)
+	if (info->clk && console_suspend_enabled)
 		clk_disable_unprepare(info->clk);
 
 	return 0;
@@ -256,7 +256,7 @@ static int of_serial_resume(struct device *dev)
 {
 	struct of_serial_info *info = dev_get_drvdata(dev);
 
-	if (info->clk)
+	if (info->clk && console_suspend_enabled)
 		clk_prepare_enable(info->clk);
 
 	serial8250_resume_port(info->line);
-- 
1.8.0

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

* [PATCH] serial: of-serial: fix up PM ops on no_console_suspend
@ 2014-10-09  9:10 ` Jingchang Lu
  0 siblings, 0 replies; 16+ messages in thread
From: Jingchang Lu @ 2014-10-09  9:10 UTC (permalink / raw)
  To: linux-arm-kernel

Mandatorily disabling the uart clock will cause register access
hung on "no_console_suspend". This patch add condition check on
it and only disable the clock with console_suspend_enabled true.

Signed-off-by: Joseph Lo <josephl@nvidia.com>
Signed-off-by: Jingchang Lu <jingchang.lu@freescale.com>
---
 drivers/tty/serial/of_serial.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/of_serial.c b/drivers/tty/serial/of_serial.c
index 8bc2563..a765399 100644
--- a/drivers/tty/serial/of_serial.c
+++ b/drivers/tty/serial/of_serial.c
@@ -246,7 +246,7 @@ static int of_serial_suspend(struct device *dev)
 	struct of_serial_info *info = dev_get_drvdata(dev);
 
 	serial8250_suspend_port(info->line);
-	if (info->clk)
+	if (info->clk && console_suspend_enabled)
 		clk_disable_unprepare(info->clk);
 
 	return 0;
@@ -256,7 +256,7 @@ static int of_serial_resume(struct device *dev)
 {
 	struct of_serial_info *info = dev_get_drvdata(dev);
 
-	if (info->clk)
+	if (info->clk && console_suspend_enabled)
 		clk_prepare_enable(info->clk);
 
 	serial8250_resume_port(info->line);
-- 
1.8.0

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

* Re: [PATCH] serial: of-serial: fix up PM ops on no_console_suspend
  2014-10-09  9:10 ` Jingchang Lu
@ 2014-10-10  5:04   ` Stephen Warren
  -1 siblings, 0 replies; 16+ messages in thread
From: Stephen Warren @ 2014-10-10  5:04 UTC (permalink / raw)
  To: Jingchang Lu, gregkh
  Cc: arnd, Joseph Lo, linux-kernel, linux-serial, linux-arm-kernel

On 10/09/2014 02:10 AM, Jingchang Lu wrote:
> Mandatorily disabling the uart clock will cause register access
> hung on "no_console_suspend". This patch add condition check on
> it and only disable the clock with console_suspend_enabled true.

It would be useful if the email/patch subject line said "V2", and there
was a changelog below.

> Signed-off-by: Joseph Lo <josephl@nvidia.com>

I don't think he did; he just suggested a small fix.

> Signed-off-by: Jingchang Lu <jingchang.lu@freescale.com>
> ---
>  drivers/tty/serial/of_serial.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/tty/serial/of_serial.c b/drivers/tty/serial/of_serial.c
...

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

* [PATCH] serial: of-serial: fix up PM ops on no_console_suspend
@ 2014-10-10  5:04   ` Stephen Warren
  0 siblings, 0 replies; 16+ messages in thread
From: Stephen Warren @ 2014-10-10  5:04 UTC (permalink / raw)
  To: linux-arm-kernel

On 10/09/2014 02:10 AM, Jingchang Lu wrote:
> Mandatorily disabling the uart clock will cause register access
> hung on "no_console_suspend". This patch add condition check on
> it and only disable the clock with console_suspend_enabled true.

It would be useful if the email/patch subject line said "V2", and there
was a changelog below.

> Signed-off-by: Joseph Lo <josephl@nvidia.com>

I don't think he did; he just suggested a small fix.

> Signed-off-by: Jingchang Lu <jingchang.lu@freescale.com>
> ---
>  drivers/tty/serial/of_serial.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/tty/serial/of_serial.c b/drivers/tty/serial/of_serial.c
...

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

* RE: [PATCH] serial: of-serial: fix up PM ops on no_console_suspend
  2014-10-10  5:04   ` Stephen Warren
  (?)
@ 2014-10-10  6:16     ` Jingchang Lu
  -1 siblings, 0 replies; 16+ messages in thread
From: Jingchang Lu @ 2014-10-10  6:16 UTC (permalink / raw)
  To: Stephen Warren, gregkh
  Cc: arnd, Joseph Lo, linux-kernel, linux-serial, linux-arm-kernel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 1119 bytes --]

>-----Original Message-----
>From: Stephen Warren [mailto:swarren@wwwdotorg.org]
>Sent: Friday, October 10, 2014 1:05 PM
>To: Lu Jingchang-B35083; gregkh@linuxfoundation.org
>Cc: arnd@arndb.de; Joseph Lo; linux-kernel@vger.kernel.org; linux-
>serial@vger.kernel.org; linux-arm-kernel@lists.infradead.org
>Subject: Re: [PATCH] serial: of-serial: fix up PM ops on
>no_console_suspend
>
>On 10/09/2014 02:10 AM, Jingchang Lu wrote:
>> Mandatorily disabling the uart clock will cause register access hung
>> on "no_console_suspend". This patch add condition check on it and only
>> disable the clock with console_suspend_enabled true.
>
>It would be useful if the email/patch subject line said "V2", and there
>was a changelog below.
This is not a v2, patch "serial: of-serial: add PM suspend/resume support
(commit 2dea53bf57783f243c892e99c10c6921e956aa7e)" has been merged into
linux-next tree, this is a fixup on that PM ops.
Thanks.

Best Regards,
Jingchang 
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

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

* RE: [PATCH] serial: of-serial: fix up PM ops on no_console_suspend
@ 2014-10-10  6:16     ` Jingchang Lu
  0 siblings, 0 replies; 16+ messages in thread
From: Jingchang Lu @ 2014-10-10  6:16 UTC (permalink / raw)
  To: Stephen Warren, gregkh
  Cc: arnd, Joseph Lo, linux-kernel, linux-serial, linux-arm-kernel

>-----Original Message-----
>From: Stephen Warren [mailto:swarren@wwwdotorg.org]
>Sent: Friday, October 10, 2014 1:05 PM
>To: Lu Jingchang-B35083; gregkh@linuxfoundation.org
>Cc: arnd@arndb.de; Joseph Lo; linux-kernel@vger.kernel.org; linux-
>serial@vger.kernel.org; linux-arm-kernel@lists.infradead.org
>Subject: Re: [PATCH] serial: of-serial: fix up PM ops on
>no_console_suspend
>
>On 10/09/2014 02:10 AM, Jingchang Lu wrote:
>> Mandatorily disabling the uart clock will cause register access hung
>> on "no_console_suspend". This patch add condition check on it and only
>> disable the clock with console_suspend_enabled true.
>
>It would be useful if the email/patch subject line said "V2", and there
>was a changelog below.
This is not a v2, patch "serial: of-serial: add PM suspend/resume support
(commit 2dea53bf57783f243c892e99c10c6921e956aa7e)" has been merged into
linux-next tree, this is a fixup on that PM ops.
Thanks.

Best Regards,
Jingchang 

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

* [PATCH] serial: of-serial: fix up PM ops on no_console_suspend
@ 2014-10-10  6:16     ` Jingchang Lu
  0 siblings, 0 replies; 16+ messages in thread
From: Jingchang Lu @ 2014-10-10  6:16 UTC (permalink / raw)
  To: linux-arm-kernel

>-----Original Message-----
>From: Stephen Warren [mailto:swarren at wwwdotorg.org]
>Sent: Friday, October 10, 2014 1:05 PM
>To: Lu Jingchang-B35083; gregkh at linuxfoundation.org
>Cc: arnd at arndb.de; Joseph Lo; linux-kernel at vger.kernel.org; linux-
>serial at vger.kernel.org; linux-arm-kernel at lists.infradead.org
>Subject: Re: [PATCH] serial: of-serial: fix up PM ops on
>no_console_suspend
>
>On 10/09/2014 02:10 AM, Jingchang Lu wrote:
>> Mandatorily disabling the uart clock will cause register access hung
>> on "no_console_suspend". This patch add condition check on it and only
>> disable the clock with console_suspend_enabled true.
>
>It would be useful if the email/patch subject line said "V2", and there
>was a changelog below.
This is not a v2, patch "serial: of-serial: add PM suspend/resume support
(commit 2dea53bf57783f243c892e99c10c6921e956aa7e)" has been merged into
linux-next tree, this is a fixup on that PM ops.
Thanks.

Best Regards,
Jingchang 

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

* Re: [PATCH] serial: of-serial: fix up PM ops on no_console_suspend
  2014-10-10  6:16     ` Jingchang Lu
  (?)
@ 2014-10-10 10:25       ` Peter Hurley
  -1 siblings, 0 replies; 16+ messages in thread
From: Peter Hurley @ 2014-10-10 10:25 UTC (permalink / raw)
  To: Jingchang Lu, Stephen Warren, gregkh
  Cc: arnd, Joseph Lo, linux-kernel, linux-serial, linux-arm-kernel

On 10/10/2014 02:16 AM, Jingchang Lu wrote:
>> From: Stephen Warren [mailto:swarren@wwwdotorg.org]
>> On 10/09/2014 02:10 AM, Jingchang Lu wrote:
>>> Mandatorily disabling the uart clock will cause register access hung
>>> on "no_console_suspend". This patch add condition check on it and only
>>> disable the clock with console_suspend_enabled true.
>>
>> It would be useful if the email/patch subject line said "V2", and there
>> was a changelog below.
> This is not a v2, patch "serial: of-serial: add PM suspend/resume support
> (commit 2dea53bf57783f243c892e99c10c6921e956aa7e)" has been merged into
> linux-next tree, this is a fixup on that PM ops.

Then please say so in the commit log. Something like,

Fix commit 2dea53bf57783f243c892e99c10c6921e956aa7e,
"serial: of-serial: add PM suspend/resume support", which
disables the uart clock on suspend, but also causes a hardware
hang on register access if no_console_suspend command line option
is used.

Regards,
Peter Hurley


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

* Re: [PATCH] serial: of-serial: fix up PM ops on no_console_suspend
@ 2014-10-10 10:25       ` Peter Hurley
  0 siblings, 0 replies; 16+ messages in thread
From: Peter Hurley @ 2014-10-10 10:25 UTC (permalink / raw)
  To: Jingchang Lu, Stephen Warren, gregkh
  Cc: arnd, Joseph Lo, linux-kernel, linux-serial, linux-arm-kernel

On 10/10/2014 02:16 AM, Jingchang Lu wrote:
>> From: Stephen Warren [mailto:swarren@wwwdotorg.org]
>> On 10/09/2014 02:10 AM, Jingchang Lu wrote:
>>> Mandatorily disabling the uart clock will cause register access hung
>>> on "no_console_suspend". This patch add condition check on it and only
>>> disable the clock with console_suspend_enabled true.
>>
>> It would be useful if the email/patch subject line said "V2", and there
>> was a changelog below.
> This is not a v2, patch "serial: of-serial: add PM suspend/resume support
> (commit 2dea53bf57783f243c892e99c10c6921e956aa7e)" has been merged into
> linux-next tree, this is a fixup on that PM ops.

Then please say so in the commit log. Something like,

Fix commit 2dea53bf57783f243c892e99c10c6921e956aa7e,
"serial: of-serial: add PM suspend/resume support", which
disables the uart clock on suspend, but also causes a hardware
hang on register access if no_console_suspend command line option
is used.

Regards,
Peter Hurley


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

* [PATCH] serial: of-serial: fix up PM ops on no_console_suspend
@ 2014-10-10 10:25       ` Peter Hurley
  0 siblings, 0 replies; 16+ messages in thread
From: Peter Hurley @ 2014-10-10 10:25 UTC (permalink / raw)
  To: linux-arm-kernel

On 10/10/2014 02:16 AM, Jingchang Lu wrote:
>> From: Stephen Warren [mailto:swarren at wwwdotorg.org]
>> On 10/09/2014 02:10 AM, Jingchang Lu wrote:
>>> Mandatorily disabling the uart clock will cause register access hung
>>> on "no_console_suspend". This patch add condition check on it and only
>>> disable the clock with console_suspend_enabled true.
>>
>> It would be useful if the email/patch subject line said "V2", and there
>> was a changelog below.
> This is not a v2, patch "serial: of-serial: add PM suspend/resume support
> (commit 2dea53bf57783f243c892e99c10c6921e956aa7e)" has been merged into
> linux-next tree, this is a fixup on that PM ops.

Then please say so in the commit log. Something like,

Fix commit 2dea53bf57783f243c892e99c10c6921e956aa7e,
"serial: of-serial: add PM suspend/resume support", which
disables the uart clock on suspend, but also causes a hardware
hang on register access if no_console_suspend command line option
is used.

Regards,
Peter Hurley

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

* Re: [PATCH] serial: of-serial: fix up PM ops on no_console_suspend
  2014-10-09  9:10 ` Jingchang Lu
@ 2014-10-10 11:39   ` Peter Hurley
  -1 siblings, 0 replies; 16+ messages in thread
From: Peter Hurley @ 2014-10-10 11:39 UTC (permalink / raw)
  To: Jingchang Lu, gregkh
  Cc: arnd, linux-serial, linux-arm-kernel, linux-kernel, Joseph Lo

Hi Jingchang,

On 10/09/2014 05:10 AM, Jingchang Lu wrote:
> Mandatorily disabling the uart clock will cause register access
> hung on "no_console_suspend". This patch add condition check on
> it and only disable the clock with console_suspend_enabled true.
> 
> Signed-off-by: Joseph Lo <josephl@nvidia.com>
> Signed-off-by: Jingchang Lu <jingchang.lu@freescale.com>
> ---
>  drivers/tty/serial/of_serial.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/tty/serial/of_serial.c b/drivers/tty/serial/of_serial.c
> index 8bc2563..a765399 100644
> --- a/drivers/tty/serial/of_serial.c
> +++ b/drivers/tty/serial/of_serial.c
> @@ -246,7 +246,7 @@ static int of_serial_suspend(struct device *dev)
>  	struct of_serial_info *info = dev_get_drvdata(dev);
>  
>  	serial8250_suspend_port(info->line);
> -	if (info->clk)
> +	if (info->clk && console_suspend_enabled)
>  		clk_disable_unprepare(info->clk);

This needs to check that _this_ port is the console port, like:

	if (info->clk && uart_console(port) && and console_suspend_enabled)
		clk_disable_unprepare(info->clk);

which means you need something like:

	struct uart_8250_port *uart = serial8250_get_port(info->line);
	struct uart_port *port = &uart->port;

Also, there's another problem with your original patch:
not every of_serial device is an 8250, right?
serial8250_suspend_port() on a port that's not registered with 8250 core
is probably going to blow up.

Which means the body of of_platform_suspend() and of_platform_resume()
should probably look like

	switch (info->type) {
#ifdef CONFIG_SERIAL_8250
	case PORT_8250 ... PORT_MAX_8250:
	{
		/* current body of function */
	}
#endif
	default:
	}

Regards,
Peter Hurley


>  
>  	return 0;
> @@ -256,7 +256,7 @@ static int of_serial_resume(struct device *dev)
>  {
>  	struct of_serial_info *info = dev_get_drvdata(dev);
>  
> -	if (info->clk)
> +	if (info->clk && console_suspend_enabled)
>  		clk_prepare_enable(info->clk);
>  
>  	serial8250_resume_port(info->line);
> 


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

* [PATCH] serial: of-serial: fix up PM ops on no_console_suspend
@ 2014-10-10 11:39   ` Peter Hurley
  0 siblings, 0 replies; 16+ messages in thread
From: Peter Hurley @ 2014-10-10 11:39 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Jingchang,

On 10/09/2014 05:10 AM, Jingchang Lu wrote:
> Mandatorily disabling the uart clock will cause register access
> hung on "no_console_suspend". This patch add condition check on
> it and only disable the clock with console_suspend_enabled true.
> 
> Signed-off-by: Joseph Lo <josephl@nvidia.com>
> Signed-off-by: Jingchang Lu <jingchang.lu@freescale.com>
> ---
>  drivers/tty/serial/of_serial.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/tty/serial/of_serial.c b/drivers/tty/serial/of_serial.c
> index 8bc2563..a765399 100644
> --- a/drivers/tty/serial/of_serial.c
> +++ b/drivers/tty/serial/of_serial.c
> @@ -246,7 +246,7 @@ static int of_serial_suspend(struct device *dev)
>  	struct of_serial_info *info = dev_get_drvdata(dev);
>  
>  	serial8250_suspend_port(info->line);
> -	if (info->clk)
> +	if (info->clk && console_suspend_enabled)
>  		clk_disable_unprepare(info->clk);

This needs to check that _this_ port is the console port, like:

	if (info->clk && uart_console(port) && and console_suspend_enabled)
		clk_disable_unprepare(info->clk);

which means you need something like:

	struct uart_8250_port *uart = serial8250_get_port(info->line);
	struct uart_port *port = &uart->port;

Also, there's another problem with your original patch:
not every of_serial device is an 8250, right?
serial8250_suspend_port() on a port that's not registered with 8250 core
is probably going to blow up.

Which means the body of of_platform_suspend() and of_platform_resume()
should probably look like

	switch (info->type) {
#ifdef CONFIG_SERIAL_8250
	case PORT_8250 ... PORT_MAX_8250:
	{
		/* current body of function */
	}
#endif
	default:
	}

Regards,
Peter Hurley


>  
>  	return 0;
> @@ -256,7 +256,7 @@ static int of_serial_resume(struct device *dev)
>  {
>  	struct of_serial_info *info = dev_get_drvdata(dev);
>  
> -	if (info->clk)
> +	if (info->clk && console_suspend_enabled)
>  		clk_prepare_enable(info->clk);
>  
>  	serial8250_resume_port(info->line);
> 

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

* RE: [PATCH] serial: of-serial: fix up PM ops on no_console_suspend
  2014-10-10 11:39   ` Peter Hurley
  (?)
@ 2014-10-11  3:37     ` Jingchang Lu
  -1 siblings, 0 replies; 16+ messages in thread
From: Jingchang Lu @ 2014-10-11  3:37 UTC (permalink / raw)
  To: Peter Hurley, gregkh
  Cc: arnd, linux-serial, linux-arm-kernel, linux-kernel, Joseph Lo

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 2787 bytes --]

>-----Original Message-----
>From: Peter Hurley [mailto:peter@hurleysoftware.com]
>Sent: Friday, October 10, 2014 7:39 PM
>To: Lu Jingchang-B35083; gregkh@linuxfoundation.org
>Cc: arnd@arndb.de; linux-serial@vger.kernel.org; linux-arm-
>kernel@lists.infradead.org; linux-kernel@vger.kernel.org; Joseph Lo
>Subject: Re: [PATCH] serial: of-serial: fix up PM ops on
>no_console_suspend
>
>Hi Jingchang,
>
>On 10/09/2014 05:10 AM, Jingchang Lu wrote:
>> Mandatorily disabling the uart clock will cause register access hung
>> on "no_console_suspend". This patch add condition check on it and only
>> disable the clock with console_suspend_enabled true.
>>
>> Signed-off-by: Joseph Lo <josephl@nvidia.com>
>> Signed-off-by: Jingchang Lu <jingchang.lu@freescale.com>
>> ---
>>  drivers/tty/serial/of_serial.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/tty/serial/of_serial.c
>> b/drivers/tty/serial/of_serial.c index 8bc2563..a765399 100644
>> --- a/drivers/tty/serial/of_serial.c
>> +++ b/drivers/tty/serial/of_serial.c
>> @@ -246,7 +246,7 @@ static int of_serial_suspend(struct device *dev)
>>  	struct of_serial_info *info = dev_get_drvdata(dev);
>>
>>  	serial8250_suspend_port(info->line);
>> -	if (info->clk)
>> +	if (info->clk && console_suspend_enabled)
>>  		clk_disable_unprepare(info->clk);
>
>This needs to check that _this_ port is the console port, like:
>
>	if (info->clk && uart_console(port) && and console_suspend_enabled)
>		clk_disable_unprepare(info->clk);
>
>which means you need something like:
>
>	struct uart_8250_port *uart = serial8250_get_port(info->line);
>	struct uart_port *port = &uart->port;
>
>Also, there's another problem with your original patch:
>not every of_serial device is an 8250, right?
>serial8250_suspend_port() on a port that's not registered with 8250 core
>is probably going to blow up.
>
>Which means the body of of_platform_suspend() and of_platform_resume()
>should probably look like
>
>	switch (info->type) {
>#ifdef CONFIG_SERIAL_8250
>	case PORT_8250 ... PORT_MAX_8250:
>	{
>		/* current body of function */
>	}
>#endif
>	default:
>	}
>
Yes, this should be considered, then serial8250_get_port(info->line) for uart_console() also
should be put in this type switch,  Thanks.

Best Regards,
Jingchang

>Regards,
>Peter Hurley
>
>
>>
>>  	return 0;
>> @@ -256,7 +256,7 @@ static int of_serial_resume(struct device *dev)  {
>>  	struct of_serial_info *info = dev_get_drvdata(dev);
>>
>> -	if (info->clk)
>> +	if (info->clk && console_suspend_enabled)
>>  		clk_prepare_enable(info->clk);
>>
>>  	serial8250_resume_port(info->line);
>>

ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

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

* RE: [PATCH] serial: of-serial: fix up PM ops on no_console_suspend
@ 2014-10-11  3:37     ` Jingchang Lu
  0 siblings, 0 replies; 16+ messages in thread
From: Jingchang Lu @ 2014-10-11  3:37 UTC (permalink / raw)
  To: Peter Hurley, gregkh
  Cc: arnd, linux-serial, linux-arm-kernel, linux-kernel, Joseph Lo

>-----Original Message-----
>From: Peter Hurley [mailto:peter@hurleysoftware.com]
>Sent: Friday, October 10, 2014 7:39 PM
>To: Lu Jingchang-B35083; gregkh@linuxfoundation.org
>Cc: arnd@arndb.de; linux-serial@vger.kernel.org; linux-arm-
>kernel@lists.infradead.org; linux-kernel@vger.kernel.org; Joseph Lo
>Subject: Re: [PATCH] serial: of-serial: fix up PM ops on
>no_console_suspend
>
>Hi Jingchang,
>
>On 10/09/2014 05:10 AM, Jingchang Lu wrote:
>> Mandatorily disabling the uart clock will cause register access hung
>> on "no_console_suspend". This patch add condition check on it and only
>> disable the clock with console_suspend_enabled true.
>>
>> Signed-off-by: Joseph Lo <josephl@nvidia.com>
>> Signed-off-by: Jingchang Lu <jingchang.lu@freescale.com>
>> ---
>>  drivers/tty/serial/of_serial.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/tty/serial/of_serial.c
>> b/drivers/tty/serial/of_serial.c index 8bc2563..a765399 100644
>> --- a/drivers/tty/serial/of_serial.c
>> +++ b/drivers/tty/serial/of_serial.c
>> @@ -246,7 +246,7 @@ static int of_serial_suspend(struct device *dev)
>>  	struct of_serial_info *info = dev_get_drvdata(dev);
>>
>>  	serial8250_suspend_port(info->line);
>> -	if (info->clk)
>> +	if (info->clk && console_suspend_enabled)
>>  		clk_disable_unprepare(info->clk);
>
>This needs to check that _this_ port is the console port, like:
>
>	if (info->clk && uart_console(port) && and console_suspend_enabled)
>		clk_disable_unprepare(info->clk);
>
>which means you need something like:
>
>	struct uart_8250_port *uart = serial8250_get_port(info->line);
>	struct uart_port *port = &uart->port;
>
>Also, there's another problem with your original patch:
>not every of_serial device is an 8250, right?
>serial8250_suspend_port() on a port that's not registered with 8250 core
>is probably going to blow up.
>
>Which means the body of of_platform_suspend() and of_platform_resume()
>should probably look like
>
>	switch (info->type) {
>#ifdef CONFIG_SERIAL_8250
>	case PORT_8250 ... PORT_MAX_8250:
>	{
>		/* current body of function */
>	}
>#endif
>	default:
>	}
>
Yes, this should be considered, then serial8250_get_port(info->line) for uart_console() also
should be put in this type switch,  Thanks.

Best Regards,
Jingchang

>Regards,
>Peter Hurley
>
>
>>
>>  	return 0;
>> @@ -256,7 +256,7 @@ static int of_serial_resume(struct device *dev)  {
>>  	struct of_serial_info *info = dev_get_drvdata(dev);
>>
>> -	if (info->clk)
>> +	if (info->clk && console_suspend_enabled)
>>  		clk_prepare_enable(info->clk);
>>
>>  	serial8250_resume_port(info->line);
>>


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

* [PATCH] serial: of-serial: fix up PM ops on no_console_suspend
@ 2014-10-11  3:37     ` Jingchang Lu
  0 siblings, 0 replies; 16+ messages in thread
From: Jingchang Lu @ 2014-10-11  3:37 UTC (permalink / raw)
  To: linux-arm-kernel

>-----Original Message-----
>From: Peter Hurley [mailto:peter at hurleysoftware.com]
>Sent: Friday, October 10, 2014 7:39 PM
>To: Lu Jingchang-B35083; gregkh at linuxfoundation.org
>Cc: arnd at arndb.de; linux-serial at vger.kernel.org; linux-arm-
>kernel at lists.infradead.org; linux-kernel at vger.kernel.org; Joseph Lo
>Subject: Re: [PATCH] serial: of-serial: fix up PM ops on
>no_console_suspend
>
>Hi Jingchang,
>
>On 10/09/2014 05:10 AM, Jingchang Lu wrote:
>> Mandatorily disabling the uart clock will cause register access hung
>> on "no_console_suspend". This patch add condition check on it and only
>> disable the clock with console_suspend_enabled true.
>>
>> Signed-off-by: Joseph Lo <josephl@nvidia.com>
>> Signed-off-by: Jingchang Lu <jingchang.lu@freescale.com>
>> ---
>>  drivers/tty/serial/of_serial.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/tty/serial/of_serial.c
>> b/drivers/tty/serial/of_serial.c index 8bc2563..a765399 100644
>> --- a/drivers/tty/serial/of_serial.c
>> +++ b/drivers/tty/serial/of_serial.c
>> @@ -246,7 +246,7 @@ static int of_serial_suspend(struct device *dev)
>>  	struct of_serial_info *info = dev_get_drvdata(dev);
>>
>>  	serial8250_suspend_port(info->line);
>> -	if (info->clk)
>> +	if (info->clk && console_suspend_enabled)
>>  		clk_disable_unprepare(info->clk);
>
>This needs to check that _this_ port is the console port, like:
>
>	if (info->clk && uart_console(port) && and console_suspend_enabled)
>		clk_disable_unprepare(info->clk);
>
>which means you need something like:
>
>	struct uart_8250_port *uart = serial8250_get_port(info->line);
>	struct uart_port *port = &uart->port;
>
>Also, there's another problem with your original patch:
>not every of_serial device is an 8250, right?
>serial8250_suspend_port() on a port that's not registered with 8250 core
>is probably going to blow up.
>
>Which means the body of of_platform_suspend() and of_platform_resume()
>should probably look like
>
>	switch (info->type) {
>#ifdef CONFIG_SERIAL_8250
>	case PORT_8250 ... PORT_MAX_8250:
>	{
>		/* current body of function */
>	}
>#endif
>	default:
>	}
>
Yes, this should be considered, then serial8250_get_port(info->line) for uart_console() also
should be put in this type switch,  Thanks.

Best Regards,
Jingchang

>Regards,
>Peter Hurley
>
>
>>
>>  	return 0;
>> @@ -256,7 +256,7 @@ static int of_serial_resume(struct device *dev)  {
>>  	struct of_serial_info *info = dev_get_drvdata(dev);
>>
>> -	if (info->clk)
>> +	if (info->clk && console_suspend_enabled)
>>  		clk_prepare_enable(info->clk);
>>
>>  	serial8250_resume_port(info->line);
>>

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

end of thread, other threads:[~2014-10-11  3:37 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-09  9:10 [PATCH] serial: of-serial: fix up PM ops on no_console_suspend Jingchang Lu
2014-10-09  9:10 ` Jingchang Lu
2014-10-09  9:10 ` Jingchang Lu
2014-10-10  5:04 ` Stephen Warren
2014-10-10  5:04   ` Stephen Warren
2014-10-10  6:16   ` Jingchang Lu
2014-10-10  6:16     ` Jingchang Lu
2014-10-10  6:16     ` Jingchang Lu
2014-10-10 10:25     ` Peter Hurley
2014-10-10 10:25       ` Peter Hurley
2014-10-10 10:25       ` Peter Hurley
2014-10-10 11:39 ` Peter Hurley
2014-10-10 11:39   ` Peter Hurley
2014-10-11  3:37   ` Jingchang Lu
2014-10-11  3:37     ` Jingchang Lu
2014-10-11  3:37     ` Jingchang Lu

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.