public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: paul@pwsan.com (Paul Walmsley)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 09/14] OMAP3: control/PRCM: add omap3_ctrl_write_boot_mode()
Date: Mon, 06 Dec 2010 18:25:12 -0700	[thread overview]
Message-ID: <20101207012511.3708.89350.stgit@twilight.localdomain> (raw)
In-Reply-To: <20101207012242.3708.45451.stgit@twilight.localdomain>

Get rid of the open-coded scratchpad write in mach-omap2/prcm.c and
replace it with an actual API, omap3_ctrl_write_boot_mode().  While
there, get rid of the gratuitous omap_writel().

There's not much documentation available for what should wind up in
the scratchpad here, so more documentation would be appreciated.
Also, at some point, we should formalize our treatment of the scratchpad;
right now, accesses to the scratchpad are not well-documented.

Signed-off-by: Paul Walmsley <paul@pwsan.com>
---
 arch/arm/mach-omap2/control.c |   31 +++++++++++++++++++++++++++++++
 arch/arm/mach-omap2/control.h |    1 +
 arch/arm/mach-omap2/prcm.c    |   10 +---------
 3 files changed, 33 insertions(+), 9 deletions(-)

diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c
index 1fa3294..9fda3d7 100644
--- a/arch/arm/mach-omap2/control.c
+++ b/arch/arm/mach-omap2/control.c
@@ -209,6 +209,37 @@ void omap4_ctrl_pad_writel(u32 val, u16 offset)
 	__raw_writel(val, OMAP4_CTRL_PAD_REGADDR(offset));
 }
 
+#ifdef CONFIG_ARCH_OMAP3
+
+/**
+ * omap3_ctrl_write_boot_mode - set scratchpad boot mode for the next boot
+ * @bootmode: 8-bit value to pass to some boot code
+ *
+ * Set the bootmode in the scratchpad RAM.  This is used after the
+ * system restarts.  Not sure what actually uses this - it may be the
+ * bootloader, rather than the boot ROM - contrary to the preserved
+ * comment below.  No return value.
+ */
+void omap3_ctrl_write_boot_mode(u8 bootmode)
+{
+	u32 l;
+
+	l = ('B' << 24) | ('M' << 16) | bootmode;
+
+	/*
+	 * Reserve the first word in scratchpad for communicating
+	 * with the boot ROM. A pointer to a data structure
+	 * describing the boot process can be stored there,
+	 * cf. OMAP34xx TRM, Initialization / Software Booting
+	 * Configuration.
+	 *
+	 * XXX This should use some omap_ctrl_writel()-type function
+	 */
+	__raw_writel(l, OMAP2_L4_IO_ADDRESS(OMAP343X_SCRATCHPAD + 4));
+}
+
+#endif
+
 #if defined(CONFIG_ARCH_OMAP3) && defined(CONFIG_PM)
 /*
  * Clears the scratchpad contents in case of cold boot-
diff --git a/arch/arm/mach-omap2/control.h b/arch/arm/mach-omap2/control.h
index b6c6b7c..a9325ad 100644
--- a/arch/arm/mach-omap2/control.h
+++ b/arch/arm/mach-omap2/control.h
@@ -350,6 +350,7 @@ extern u32 *get_es3_restore_pointer(void);
 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);
 
 #else
 #define omap_ctrl_base_get()		0
diff --git a/arch/arm/mach-omap2/prcm.c b/arch/arm/mach-omap2/prcm.c
index a51846e..2eca847 100644
--- a/arch/arm/mach-omap2/prcm.c
+++ b/arch/arm/mach-omap2/prcm.c
@@ -143,16 +143,8 @@ void omap_prcm_arch_reset(char mode, const char *cmd)
 
 		prcm_offs = WKUP_MOD;
 	} else if (cpu_is_omap34xx()) {
-		u32 l;
-
 		prcm_offs = OMAP3430_GR_MOD;
-		l = ('B' << 24) | ('M' << 16) | (cmd ? (u8)*cmd : 0);
-		/* Reserve the first word in scratchpad for communicating
-		 * with the boot ROM. A pointer to a data structure
-		 * describing the boot process can be stored there,
-		 * cf. OMAP34xx TRM, Initialization / Software Booting
-		 * Configuration. */
-		omap_writel(l, OMAP343X_SCRATCHPAD + 4);
+		omap3_ctrl_write_boot_mode((cmd ? (u8)*cmd : 0));
 	} else if (cpu_is_omap44xx())
 		prcm_offs = OMAP4430_PRM_DEVICE_MOD;
 	else

  parent reply	other threads:[~2010-12-07  1:25 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-07  1:24 [PATCH 00/14] OMAP: PRCM/powerdomain/clockdomain patches for 2.6.38, part one Paul Walmsley
2010-12-07  1:25 ` [PATCH 01/14] OMAP: powerdomain: Move static allocations from powerdomains.h to a .c file Paul Walmsley
2010-12-07  1:25 ` [PATCH 02/14] OMAP: powerdomain: Infrastructure to put arch specific code Paul Walmsley
2010-12-07  1:25 ` [PATCH 03/14] OMAP: powerdomain: Arch specific funcs for state control Paul Walmsley
2010-12-07  1:25 ` [PATCH 04/14] OMAP: powerdomain: Arch specific funcs for logic control Paul Walmsley
2010-12-07  1:25 ` [PATCH 05/14] OMAP: powerdomain: Arch specific funcs for mem control Paul Walmsley
2010-12-07  1:25 ` [PATCH 06/14] OMAP4: powerdomain: Add pwrdm_clear_all_prev_pwrst Paul Walmsley
2010-12-07  1:25 ` [PATCH 07/14] OMAP2+: powerdomains: move powerdomain static data to .c files Paul Walmsley
2010-12-07  1:25 ` [PATCH 08/14] OMAP2+: clockdomains: move clockdomain " Paul Walmsley
2010-12-07  1:25 ` Paul Walmsley [this message]
2010-12-07  1:25 ` [PATCH 10/14] OMAP3: control/PRCM: move CONTROL_PADCONF_SYS_NIRQ save/restore to SCM code Paul Walmsley
2010-12-07  1:25 ` [PATCH 11/14] OMAP4: PRCM: reorganize existing OMAP4 PRCM header files Paul Walmsley
2010-12-07  8:09   ` Cousson, Benoit
2010-12-08  6:47     ` Paul Walmsley
2010-12-09 22:31       ` Cousson, Benoit
2010-12-07 20:43   ` Cousson, Benoit
2010-12-08  6:40     ` Paul Walmsley
2010-12-08 20:57       ` Kevin Hilman
2010-12-07  1:25 ` [PATCH 12/14] OMAP4: PRCM: rename _MOD macros to _INST Paul Walmsley
2010-12-07  1:25 ` [PATCH 13/14] OMAP2/3: PRCM: split OMAP2/3-specific PRCM code into OMAP2/3-specific files Paul Walmsley
2010-12-07 13:37   ` Mark Brown
2010-12-15  4:50   ` Paul Walmsley
2010-12-15 12:23     ` Felipe Contreras
2010-12-22  3:51       ` Paul Walmsley
2010-12-15 16:39     ` Ramirez Luna, Omar
2010-12-22  4:10       ` Paul Walmsley
2010-12-07  1:25 ` [PATCH 14/14] OMAP3: PRM/CM: separate CM context save/restore; remove PRM context save/restore Paul Walmsley
2010-12-08  0:16 ` [PATCH 00/14] OMAP: PRCM/powerdomain/clockdomain patches for 2.6.38, part one Kevin Hilman
2010-12-08  6:20   ` Paul Walmsley

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=20101207012511.3708.89350.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