OMAP3: PM: Force IVA2 into idle during bootup
authorKevin Hilman <khilman@deeprootsystems.com>
Tue, 25 Nov 2008 19:48:24 +0000 (11:48 -0800)
committerKevin Hilman <khilman@deeprootsystems.com>
Thu, 28 May 2009 17:59:05 +0000 (10:59 -0700)
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
arch/arm/mach-omap2/pm34xx.c
arch/arm/plat-omap/include/mach/control.h

index 4474947ddd6432b37912543181c605312585c21d..b2a8730771e98f35278331cf98b5f186443b0b65 100644 (file)
@@ -352,6 +352,54 @@ static struct platform_suspend_ops omap_pm_ops = {
        .valid          = suspend_valid_only_mem,
 };
 
+
+/**
+ * omap3_iva_idle(): ensure IVA is in idle so it can be put into
+ *                   retention
+ *
+ * In cases where IVA2 is activated by bootcode, it may prevent
+ * full-chip retention or off-mode because it is not idle.  This
+ * function forces the IVA2 into idle state so it can go
+ * into retention/off and thus allow full-chip retention/off.
+ *
+ **/
+static void __init omap3_iva_idle(void)
+{
+       /* ensure IVA2 clock is disabled */
+       cm_write_mod_reg(0, OMAP3430_IVA2_MOD, CM_FCLKEN);
+
+       /* if no clock activity, nothing else to do */
+       if (!(cm_read_mod_reg(OMAP3430_IVA2_MOD, OMAP3430_CM_CLKSTST) &
+             OMAP3430_CLKACTIVITY_IVA2_MASK))
+               return;
+
+       /* Reset IVA2 */
+       prm_write_mod_reg(OMAP3430_RST1_IVA2 |
+                         OMAP3430_RST2_IVA2 |
+                         OMAP3430_RST3_IVA2,
+                         OMAP3430_IVA2_MOD, RM_RSTCTRL);
+
+       /* Enable IVA2 clock */
+       cm_write_mod_reg(OMAP3430_CM_FCLKEN_IVA2_EN_IVA2,
+                        OMAP3430_IVA2_MOD, CM_FCLKEN);
+
+       /* Set IVA2 boot mode to 'idle' */
+       omap_ctrl_writel(OMAP3_IVA2_BOOTMOD_IDLE,
+                        OMAP343X_CONTROL_IVA2_BOOTMOD);
+
+       /* Un-reset IVA2 */
+       prm_write_mod_reg(0, OMAP3430_IVA2_MOD, RM_RSTCTRL);
+
+       /* Disable IVA2 clock */
+       cm_write_mod_reg(0, OMAP3430_IVA2_MOD, CM_FCLKEN);
+
+       /* Reset IVA2 */
+       prm_write_mod_reg(OMAP3430_RST1_IVA2 |
+                         OMAP3430_RST2_IVA2 |
+                         OMAP3430_RST3_IVA2,
+                         OMAP3430_IVA2_MOD, RM_RSTCTRL);
+}
+
 static void __init prcm_setup_regs(void)
 {
        /* reset modem */
@@ -511,6 +559,8 @@ static void __init prcm_setup_regs(void)
         * it is selected to mpu wakeup goup */
        prm_write_mod_reg(OMAP3430_IO_EN | OMAP3430_WKUP_EN,
                          OCP_MOD, OMAP3_PRM_IRQENABLE_MPU_OFFSET);
+
+       omap3_iva_idle();
 }
 
 static int __init pwrdms_setup(struct powerdomain *pwrdm)
index 269147f3836f50985809c3ab5b9a3f81a944e2f4..d38697b603ec402a73132961776d8c4377225b09 100644 (file)
 #define OMAP2_PBIASLITEPWRDNZ0         (1 << 1)
 #define OMAP2_PBIASLITEVMODE0          (1 << 0)
 
+/* CONTROL_IVA2_BOOTMOD bits */
+#define OMAP3_IVA2_BOOTMOD_SHIFT       0
+#define OMAP3_IVA2_BOOTMOD_MASK                (0xf << 0)
+#define OMAP3_IVA2_BOOTMOD_IDLE                (0x1 << 0)
+
 #ifndef __ASSEMBLY__
 #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
 extern void __iomem *omap_ctrl_base_get(void);