Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: paul@pwsan.com (Paul Walmsley)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 11/11] OMAP3: control/PM: move padconf save code to mach-omap2/control.c
Date: Tue, 07 Dec 2010 23:18:45 -0700	[thread overview]
Message-ID: <20101208061844.30541.27788.stgit@twilight.localdomain> (raw)
In-Reply-To: <20101208061657.30541.79824.stgit@twilight.localdomain>

Move the padconf save code from pm34xx.c to the System Control Module
code in mach-omap2/control.c.  This is part of the general push to
move direct register access from middle-layer core code to low-level
core code, so the middle-layer code can be abstracted to work on
multiple platforms and cleaned up.

In the medium-to-long term, this code should be called by the mux
layer code, not the PM idle code.  This is because, according to the
TRM, saving the padconf only needs to be done when the padconf
changes[1].

Signed-off-by: Paul Walmsley <paul@pwsan.com>
Cc: Kevin Hilman <khilman@deeprootsystems.com>
Cc: Tony Lindgren <tony@atomide.com>

1. OMAP34xx Multimedia Device Silicon Revision 3.1.x [Rev. ZH] [SWPU222H]
   Section 4.11.4 "Device Off-Mode Sequences"
---
 arch/arm/mach-omap2/control.c          |   32 ++++++++++++++++++++++++++++++++
 arch/arm/mach-omap2/control.h          |    1 +
 arch/arm/mach-omap2/pm34xx.c           |   11 +----------
 arch/arm/plat-omap/include/plat/prcm.h |    3 ---
 4 files changed, 34 insertions(+), 13 deletions(-)

diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c
index 16bde76..891df18 100644
--- a/arch/arm/mach-omap2/control.c
+++ b/arch/arm/mach-omap2/control.c
@@ -26,6 +26,10 @@
 #include "pm.h"
 #include "control.h"
 
+/* Used by omap3_ctrl_save_padconf() */
+#define START_PADCONF_SAVE		0x2
+#define PADCONF_SAVE_DONE		0x1
+
 static void __iomem *omap2_ctrl_base;
 static void __iomem *omap4_ctrl_pad_base;
 
@@ -512,4 +516,32 @@ void omap3_control_restore_context(void)
 			 OMAP343X_CONTROL_PADCONF_SYSNIRQ);
 	return;
 }
+
+/**
+ * omap3_ctrl_save_padconf - save padconf registers to scratchpad RAM
+ *
+ * Tell the SCM to start saving the padconf registers, then wait for
+ * the process to complete.  Returns 0 unconditionally, although it
+ * should also eventually be able to return -ETIMEDOUT, if the save
+ * does not complete.
+ *
+ * XXX This function is missing a timeout.  What should it be?
+ */
+int omap3_ctrl_save_padconf(void)
+{
+	u32 cpo;
+
+	/* Save the padconf registers */
+	cpo = omap_ctrl_readl(OMAP343X_CONTROL_PADCONF_OFF);
+	cpo |= START_PADCONF_SAVE;
+	omap_ctrl_writel(cpo, OMAP343X_CONTROL_PADCONF_OFF);
+
+	/* wait for the save to complete */
+	while (!(omap_ctrl_readl(OMAP343X_CONTROL_GENERAL_PURPOSE_STATUS)
+		 & PADCONF_SAVE_DONE))
+		udelay(1);
+
+	return 0;
+}
+
 #endif /* CONFIG_ARCH_OMAP3 && CONFIG_PM */
diff --git a/arch/arm/mach-omap2/control.h b/arch/arm/mach-omap2/control.h
index a9325ad..5289461 100644
--- a/arch/arm/mach-omap2/control.h
+++ b/arch/arm/mach-omap2/control.h
@@ -351,6 +351,7 @@ extern u32 omap3_arm_context[128];
 extern void omap3_control_save_context(void);
 extern void omap3_control_restore_context(void);
 extern void omap3_ctrl_write_boot_mode(u8 bootmode);
