Merge tag 'soc2' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
[~shefty/rdma-dev.git] / arch / arm / mach-exynos / cpuidle.c
index 8e4ec21ef2cf6ba3790b222e3e1ced6684ee2387..05092415277688605e4c2dc5ede85ba60c94e678 100644 (file)
@@ -21,6 +21,7 @@
 #include <asm/suspend.h>
 #include <asm/unified.h>
 #include <asm/cpuidle.h>
+#include <mach/regs-clock.h>
 #include <mach/regs-pmu.h>
 #include <mach/pmu.h>
 
@@ -157,12 +158,47 @@ static int exynos4_enter_lowpower(struct cpuidle_device *dev,
                return exynos4_enter_core0_aftr(dev, drv, new_index);
 }
 
+static void __init exynos5_core_down_clk(void)
+{
+       unsigned int tmp;
+
+       /*
+        * Enable arm clock down (in idle) and set arm divider
+        * ratios in WFI/WFE state.
+        */
+       tmp = PWR_CTRL1_CORE2_DOWN_RATIO | \
+             PWR_CTRL1_CORE1_DOWN_RATIO | \
+             PWR_CTRL1_DIV2_DOWN_EN     | \
+             PWR_CTRL1_DIV1_DOWN_EN     | \
+             PWR_CTRL1_USE_CORE1_WFE    | \
+             PWR_CTRL1_USE_CORE0_WFE    | \
+             PWR_CTRL1_USE_CORE1_WFI    | \
+             PWR_CTRL1_USE_CORE0_WFI;
+       __raw_writel(tmp, EXYNOS5_PWR_CTRL1);
+
+       /*
+        * Enable arm clock up (on exiting idle). Set arm divider
+        * ratios when not in idle along with the standby duration
+        * ratios.
+        */
+       tmp = PWR_CTRL2_DIV2_UP_EN       | \
+             PWR_CTRL2_DIV1_UP_EN       | \
+             PWR_CTRL2_DUR_STANDBY2_VAL | \
+             PWR_CTRL2_DUR_STANDBY1_VAL | \
+             PWR_CTRL2_CORE2_UP_RATIO   | \
+             PWR_CTRL2_CORE1_UP_RATIO;
+       __raw_writel(tmp, EXYNOS5_PWR_CTRL2);
+}
+
 static int __init exynos4_init_cpuidle(void)
 {
        int i, max_cpuidle_state, cpu_id;
        struct cpuidle_device *device;
        struct cpuidle_driver *drv = &exynos4_idle_driver;
 
+       if (soc_is_exynos5250())
+               exynos5_core_down_clk();
+
        /* Setup cpuidle driver */
        drv->state_count = (sizeof(exynos4_cpuidle_set) /
                                       sizeof(struct cpuidle_state));