blob: 9c67a15f4a0fb72e15b062dc4b8af4b60094fa07 [file] [log] [blame]
Bartlomiej Zolnierkiewicz0d713cf2014-09-25 18:02:45 +09001/*
2 * Copyright (c) 2011-2014 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com
4 *
5 * EXYNOS - Suspend support
6 *
7 * Based on arch/arm/mach-s3c2410/pm.c
8 * Copyright (c) 2006 Simtec Electronics
9 * Ben Dooks <ben@simtec.co.uk>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14 */
15
16#include <linux/init.h>
17#include <linux/suspend.h>
18#include <linux/syscore_ops.h>
19#include <linux/cpu_pm.h>
20#include <linux/io.h>
21#include <linux/irqchip/arm-gic.h>
22#include <linux/err.h>
Javier Martinez Canillasc645a592014-11-13 11:14:40 +090023#include <linux/regulator/machine.h>
Bartlomiej Zolnierkiewicz0d713cf2014-09-25 18:02:45 +090024
25#include <asm/cacheflush.h>
26#include <asm/hardware/cache-l2x0.h>
27#include <asm/firmware.h>
Abhilash Kesavanadc548d2014-11-07 09:20:16 +090028#include <asm/mcpm.h>
Bartlomiej Zolnierkiewicz0d713cf2014-09-25 18:02:45 +090029#include <asm/smp_scu.h>
30#include <asm/suspend.h>
31
32#include <plat/pm-common.h>
33#include <plat/regs-srom.h>
34
35#include "common.h"
36#include "regs-pmu.h"
37#include "regs-sys.h"
Pankaj Dubey6b7bfd82014-11-07 09:26:47 +090038#include "exynos-pmu.h"
Bartlomiej Zolnierkiewicz0d713cf2014-09-25 18:02:45 +090039
40#define S5P_CHECK_SLEEP 0x00000BAD
41
42#define REG_TABLE_END (-1U)
43
Vikas Sajjan0fdf0882014-11-07 09:17:36 +090044#define EXYNOS5420_CPU_STATE 0x28
45
Bartlomiej Zolnierkiewicz0d713cf2014-09-25 18:02:45 +090046/**
47 * struct exynos_wkup_irq - Exynos GIC to PMU IRQ mapping
48 * @hwirq: Hardware IRQ signal of the GIC
49 * @mask: Mask in PMU wake-up mask register
50 */
51struct exynos_wkup_irq {
52 unsigned int hwirq;
53 u32 mask;
54};
55
56static struct sleep_save exynos5_sys_save[] = {
57 SAVE_ITEM(EXYNOS5_SYS_I2C_CFG),
58};
59
60static struct sleep_save exynos_core_save[] = {
61 /* SROM side */
62 SAVE_ITEM(S5P_SROM_BW),
63 SAVE_ITEM(S5P_SROM_BC0),
64 SAVE_ITEM(S5P_SROM_BC1),
65 SAVE_ITEM(S5P_SROM_BC2),
66 SAVE_ITEM(S5P_SROM_BC3),
67};
68
69struct exynos_pm_data {
70 const struct exynos_wkup_irq *wkup_irq;
71 struct sleep_save *extra_save;
72 int num_extra_save;
73 unsigned int wake_disable_mask;
74 unsigned int *release_ret_regs;
75
76 void (*pm_prepare)(void);
Abhilash Kesavanadc548d2014-11-07 09:20:16 +090077 void (*pm_resume_prepare)(void);
Bartlomiej Zolnierkiewicz0d713cf2014-09-25 18:02:45 +090078 void (*pm_resume)(void);
79 int (*pm_suspend)(void);
80 int (*cpu_suspend)(unsigned long);
81};
82
83struct exynos_pm_data *pm_data;
84
Vikas Sajjan0fdf0882014-11-07 09:17:36 +090085static int exynos5420_cpu_state;
86static unsigned int exynos_pmu_spare3;
87
Bartlomiej Zolnierkiewicz0d713cf2014-09-25 18:02:45 +090088/*
89 * GIC wake-up support
90 */
91
92static u32 exynos_irqwake_intmask = 0xffffffff;
93
94static const struct exynos_wkup_irq exynos4_wkup_irq[] = {
95 { 76, BIT(1) }, /* RTC alarm */
96 { 77, BIT(2) }, /* RTC tick */
97 { /* sentinel */ },
98};
99
100static const struct exynos_wkup_irq exynos5250_wkup_irq[] = {
101 { 75, BIT(1) }, /* RTC alarm */
102 { 76, BIT(2) }, /* RTC tick */
103 { /* sentinel */ },
104};
105
106unsigned int exynos_release_ret_regs[] = {
107 S5P_PAD_RET_MAUDIO_OPTION,
108 S5P_PAD_RET_GPIO_OPTION,
109 S5P_PAD_RET_UART_OPTION,
110 S5P_PAD_RET_MMCA_OPTION,
111 S5P_PAD_RET_MMCB_OPTION,
112 S5P_PAD_RET_EBIA_OPTION,
113 S5P_PAD_RET_EBIB_OPTION,
114 REG_TABLE_END,
115};
116
Vikas Sajjan0fdf0882014-11-07 09:17:36 +0900117unsigned int exynos5420_release_ret_regs[] = {
118 EXYNOS_PAD_RET_DRAM_OPTION,
119 EXYNOS_PAD_RET_MAUDIO_OPTION,
120 EXYNOS_PAD_RET_JTAG_OPTION,
121 EXYNOS5420_PAD_RET_GPIO_OPTION,
122 EXYNOS5420_PAD_RET_UART_OPTION,
123 EXYNOS5420_PAD_RET_MMCA_OPTION,
124 EXYNOS5420_PAD_RET_MMCB_OPTION,
125 EXYNOS5420_PAD_RET_MMCC_OPTION,
126 EXYNOS5420_PAD_RET_HSI_OPTION,
127 EXYNOS_PAD_RET_EBIA_OPTION,
128 EXYNOS_PAD_RET_EBIB_OPTION,
129 EXYNOS5420_PAD_RET_SPI_OPTION,
130 EXYNOS5420_PAD_RET_DRAM_COREBLK_OPTION,
131 REG_TABLE_END,
132};
133
Bartlomiej Zolnierkiewicz0d713cf2014-09-25 18:02:45 +0900134static int exynos_irq_set_wake(struct irq_data *data, unsigned int state)
135{
136 const struct exynos_wkup_irq *wkup_irq;
137
138 if (!pm_data->wkup_irq)
139 return -ENOENT;
140 wkup_irq = pm_data->wkup_irq;
141
142 while (wkup_irq->mask) {
143 if (wkup_irq->hwirq == data->hwirq) {
144 if (!state)
145 exynos_irqwake_intmask |= wkup_irq->mask;
146 else
147 exynos_irqwake_intmask &= ~wkup_irq->mask;
148 return 0;
149 }
150 ++wkup_irq;
151 }
152
153 return -ENOENT;
154}
155
156static int exynos_cpu_do_idle(void)
157{
158 /* issue the standby signal into the pm unit. */
159 cpu_do_idle();
160
161 pr_info("Failed to suspend the system\n");
162 return 1; /* Aborting suspend */
163}
Vikas Sajjan0fdf0882014-11-07 09:17:36 +0900164static void exynos_flush_cache_all(void)
Bartlomiej Zolnierkiewicz0d713cf2014-09-25 18:02:45 +0900165{
166 flush_cache_all();
167 outer_flush_all();
Vikas Sajjan0fdf0882014-11-07 09:17:36 +0900168}
169
170static int exynos_cpu_suspend(unsigned long arg)
171{
172 exynos_flush_cache_all();
173 return exynos_cpu_do_idle();
174}
175
176static int exynos5420_cpu_suspend(unsigned long arg)
177{
Abhilash Kesavanadc548d2014-11-07 09:20:16 +0900178 /* MCPM works with HW CPU identifiers */
179 unsigned int mpidr = read_cpuid_mpidr();
180 unsigned int cluster = MPIDR_AFFINITY_LEVEL(mpidr, 1);
181 unsigned int cpu = MPIDR_AFFINITY_LEVEL(mpidr, 0);
182
Vikas Sajjan0fdf0882014-11-07 09:17:36 +0900183 __raw_writel(0x0, sysram_base_addr + EXYNOS5420_CPU_STATE);
Abhilash Kesavanadc548d2014-11-07 09:20:16 +0900184
185 if (IS_ENABLED(CONFIG_EXYNOS5420_MCPM)) {
186 mcpm_set_entry_vector(cpu, cluster, exynos_cpu_resume);
187
188 /*
189 * Residency value passed to mcpm_cpu_suspend back-end
190 * has to be given clear semantics. Set to 0 as a
191 * temporary value.
192 */
193 mcpm_cpu_suspend(0);
194 }
195
196 pr_info("Failed to suspend the system\n");
197
198 /* return value != 0 means failure */
199 return 1;
Bartlomiej Zolnierkiewicz0d713cf2014-09-25 18:02:45 +0900200}
201
202static void exynos_pm_set_wakeup_mask(void)
203{
204 /* Set wake-up mask registers */
205 pmu_raw_writel(exynos_get_eint_wake_mask(), S5P_EINT_WAKEUP_MASK);
206 pmu_raw_writel(exynos_irqwake_intmask & ~(1 << 31), S5P_WAKEUP_MASK);
207}
208
209static void exynos_pm_enter_sleep_mode(void)
210{
211 /* Set value of power down register for sleep mode */
212 exynos_sys_powerdown_conf(SYS_SLEEP);
213 pmu_raw_writel(S5P_CHECK_SLEEP, S5P_INFORM1);
Bartlomiej Zolnierkiewicz0d713cf2014-09-25 18:02:45 +0900214}
215
216static void exynos_pm_prepare(void)
217{
218 /* Set wake-up mask registers */
219 exynos_pm_set_wakeup_mask();
220
221 s3c_pm_do_save(exynos_core_save, ARRAY_SIZE(exynos_core_save));
222
223 if (pm_data->extra_save)
224 s3c_pm_do_save(pm_data->extra_save,
225 pm_data->num_extra_save);
226
227 exynos_pm_enter_sleep_mode();
Abhilash Kesavanadc548d2014-11-07 09:20:16 +0900228
229 /* ensure at least INFORM0 has the resume address */
230 pmu_raw_writel(virt_to_phys(exynos_cpu_resume), S5P_INFORM0);
Bartlomiej Zolnierkiewicz0d713cf2014-09-25 18:02:45 +0900231}
232
Vikas Sajjan0fdf0882014-11-07 09:17:36 +0900233static void exynos5420_pm_prepare(void)
234{
235 unsigned int tmp;
236
237 /* Set wake-up mask registers */
238 exynos_pm_set_wakeup_mask();
239
240 s3c_pm_do_save(exynos_core_save, ARRAY_SIZE(exynos_core_save));
241
242 exynos_pmu_spare3 = pmu_raw_readl(S5P_PMU_SPARE3);
243 /*
244 * The cpu state needs to be saved and restored so that the
245 * secondary CPUs will enter low power start. Though the U-Boot
246 * is setting the cpu state with low power flag, the kernel
247 * needs to restore it back in case, the primary cpu fails to
248 * suspend for any reason.
249 */
250 exynos5420_cpu_state = __raw_readl(sysram_base_addr +
251 EXYNOS5420_CPU_STATE);
252
253 exynos_pm_enter_sleep_mode();
254
Abhilash Kesavanadc548d2014-11-07 09:20:16 +0900255 /* ensure at least INFORM0 has the resume address */
256 if (IS_ENABLED(CONFIG_EXYNOS5420_MCPM))
257 pmu_raw_writel(virt_to_phys(mcpm_entry_point), S5P_INFORM0);
258
Vikas Sajjan0fdf0882014-11-07 09:17:36 +0900259 tmp = pmu_raw_readl(EXYNOS5_ARM_L2_OPTION);
260 tmp &= ~EXYNOS5_USE_RETENTION;
261 pmu_raw_writel(tmp, EXYNOS5_ARM_L2_OPTION);
262
263 tmp = pmu_raw_readl(EXYNOS5420_SFR_AXI_CGDIS1);
264 tmp |= EXYNOS5420_UFS;
265 pmu_raw_writel(tmp, EXYNOS5420_SFR_AXI_CGDIS1);
266
267 tmp = pmu_raw_readl(EXYNOS5420_ARM_COMMON_OPTION);
268 tmp &= ~EXYNOS5420_L2RSTDISABLE_VALUE;
269 pmu_raw_writel(tmp, EXYNOS5420_ARM_COMMON_OPTION);
270
271 tmp = pmu_raw_readl(EXYNOS5420_FSYS2_OPTION);
272 tmp |= EXYNOS5420_EMULATION;
273 pmu_raw_writel(tmp, EXYNOS5420_FSYS2_OPTION);
274
275 tmp = pmu_raw_readl(EXYNOS5420_PSGEN_OPTION);
276 tmp |= EXYNOS5420_EMULATION;
277 pmu_raw_writel(tmp, EXYNOS5420_PSGEN_OPTION);
278}
279
280
Bartlomiej Zolnierkiewicz0d713cf2014-09-25 18:02:45 +0900281static int exynos_pm_suspend(void)
282{
283 exynos_pm_central_suspend();
284
Bartlomiej Zolnierkiewicz865e8b72015-01-24 14:05:50 +0900285 /* Setting SEQ_OPTION register */
286 pmu_raw_writel(S5P_USE_STANDBY_WFI0 | S5P_USE_STANDBY_WFE0,
287 S5P_CENTRAL_SEQ_OPTION);
288
Bartlomiej Zolnierkiewicz0d713cf2014-09-25 18:02:45 +0900289 if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A9)
290 exynos_cpu_save_register();
291
292 return 0;
293}
294
Vikas Sajjan0fdf0882014-11-07 09:17:36 +0900295static int exynos5420_pm_suspend(void)
296{
297 u32 this_cluster;
298
299 exynos_pm_central_suspend();
300
301 /* Setting SEQ_OPTION register */
302
303 this_cluster = MPIDR_AFFINITY_LEVEL(read_cpuid_mpidr(), 1);
304 if (!this_cluster)
305 pmu_raw_writel(EXYNOS5420_ARM_USE_STANDBY_WFI0,
306 S5P_CENTRAL_SEQ_OPTION);
307 else
308 pmu_raw_writel(EXYNOS5420_KFC_USE_STANDBY_WFI0,
309 S5P_CENTRAL_SEQ_OPTION);
310 return 0;
311}
312
Bartlomiej Zolnierkiewicz0d713cf2014-09-25 18:02:45 +0900313static void exynos_pm_release_retention(void)
314{
315 unsigned int i;
316
317 for (i = 0; (pm_data->release_ret_regs[i] != REG_TABLE_END); i++)
318 pmu_raw_writel(EXYNOS_WAKEUP_FROM_LOWPWR,
319 pm_data->release_ret_regs[i]);
320}
321
322static void exynos_pm_resume(void)
323{
324 u32 cpuid = read_cpuid_part();
325
326 if (exynos_pm_central_resume())
327 goto early_wakeup;
328
329 /* For release retention */
330 exynos_pm_release_retention();
331
332 if (pm_data->extra_save)
333 s3c_pm_do_restore_core(pm_data->extra_save,
334 pm_data->num_extra_save);
335
336 s3c_pm_do_restore_core(exynos_core_save, ARRAY_SIZE(exynos_core_save));
337
338 if (cpuid == ARM_CPU_PART_CORTEX_A9)
339 scu_enable(S5P_VA_SCU);
340
341 if (call_firmware_op(resume) == -ENOSYS
342 && cpuid == ARM_CPU_PART_CORTEX_A9)
343 exynos_cpu_restore_register();
344
345early_wakeup:
346
347 /* Clear SLEEP mode set in INFORM1 */
348 pmu_raw_writel(0x0, S5P_INFORM1);
349}
350
Abhilash Kesavanadc548d2014-11-07 09:20:16 +0900351static void exynos5420_prepare_pm_resume(void)
352{
353 if (IS_ENABLED(CONFIG_EXYNOS5420_MCPM))
354 WARN_ON(mcpm_cpu_powered_up());
355}
356
Vikas Sajjan0fdf0882014-11-07 09:17:36 +0900357static void exynos5420_pm_resume(void)
358{
359 unsigned long tmp;
360
Abhilash Kesavanadc548d2014-11-07 09:20:16 +0900361 /* Restore the CPU0 low power state register */
362 tmp = pmu_raw_readl(EXYNOS5_ARM_CORE0_SYS_PWR_REG);
363 pmu_raw_writel(tmp | S5P_CORE_LOCAL_PWR_EN,
364 EXYNOS5_ARM_CORE0_SYS_PWR_REG);
365
Vikas Sajjan0fdf0882014-11-07 09:17:36 +0900366 /* Restore the sysram cpu state register */
367 __raw_writel(exynos5420_cpu_state,
368 sysram_base_addr + EXYNOS5420_CPU_STATE);
369
370 pmu_raw_writel(EXYNOS5420_USE_STANDBY_WFI_ALL,
371 S5P_CENTRAL_SEQ_OPTION);
372
373 if (exynos_pm_central_resume())
374 goto early_wakeup;
375
376 /* For release retention */
377 exynos_pm_release_retention();
378
379 pmu_raw_writel(exynos_pmu_spare3, S5P_PMU_SPARE3);
380
381 s3c_pm_do_restore_core(exynos_core_save, ARRAY_SIZE(exynos_core_save));
382
383early_wakeup:
384
385 tmp = pmu_raw_readl(EXYNOS5420_SFR_AXI_CGDIS1);
386 tmp &= ~EXYNOS5420_UFS;
387 pmu_raw_writel(tmp, EXYNOS5420_SFR_AXI_CGDIS1);
388
389 tmp = pmu_raw_readl(EXYNOS5420_FSYS2_OPTION);
390 tmp &= ~EXYNOS5420_EMULATION;
391 pmu_raw_writel(tmp, EXYNOS5420_FSYS2_OPTION);
392
393 tmp = pmu_raw_readl(EXYNOS5420_PSGEN_OPTION);
394 tmp &= ~EXYNOS5420_EMULATION;
395 pmu_raw_writel(tmp, EXYNOS5420_PSGEN_OPTION);
396
397 /* Clear SLEEP mode set in INFORM1 */
398 pmu_raw_writel(0x0, S5P_INFORM1);
399}
400
Bartlomiej Zolnierkiewicz0d713cf2014-09-25 18:02:45 +0900401/*
402 * Suspend Ops
403 */
404
405static int exynos_suspend_enter(suspend_state_t state)
406{
407 int ret;
408
409 s3c_pm_debug_init();
410
411 S3C_PMDBG("%s: suspending the system...\n", __func__);
412
413 S3C_PMDBG("%s: wakeup masks: %08x,%08x\n", __func__,
414 exynos_irqwake_intmask, exynos_get_eint_wake_mask());
415
416 if (exynos_irqwake_intmask == -1U
417 && exynos_get_eint_wake_mask() == -1U) {
418 pr_err("%s: No wake-up sources!\n", __func__);
419 pr_err("%s: Aborting sleep\n", __func__);
420 return -EINVAL;
421 }
422
423 s3c_pm_save_uarts();
424 if (pm_data->pm_prepare)
425 pm_data->pm_prepare();
426 flush_cache_all();
427 s3c_pm_check_store();
428
429 ret = call_firmware_op(suspend);
430 if (ret == -ENOSYS)
431 ret = cpu_suspend(0, pm_data->cpu_suspend);
432 if (ret)
433 return ret;
434
Abhilash Kesavanadc548d2014-11-07 09:20:16 +0900435 if (pm_data->pm_resume_prepare)
436 pm_data->pm_resume_prepare();
Bartlomiej Zolnierkiewicz0d713cf2014-09-25 18:02:45 +0900437 s3c_pm_restore_uarts();
438
439 S3C_PMDBG("%s: wakeup stat: %08x\n", __func__,
440 pmu_raw_readl(S5P_WAKEUP_STAT));
441
442 s3c_pm_check_restore();
443
444 S3C_PMDBG("%s: resuming the system...\n", __func__);
445
446 return 0;
447}
448
449static int exynos_suspend_prepare(void)
450{
Javier Martinez Canillasc645a592014-11-13 11:14:40 +0900451 int ret;
452
453 /*
454 * REVISIT: It would be better if struct platform_suspend_ops
455 * .prepare handler get the suspend_state_t as a parameter to
456 * avoid hard-coding the suspend to mem state. It's safe to do
457 * it now only because the suspend_valid_only_mem function is
458 * used as the .valid callback used to check if a given state
459 * is supported by the platform anyways.
460 */
461 ret = regulator_suspend_prepare(PM_SUSPEND_MEM);
462 if (ret) {
463 pr_err("Failed to prepare regulators for suspend (%d)\n", ret);
464 return ret;
465 }
466
Bartlomiej Zolnierkiewicz0d713cf2014-09-25 18:02:45 +0900467 s3c_pm_check_prepare();
468
469 return 0;
470}
471
472static void exynos_suspend_finish(void)
473{
Javier Martinez Canillasc645a592014-11-13 11:14:40 +0900474 int ret;
475
Bartlomiej Zolnierkiewicz0d713cf2014-09-25 18:02:45 +0900476 s3c_pm_check_cleanup();
Javier Martinez Canillasc645a592014-11-13 11:14:40 +0900477
478 ret = regulator_suspend_finish();
479 if (ret)
480 pr_warn("Failed to resume regulators from suspend (%d)\n", ret);
Bartlomiej Zolnierkiewicz0d713cf2014-09-25 18:02:45 +0900481}
482
483static const struct platform_suspend_ops exynos_suspend_ops = {
484 .enter = exynos_suspend_enter,
485 .prepare = exynos_suspend_prepare,
486 .finish = exynos_suspend_finish,
487 .valid = suspend_valid_only_mem,
488};
489
490static const struct exynos_pm_data exynos4_pm_data = {
491 .wkup_irq = exynos4_wkup_irq,
492 .wake_disable_mask = ((0xFF << 8) | (0x1F << 1)),
493 .release_ret_regs = exynos_release_ret_regs,
494 .pm_suspend = exynos_pm_suspend,
495 .pm_resume = exynos_pm_resume,
496 .pm_prepare = exynos_pm_prepare,
497 .cpu_suspend = exynos_cpu_suspend,
498};
499
500static const struct exynos_pm_data exynos5250_pm_data = {
501 .wkup_irq = exynos5250_wkup_irq,
502 .wake_disable_mask = ((0xFF << 8) | (0x1F << 1)),
503 .release_ret_regs = exynos_release_ret_regs,
504 .extra_save = exynos5_sys_save,
505 .num_extra_save = ARRAY_SIZE(exynos5_sys_save),
506 .pm_suspend = exynos_pm_suspend,
507 .pm_resume = exynos_pm_resume,
508 .pm_prepare = exynos_pm_prepare,
509 .cpu_suspend = exynos_cpu_suspend,
510};
511
Vikas Sajjan0fdf0882014-11-07 09:17:36 +0900512static struct exynos_pm_data exynos5420_pm_data = {
513 .wkup_irq = exynos5250_wkup_irq,
514 .wake_disable_mask = (0x7F << 7) | (0x1F << 1),
515 .release_ret_regs = exynos5420_release_ret_regs,
Abhilash Kesavanadc548d2014-11-07 09:20:16 +0900516 .pm_resume_prepare = exynos5420_prepare_pm_resume,
Vikas Sajjan0fdf0882014-11-07 09:17:36 +0900517 .pm_resume = exynos5420_pm_resume,
518 .pm_suspend = exynos5420_pm_suspend,
519 .pm_prepare = exynos5420_pm_prepare,
520 .cpu_suspend = exynos5420_cpu_suspend,
521};
522
Bartlomiej Zolnierkiewicz0d713cf2014-09-25 18:02:45 +0900523static struct of_device_id exynos_pmu_of_device_ids[] = {
524 {
525 .compatible = "samsung,exynos4210-pmu",
526 .data = &exynos4_pm_data,
527 }, {
528 .compatible = "samsung,exynos4212-pmu",
529 .data = &exynos4_pm_data,
530 }, {
531 .compatible = "samsung,exynos4412-pmu",
532 .data = &exynos4_pm_data,
533 }, {
534 .compatible = "samsung,exynos5250-pmu",
535 .data = &exynos5250_pm_data,
Vikas Sajjan0fdf0882014-11-07 09:17:36 +0900536 }, {
537 .compatible = "samsung,exynos5420-pmu",
538 .data = &exynos5420_pm_data,
Bartlomiej Zolnierkiewicz0d713cf2014-09-25 18:02:45 +0900539 },
540 { /*sentinel*/ },
541};
542
543static struct syscore_ops exynos_pm_syscore_ops;
544
545void __init exynos_pm_init(void)
546{
547 const struct of_device_id *match;
548 u32 tmp;
549
550 of_find_matching_node_and_match(NULL, exynos_pmu_of_device_ids, &match);
551 if (!match) {
552 pr_err("Failed to find PMU node\n");
553 return;
554 }
555 pm_data = (struct exynos_pm_data *) match->data;
556
557 /* Platform-specific GIC callback */
558 gic_arch_extn.irq_set_wake = exynos_irq_set_wake;
559
560 /* All wakeup disable */
561 tmp = pmu_raw_readl(S5P_WAKEUP_MASK);
562 tmp |= pm_data->wake_disable_mask;
563 pmu_raw_writel(tmp, S5P_WAKEUP_MASK);
564
565 exynos_pm_syscore_ops.suspend = pm_data->pm_suspend;
566 exynos_pm_syscore_ops.resume = pm_data->pm_resume;
567
568 register_syscore_ops(&exynos_pm_syscore_ops);
569 suspend_set_ops(&exynos_suspend_ops);
570}