+extern int omap3_ctrl_save_padconf(void);
 
 #else
 #define omap_ctrl_base_get()		0
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index e804a9f..be755a6 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -117,16 +117,7 @@ static void omap3_disable_io_chain(void)
 
 static void omap3_core_save_context(void)
 {
-	u32 control_padconf_off;
-
-	/* Save the padconf registers */
-	control_padconf_off = omap_ctrl_readl(OMAP343X_CONTROL_PADCONF_OFF);
-	control_padconf_off |= START_PADCONF_SAVE;
-	omap_ctrl_writel(control_padconf_off, OMAP343X_CONTROL_PADCONF_OFF);
-	/* wait for the save to complete */
-	while (!(omap_ctrl_readl(OMAP343X_CONTROL_GENERAL_PURPOSE_STATUS)
-			& PADCONF_SAVE_DONE))
-		udelay(1);
+	omap3_ctrl_save_padconf();
 
 	/*
 	 * Force write last pad into memory, as this can fail in some
diff --git a/arch/arm/plat-omap/include/plat/prcm.h b/arch/arm/plat-omap/include/plat/prcm.h
index 078906d..2fdf8c8 100644
--- a/arch/arm/plat-omap/include/plat/prcm.h
+++ b/arch/arm/plat-omap/include/plat/prcm.h
@@ -32,9 +32,6 @@ void omap_prcm_arch_reset(char mode, const char *cmd);
 int omap2_cm_wait_idlest(void __iomem *reg, u32 mask, u8 idlest,
 			 const char *name);
 
-#define START_PADCONF_SAVE 0x2
-#define PADCONF_SAVE_DONE  0x1
-
 #endif
 
 

  parent reply	other threads:[~2010-12-08  6:18 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-08  6:18 [PATCH 00/11] OMAP: PRCM/powerdomain/clockdomain patches for 2.6.38, part two Paul Walmsley
2010-12-08  6:18 ` [PATCH 01/11] OMAP4: PRCM: add OMAP4-specific accessor/mutator functions Paul Walmsley
2010-12-08  9:48   ` [PATCH 01/11] OMAP4: PRCM: add OMAP4-specific accessor/mutatorfunctions Santosh Shilimkar
2010-12-11  1:55     ` Paul Walmsley
2010-12-11  7:32       ` Santosh Shilimkar
2010-12-08 12:33   ` Rajendra Nayak
2010-12-15  6:48     ` Paul Walmsley
2010-12-15 11:08       ` Rajendra Nayak
2010-12-15 11:57       ` Santosh Shilimkar
2010-12-15 12:43       ` Cousson, Benoit
2010-12-18 10:47         ` Paul Walmsley
2010-12-08 13:50   ` Rajendra Nayak
2010-12-08 19:46     ` Paul Walmsley
2010-12-08 20:16       ` Paul Walmsley
2010-12-08  6:18 ` [PATCH 02/11] OMAP4: PRCM: move global reset function for OMAP4 to an OMAP4-specific file Paul Walmsley
2010-12-08  6:18 ` [PATCH 03/11] OMAP2/3: PRM/CM: prefix OMAP2 PRM/CM functions with "omap2_" Paul Walmsley
2010-12-08  6:18 ` [PATCH 04/11] OMAP4: powerdomains: add PRCM partition data; use OMAP4 PRM functions Paul Walmsley
2010-12-08  6:18 ` [PATCH 05/11] OMAP2+: clockdomains: split the clkdm hwsup enable/disable function Paul Walmsley
2010-12-08 23:12   ` Kevin Hilman
2010-12-09  0:00     ` Paul Walmsley
2010-12-11  1:36       ` Paul Walmsley
2010-12-08  6:18 ` [PATCH 06/11] OMAP4: CM instances: add clockdomain register offsets Paul Walmsley
2010-12-08  6:18 ` [PATCH 07/11] OMAP4: clockdomains: add OMAP4 PRCM data and OMAP4 support Paul Walmsley
2010-12-08  6:18 ` [PATCH 08/11] OMAP2/3: clockdomain: remove unneeded .clkstctrl_reg, remove some direct CM register accesses Paul Walmsley
2010-12-08  6:18 ` [PATCH 09/11] OMAP2+: clockdomain: move header file from plat-omap to mach-omap2 Paul Walmsley
2010-12-15  5:39   ` Paul Walmsley
2010-12-08  6:18 ` [PATCH 10/11] OMAP2+: powerdomain: " Paul Walmsley
2010-12-15  5:37   ` Paul Walmsley
2010-12-15  5:51     ` Paul Walmsley
2010-12-08  6:18 ` Paul Walmsley [this message]
2010-12-09 14:19 ` [PATCH 00/11] OMAP: PRCM/powerdomain/clockdomain patches for 2.6.38, part two Jarkko Nikula
2010-12-09 17:41   ` Paul Walmsley
2010-12-14 14:40 ` [PATCH 00/11] OMAP: PRCM/powerdomain/clockdomain patches for 2.6.38,part two Rajendra Nayak
2010-12-15  3:57   ` Paul Walmsley
2010-12-15 11:14     ` Rajendra Nayak
2010-12-15  4:15 ` Santosh Shilimkar
2010-12-15  4:27   ` Paul Walmsley
2010-12-15  6:15     ` Santosh Shilimkar

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=20101208061844.30541.27788.stgit@twilight.localdomain \
    --to=paul@pwsan.com \
    --cc=linux-arm-kernel@lists.infradead.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