aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Walmsley <paul@pwsan.com>2010-12-21 23:05:16 -0500
committerPaul Walmsley <paul@pwsan.com>2010-12-21 23:05:16 -0500
commit596efe4792c50163578578bd4fe470f97652aad7 (patch)
tree266074fe2cf349b8402db948a69b2822d5763b0e
parent72e06d087204f3bc9acf281717b90ebf0b9731f7 (diff)
OMAP3: control/PM: move padconf save code to mach-omap2/control.c
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> Tested-by: Rajendra Nayak <rnayak@ti.com> Tested-by: Santosh Shilimkar <santosh.shilimkar@ti.com> 1. OMAP34xx Multimedia Device Silicon Revision 3.1.x [Rev. ZH] [SWPU222H] Section 4.11.4 "Device Off-Mode Sequences"
-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/pm34xx.c11
-rw-r--r--arch/arm/plat-omap/include/plat/prcm.h3
4 files changed, 33 insertions, 13 deletions
diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c
index 61101e807df1..695279419020 100644
--- a/arch/arm/mach-omap2/control.c
+++ b/arch/arm/mach-omap2/control.c
@@ -26,6 +26,10 @@
26#include "pm.h" 26#include "pm.h"
27#include "control.h" 27#include "control.h"
28 28
29/* Used by omap3_ctrl_save_padconf() */
30#define START_PADCONF_SAVE 0x2
31#define PADCONF_SAVE_DONE 0x1
32
29static void __iomem *omap2_ctrl_base; 33static void __iomem *omap2_ctrl_base;
30static void __iomem *omap4_ctrl_pad_base; 34static void __iomem *omap4_ctrl_pad_base;
31 35
@@ -530,4 +534,31 @@ void omap3630_ctrl_disable_rta(void)
530 omap_ctrl_writel(OMAP36XX_RTA_DISABLE, OMAP36XX_CONTROL_MEM_RTA_CTRL); 534 omap_ctrl_writel(OMAP36XX_RTA_DISABLE, OMAP36XX_CONTROL_MEM_RTA_CTRL);
531} 535}
532 536
537/**
538 * omap3_ctrl_save_padconf - save padconf registers to scratchpad RAM
539 *
540 * Tell the SCM to start saving the padconf registers, then wait for
541 * the process to complete. Returns 0 unconditionally, although it
542 * should also eventually be able to return -ETIMEDOUT, if the save
543 * does not complete.
544 *
545 * XXX This function is missing a timeout. What should it be?
546 */
547int omap3_ctrl_save_padconf(void)
548{
549 u32 cpo;
550
551 /* Save the padconf registers */
552 cpo = omap_ctrl_readl(OMAP343X_CONTROL_PADCONF_OFF);
553 cpo |= START_PADCONF_SAVE;
554 omap_ctrl_writel(cpo, OMAP343X_CONTROL_PADCONF_OFF);
555
556 /* wait for the save to complete */
557 while (!(omap_ctrl_readl(OMAP343X_CONTROL_GENERAL_PURPOSE_STATUS)
558 & PADCONF_SAVE_DONE))
559 udelay(1);
560
561 return 0;
562}
563
533#endif /* CONFIG_ARCH_OMAP3 && CONFIG_PM */ 564#endif /* CONFIG_ARCH_OMAP3 && CONFIG_PM */
diff --git a/arch/arm/mach-omap2/control.h b/arch/arm/mach-omap2/control.h
index 4bfc1f0d974c..1ddc83bc2f84 100644
--- a/arch/arm/mach-omap2/control.h
+++ b/arch/arm/mach-omap2/control.h
@@ -359,6 +359,7 @@ extern 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 omap3_ctrl_write_boot_mode(u8 bootmode);
361extern void omap3630_ctrl_disable_rta(void); 361extern void omap3630_ctrl_disable_rta(void);
362extern int omap3_ctrl_save_padconf(void);
362#else 363#else
363#define omap_ctrl_base_get() 0 364#define omap_ctrl_base_get() 0
364#define omap_ctrl_readb(x) 0 365#define omap_ctrl_readb(x) 0
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index 5efd1fb8c640..5b323f28da2d 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -133,16 +133,7 @@ static void omap3_disable_io_chain(void)
133 133
134static void omap3_core_save_context(void) 134static void omap3_core_save_context(void)
135{ 135{
136 u32 control_padconf_off; 136 omap3_ctrl_save_padconf();
137
138 /* Save the padconf registers */
139 control_padconf_off = omap_ctrl_readl(OMAP343X_CONTROL_PADCONF_OFF);
140 control_padconf_off |= START_PADCONF_SAVE;
141 omap_ctrl_writel(control_padconf_off, OMAP343X_CONTROL_PADCONF_OFF);
142 /* wait for the save to complete */
143 while (!(omap_ctrl_readl(OMAP343X_CONTROL_GENERAL_PURPOSE_STATUS)
144 & PADCONF_SAVE_DONE))
145 udelay(1);
146 137
147 /* 138 /*
148 * Force write last pad into memory, as this can fail in some 139 * 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 078906d86b6c..2fdf8c80d390 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);
32int omap2_cm_wait_idlest(void __iomem *reg, u32 mask, u8 idlest, 32int omap2_cm_wait_idlest(void __iomem *reg, u32 mask, u8 idlest,
33 const char *name); 33 const char *name);
34 34
35#define START_PADCONF_SAVE 0x2
36#define PADCONF_SAVE_DONE 0x1
37
38#endif 35#endif
39 36
40 37