]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/arm/mach-omap2/pm34xx.c
OMAP3: PM: Force IVA2 into idle during bootup
[linux-2.6-omap-h63xx.git] / arch / arm / mach-omap2 / pm34xx.c
index da112b8b08a1ff79cfe79977c382b0ac765f1ec7..8b4b8623f8d224f24dfbabbe21188f54708a9445 100644 (file)
@@ -30,6 +30,7 @@
 #include <mach/clockdomain.h>
 #include <mach/powerdomain.h>
 #include <mach/serial.h>
+#include <mach/control.h>
 
 #include "cm.h"
 #include "cm-regbits-34xx.h"
@@ -378,6 +379,49 @@ 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);
+
+       /* 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)
 {
        /* XXX Reset all wkdeps. This should be done when initializing
@@ -531,6 +575,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, OMAP2_PRM_IRQENABLE_MPU_OFFSET);
+
+       omap3_iva_idle();
 }
 
 static int __init pwrdms_setup(struct powerdomain *pwrdm)