aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Walmsley <paul@pwsan.com>2010-12-21 22:01:21 -0500
committerPaul Walmsley <paul@pwsan.com>2010-12-21 22:01:21 -0500
commit166353bd75587a2158d713af1b9489a79e0ce297 (patch)
treef7bda5c2c53d7c3ab253db9ddcb49c147afaaf42
parentdc0b3a701499bb7727314d7a9c764f7486db4802 (diff)
OMAP3: control/PRCM: add omap3_ctrl_write_boot_mode()
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> Reviewed-by: Kevin Hilman <khilman@deeprootsystems.com> Tested-by: Kevin Hilman <khilman@deeprootsystems.com> Tested-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
-rw-r--r--arch/arm/mach-omap2/control.c31
-rw-r--r--arch/arm/mach-omap2/control.h1
-rw-r--r--arch/arm/mach-omap2/prcm.c10
3 files changed, 33 insertions, 9 deletions
diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c
index 0269bb055b69..d058f7c3ec6a 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)
209 __raw_writel(val, OMAP4_CTRL_PAD_REGADDR(offset)); 209 __raw_writel(val, OMAP4_CTRL_PAD_REGADDR(offset));
210} 210}
211 211
212#ifdef CONFIG_ARCH_OMAP3
213
214/**
215 * omap3_ctrl_write_boot_mode - set scratchpad boot mode for the next boot
216 * @bootmode: 8-bit value to pass to some boot code
217 *
218 * Set the bootmode in the scratchpad RAM. This is used after the
219 * system restarts. Not sure what actually uses this - it may be the
220 * bootloader, rather than the boot ROM - contrary to the preserved
221 * comment below. No return value.
222 */
223void omap3_ctrl_write_boot_mode(u8 bootmode)
224{
225 u32 l;
226
227 l = ('B' << 24) | ('M' << 16) | bootmode;
228
229 /*
230 * Reserve the first word in scratchpad for communicating
231 * with the boot ROM. A pointer to a data structure
232 * describing the boot process can be stored there,
233 * cf. OMAP34xx TRM, Initialization / Software Booting
234 * Configuration.
235 *
236 * XXX This should use some omap_ctrl_writel()-type function
237 */
238 __raw_writel(l, OMAP2_L4_IO_ADDRESS(OMAP343X_SCRATCHPAD + 4));
239}
240
241#endif
242
212#if defined(CONFIG_ARCH_OMAP3) && defined(CONFIG_PM) 243#if defined(CONFIG_ARCH_OMAP3) && defined(CONFIG_PM)
213/* 244/*
214 * Clears the scratchpad contents in case of cold boot- 245 * 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 6e5f7e512ff7..4bfc1f0d974c 100644
--- a/arch/arm/mach-omap2/control.h
+++ b/arch/arm/mach-omap2/control.h
@@ -357,6 +357,7 @@ extern u32 *get_omap3630_restore_pointer(void);
357extern u32 omap3_arm_context[128]; 357extern u32 omap3_arm_context[128];
358extern void omap3_control_save_context(void); 358extern void omap3_control_save_context(void);
359extern void omap3_control_restore_context(void); 359extern void omap3_control_restore_context(void);
360extern void omap3_ctrl_write_boot_mode(u8 bootmode);
360extern void omap3630_ctrl_disable_rta(void); 361extern void omap3630_ctrl_disable_rta(void);
361#else 362#else
362#define omap_ctrl_base_get() 0 363#define omap_ctrl_base_get() 0
diff --git a/arch/arm/mach-omap2/prcm.c b/arch/arm/mach-omap2/prcm.c
index a51846e3a6fa..2eca8475d396 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)
143 143
144 prcm_offs = WKUP_MOD; 144 prcm_offs = WKUP_MOD;
145 } else if (cpu_is_omap34xx()) { 145 } else if (cpu_is_omap34xx()) {
146 u32 l;
147
148 prcm_offs = OMAP3430_GR_MOD; 146 prcm_offs = OMAP3430_GR_MOD;
149 l = ('B' << 24) | ('M' << 16) | (cmd ? (u8)*cmd : 0); 147 omap3_ctrl_write_boot_mode((cmd ? (u8)*cmd : 0));
150 /* Reserve the first word in scratchpad for communicating
151 * with the boot ROM. A pointer to a data structure
152 * describing the boot process can be stored there,
153 * cf. OMAP34xx TRM, Initialization / Software Booting
154 * Configuration. */
155 omap_writel(l, OMAP343X_SCRATCHPAD + 4);
156 } else if (cpu_is_omap44xx()) 148 } else if (cpu_is_omap44xx())
157 prcm_offs = OMAP4430_PRM_DEVICE_MOD; 149 prcm_offs = OMAP4430_PRM_DEVICE_MOD;
158 else 150 else