SUPERH platform development
 help / color / mirror / Atom feed
From: Magnus Damm <magnus.damm@gmail.com>
To: linux-sh@vger.kernel.org
Subject: [PATCH] ARM: mach-shmobile: sh7372 A4S Mackerel debug hack
Date: Sun, 18 Dec 2011 17:03:06 +0000	[thread overview]
Message-ID: <20111218170306.20423.23533.sendpatchset@w520> (raw)

From: Magnus Damm <damm@opensource.se>

Add some quick debugging code on top of the A4S power domain
patch to allow serial printouts before and soon after the power
has been cut/restored. Duplicates the context restore code
located in the SCIF driver in a board specific fashion. Will
only work on Mackerel. Not for upstream inclusion.

Not-signed-off-by: Magnus Damm <damm@opensource.se>
---

 arch/arm/mach-shmobile/pm-sh7372.c |   17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

--- 0004/arch/arm/mach-shmobile/pm-sh7372.c
+++ work/arch/arm/mach-shmobile/pm-sh7372.c	2011-12-19 01:50:11.000000000 +0900
@@ -7,7 +7,7 @@
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  */
-
+#define DEBUG
 #include <linux/pm.h>
 #include <linux/suspend.h>
 #include <linux/cpuidle.h>
@@ -323,7 +323,9 @@ static int sh7372_sysc_valid(unsigned lo
 	mstpsr2 = __raw_readl(MSTPSR2);
 	if ((mstpsr2 & 0x000741ff) != 0x000741ff) {
 		pr_debug("sh7372 mstpsr2 0x%08lx\n", mstpsr2);
+#if 0 /* SCIF console clock will be on, ignore to debug low level A4S code */
 		return 0;
+#endif
 	}
 
 	mstpsr3 = __raw_readl(MSTPSR3);
@@ -475,11 +477,22 @@ static int sh7372_enter_suspend(suspend_
 		/* convert INTC mask and sense to SYSC mask and sense */
 		sh7372_setup_sysc(msk, msk2);
 
-		if (!sh7372_a3sp.stay_on &&
+		if (/*!sh7372_a3sp.stay_on && */
 		    sh7372_a4s.genpd.status = GPD_STATE_POWER_OFF) {
 			/* enter A4S sleep with PLLC0 off */
 			pr_debug("entering A4S\n");
 			sh7372_enter_a4s_common(0);
+
+			/* power up A3SP and setup SCIF console */
+			if (sh7372_a3sp.stay_on) {
+				sh7372_a3sp.stay_on = 0;
+				pd_power_up(&sh7372_a3sp.genpd);
+				sh7372_a3sp.stay_on = 1;
+				__raw_writew(0, 0xE6C40000); /* setup SCIF */
+				__raw_writeb(0x19, 0xE6C40004);
+				__raw_writew(0x0030, 0xE6C40008);
+				pr_debug("SCIF alive and kicking!\n");
+			}
 		} else {
 			/* enter A3SM sleep with PLLC0 off */
 			pr_debug("entering A3SM\n");

                 reply	other threads:[~2011-12-18 17:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20111218170306.20423.23533.sendpatchset@w520 \
    --to=magnus.damm@gmail.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox