23 #include <asm/cacheflush.h>
32 #include <mach/regs-irq.h>
33 #include <mach/regs-gpio.h>
34 #include <mach/regs-clock.h>
36 #include <mach/pm-core.h>
39 static struct sleep_save exynos4_set_clksrc[] = {
51 static struct sleep_save exynos4210_set_clksrc[] = {
55 static struct sleep_save exynos4_epll_save[] = {
60 static struct sleep_save exynos4_vpll_save[] = {
65 static struct sleep_save exynos_core_save[] = {
76 static unsigned int save_arm_register[2];
78 static int exynos_cpu_suspend(
unsigned long arg)
80 #ifdef CONFIG_CACHE_L2X0
88 panic(
"sleep resumed to originator?");
91 static void exynos_pm_prepare(
void)
134 static unsigned long pll_base_rate;
136 static void exynos4_restore_pll(
void)
138 unsigned long pll_con, locktime, lockcnt;
139 unsigned long pll_in_rate;
140 unsigned int p_div, epll_wait = 0, vpll_wait = 0;
142 if (pll_base_rate == 0)
145 pll_in_rate = pll_base_rate;
148 pll_con = exynos4_epll_save[0].
val;
150 if (pll_con & (1 << 31)) {
154 pll_in_rate /= 1000000;
156 locktime = (3000 / pll_in_rate) * p_div;
157 lockcnt = locktime * 10000 / (10000 / pll_in_rate);
166 pll_in_rate = pll_base_rate;
169 pll_con = exynos4_vpll_save[0].
val;
171 if (pll_con & (1 << 31)) {
172 pll_in_rate /= 1000000;
175 lockcnt = locktime * 10000 / (10000 / pll_in_rate);
198 }
while (epll_wait || vpll_wait);
204 .add_dev = exynos_pm_add,
207 static __init int exynos_pm_drvinit(
void)
209 struct clk *pll_base;
217 tmp |= ((0xFF << 8) | (0x1F << 1));
223 if (!IS_ERR(pll_base)) {
233 static int exynos_pm_suspend(
void)
250 asm (
"mrc p15, 0, %0, c15, c0, 0"
251 :
"=r" (
tmp) : :
"cc");
252 save_arm_register[0] =
tmp;
255 asm (
"mrc p15, 0, %0, c15, c0, 1"
256 :
"=r" (
tmp) : :
"cc");
257 save_arm_register[1] =
tmp;
263 static void exynos_pm_resume(
void)
282 tmp = save_arm_register[0];
283 asm volatile (
"mcr p15, 0, %0, c15, c0, 0"
288 tmp = save_arm_register[1];
289 asm volatile (
"mcr p15, 0, %0, c15, c0, 1"
307 exynos4_restore_pll();
318 static struct syscore_ops exynos_pm_syscore_ops = {
319 .suspend = exynos_pm_suspend,
320 .resume = exynos_pm_resume,
323 static __init int exynos_pm_syscore_init(
void)