@@ -60,9 +60,11 @@ static struct cpuidle_driver exynos4_idle_driver = {
};
/* Ext-GIC nIRQ/nFIQ is the only wakeup source in AFTR */
-static void exynos4_set_wakeupmask(void)
+static void exynos4_set_wakeupmask(int index)
{
- __raw_writel(0x0000ff3e, S5P_WAKEUP_MASK);
+ unsigned long mask = __raw_readl(S5P_WAKEUP_MASK) & 0xFFF00000;
+ if (index == 1)
+ __raw_writel(mask | 0x0000ff3e, S5P_WAKEUP_MASK);
}
static unsigned int g_pwr_ctrl, g_diag_reg;
@@ -91,19 +93,17 @@ static int idle_finisher(unsigned long flags)
return 1;
}
-static int exynos4_enter_core0_aftr(struct cpuidle_device *dev,
- struct cpuidle_driver *drv,
- int index)
+static void exynos4_do_idle(int index, int pd_conf, int lp_mode_magic)
{
unsigned long tmp;
- exynos4_set_wakeupmask();
+ exynos4_set_wakeupmask(index);
- /* Set value of power down register for aftr mode */
- exynos_sys_powerdown_conf(SYS_AFTR);
+ /* Set value of power down register for requested LP mode */
+ exynos_sys_powerdown_conf(pd_conf);
__raw_writel(virt_to_phys(s3c_cpu_resume), REG_DIRECTGO_ADDR);
- __raw_writel(S5P_CHECK_AFTR, REG_DIRECTGO_FLAG);
+ __raw_writel(lp_mode_magic, REG_DIRECTGO_FLAG);
save_cpu_arch_register();
@@ -136,7 +136,13 @@ static int exynos4_enter_core0_aftr(struct cpuidle_device *dev,
/* Clear wakeup state register */
__raw_writel(0x0, S5P_WAKEUP_STAT);
+}
+static int exynos4_enter_core0_aftr(struct cpuidle_device *dev,
+ struct cpuidle_driver *drv,
+ int index)
+{
+ exynos4_do_idle(index, SYS_AFTR, S5P_CHECK_AFTR);
return index;
}