mm: make wait_on_page_writeback() wait for multiple pending writebacks
[linux/fpc-iii.git] / arch / arm / mach-s3c / pm-s3c2416.c
blobf69ad84cf4ff1f6ea11b8640ea61abfac5f0c820
1 // SPDX-License-Identifier: GPL-2.0
2 //
3 // Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 // http://www.samsung.com
5 //
6 // S3C2416 - PM support (Based on Ben Dooks' S3C2412 PM support)
8 #include <linux/device.h>
9 #include <linux/syscore_ops.h>
10 #include <linux/io.h>
12 #include <asm/cacheflush.h>
14 #include "regs-s3c2443-clock.h"
16 #include "cpu.h"
17 #include "pm.h"
19 #include "s3c2412-power.h"
21 #ifdef CONFIG_PM_SLEEP
22 extern void s3c2412_sleep_enter(void);
24 static int s3c2416_cpu_suspend(unsigned long arg)
26 /* enable wakeup sources regardless of battery state */
27 __raw_writel(S3C2443_PWRCFG_SLEEP, S3C2443_PWRCFG);
29 /* set the mode as sleep, 2BED represents "Go to BED" */
30 __raw_writel(0x2BED, S3C2443_PWRMODE);
32 s3c2412_sleep_enter();
34 pr_info("Failed to suspend the system\n");
35 return 1; /* Aborting suspend */
38 static void s3c2416_pm_prepare(void)
41 * write the magic value u-boot uses to check for resume into
42 * the INFORM0 register, and ensure INFORM1 is set to the
43 * correct address to resume from.
45 __raw_writel(0x2BED, S3C2412_INFORM0);
46 __raw_writel(__pa_symbol(s3c_cpu_resume), S3C2412_INFORM1);
49 static int s3c2416_pm_add(struct device *dev, struct subsys_interface *sif)
51 pm_cpu_prep = s3c2416_pm_prepare;
52 pm_cpu_sleep = s3c2416_cpu_suspend;
54 return 0;
57 static struct subsys_interface s3c2416_pm_interface = {
58 .name = "s3c2416_pm",
59 .subsys = &s3c2416_subsys,
60 .add_dev = s3c2416_pm_add,
63 static __init int s3c2416_pm_init(void)
65 return subsys_interface_register(&s3c2416_pm_interface);
68 arch_initcall(s3c2416_pm_init);
69 #endif
71 static void s3c2416_pm_resume(void)
73 /* unset the return-from-sleep amd inform flags */
74 __raw_writel(0x0, S3C2443_PWRMODE);
75 __raw_writel(0x0, S3C2412_INFORM0);
76 __raw_writel(0x0, S3C2412_INFORM1);
79 struct syscore_ops s3c2416_pm_syscore_ops = {
80 .resume = s3c2416_pm_resume,