All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] ARM: mach-shmobile: sh7372 A4R suspend/resume order fix
@ 2011-11-09 18:23 Guennadi Liakhovetski
  2011-11-09 23:30 ` Rafael J. Wysocki
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Guennadi Liakhovetski @ 2011-11-09 18:23 UTC (permalink / raw)
  To: linux-sh

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.

Thanks to Magnus Damm for tracking this problem down and providing the 
initial fix and the commit description text.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
---

I took the liberty to reimplement the original fix by Magnus in a 
different way. I didn't quite like the idea of rewriting platform data, 
which could and, probably, should actually be const, on each 
domain-suspend. Instead, checking in resume, whether a valid state 
snapshot is available seemed a bit prettier to me:-) The maintainer is, of 
course, free to choose whichever version he prefers, they both

"Fix issue in v3.2-rc1 on the sh7372 Mackerel board."

diff --git a/arch/arm/mach-shmobile/intc-sh7372.c b/arch/arm/mach-shmobile/intc-sh7372.c
index 29cdc05..eeeb16b 100644
--- a/arch/arm/mach-shmobile/intc-sh7372.c
+++ b/arch/arm/mach-shmobile/intc-sh7372.c
@@ -627,6 +627,7 @@ void __init sh7372_init_irq(void)
 
 static unsigned short ffd2[0x200];
 static unsigned short ffd5[0x100];
+static bool intcs_state_saved = false;
 
 void sh7372_intcs_suspend(void)
 {
@@ -646,12 +647,17 @@ void sh7372_intcs_suspend(void)
 
 	for (k = 0x80; k <= 0x9c; k += 4)
 		ffd5[k] = __raw_readb(intcs_ffd5 + k);
+
+	intcs_state_saved = true;
 }
 
 void sh7372_intcs_resume(void)
 {
 	int k;
 
+	if (!intcs_state_saved)
+		return;
+
 	for (k = 0x00; k <= 0x30; k += 4)
 		__raw_writew(ffd2[k], intcs_ffd2 + k);
 

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

end of thread, other threads:[~2011-11-10  9:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-09 18:23 [PATCH v2] ARM: mach-shmobile: sh7372 A4R suspend/resume order fix Guennadi Liakhovetski
2011-11-09 23:30 ` Rafael J. Wysocki
2011-11-10  2:14 ` Magnus Damm
2011-11-10  3:47 ` Paul Mundt
2011-11-10  9:06 ` Rafael J. Wysocki

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.