All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: linux-sh@vger.kernel.org
Subject: Re: [PATCH] ARM: mach-shmobile: sh7372 A4R suspend/resume order fix
Date: Thu, 10 Nov 2011 12:05:56 +0000	[thread overview]
Message-ID: <201111101305.56887.rjw@sisk.pl> (raw)
In-Reply-To: <20110927085408.27727.59395.sendpatchset@w520>

On Wednesday, November 09, 2011, Magnus Damm wrote:
> From: Magnus Damm <damm@opensource.se>
> 
> Update the sh7372 A4R code to make sure the suspend
> callback gets to be called before the resume callback.
> 
> Without this fix the A4R resume callback is called before
> suspend. The resume callback restores the INTCS hardware
> registers with incorrect data which results in interrupts
> being masked when they shouldn't be. The user will notice
> this issue as IIC0 timing out during boot.
> 
> Reported-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> Signed-off-by: Magnus Damm <damm@opensource.se>

Well, I'd prefer to do something like the patch below instead.

Please let me know what you think.

Thanks,
Rafael

---
From: Rafael J. Wysocki <rjw@sisk.pl>
Subject: PM / shmobile: Avoid restoring the INTCS state during initialization

The SH7372 PM domain initialization routine calls pd_power_up()
that executes the domain's .resume() callback, if present, and for
the A4R domain this callback attepmts to restore the INTCS state from
uninitialized data.  To avoid that, introduce __pd_power_up() that
will only execute the domain's .resume() callback if its second
argument is 'true' and make the SH7372 PM domain initialization
use it with 'false' as its second argument.  Redefine pd_power_up()
as a wrapper around __pd_power_up().

Reported-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 arch/arm/mach-shmobile/pm-sh7372.c |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

Index: linux/arch/arm/mach-shmobile/pm-sh7372.c
=================================--- linux.orig/arch/arm/mach-shmobile/pm-sh7372.c
+++ linux/arch/arm/mach-shmobile/pm-sh7372.c
@@ -107,9 +107,8 @@ static int pd_power_down(struct generic_
 	return 0;
 }
 
-static int pd_power_up(struct generic_pm_domain *genpd)
+static int __pd_power_up(struct sh7372_pm_domain *sh7372_pd, bool do_resume)
 {
-	struct sh7372_pm_domain *sh7372_pd = to_sh7372_pd(genpd);
 	unsigned int mask = 1 << sh7372_pd->bit_shift;
 	unsigned int retry_count;
 	int ret = 0;
@@ -138,12 +137,17 @@ static int pd_power_up(struct generic_pm
 			 mask, __raw_readl(PSTR));
 
  out:
-	if (ret = 0 && sh7372_pd->resume)
+	if (ret = 0 && sh7372_pd->resume && do_resume)
 		sh7372_pd->resume();
 
 	return ret;
 }
 
+static int pd_power_up(struct generic_pm_domain *genpd)
+{
+	 return __pd_power_up(to_sh7372_pd(genpd), true);
+}
+
 static void sh7372_a4r_suspend(void)
 {
 	sh7372_intcs_suspend();
@@ -209,7 +213,7 @@ void sh7372_init_pm_domain(struct sh7372
 	genpd->dev_irq_safe = true;
 	genpd->power_off = pd_power_down;
 	genpd->power_on = pd_power_up;
-	genpd->power_on(&sh7372_pd->genpd);
+	__pd_power_up(sh7372_pd, false);
 }
 
 void sh7372_add_device_to_domain(struct sh7372_pm_domain *sh7372_pd,

  parent reply	other threads:[~2011-11-10 12:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-27  8:54 [PATCH] ARM: mach-shmobile: sh7372 A4R support V2 Magnus Damm
2011-10-16 21:03 ` Rafael J. Wysocki
2011-11-10 12:05 ` Rafael J. Wysocki [this message]
2011-11-11  1:07 ` [PATCH] ARM: mach-shmobile: sh7372 A4R suspend/resume order fix Magnus Damm
2011-11-11  7:49 ` Guennadi Liakhovetski
2011-11-11 11:58 ` Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201111101305.56887.rjw@sisk.pl \
    --to=rjw@sisk.pl \
    --cc=linux-sh@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.