aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorBen Dooks <ben-linux@fluff.org>2008-12-11 19:24:06 -0500
committerBen Dooks <ben-linux@fluff.org>2009-03-08 08:23:51 -0400
commit6419711a164ba1304fa8fbb75ae9485455e04dcd (patch)
tree15fe79b0ffff33d253258b849f1b69ac4c2c3bbe /arch
parenta3f66351b3cc89011e8a34068c245b413ce696d6 (diff)
[ARM] S3C: Move PM support functions to common location
Start moving the PM code by moving all the common support functions to a common location in arch/arm/plat-s3c. With the move we rename the functions from s3cxxx_ to s3c_ to fit the new location. Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-s3c2410/pm.c11
-rw-r--r--arch/arm/mach-s3c2412/pm.c4
-rw-r--r--arch/arm/plat-s3c/Makefile4
-rw-r--r--arch/arm/plat-s3c/include/plat/pm.h36
-rw-r--r--arch/arm/plat-s3c/pm.c97
-rw-r--r--arch/arm/plat-s3c24xx/irq.c4
-rw-r--r--arch/arm/plat-s3c24xx/pm.c113
-rw-r--r--arch/arm/plat-s3c24xx/s3c244x.c4
-rw-r--r--arch/arm/plat-s3c24xx/sleep.S8
9 files changed, 171 insertions, 110 deletions
diff --git a/arch/arm/mach-s3c2410/pm.c b/arch/arm/mach-s3c2410/pm.c
index a6970f613192..72f96869aa94 100644
--- a/arch/arm/mach-s3c2410/pm.c
+++ b/arch/arm/mach-s3c2410/pm.c
@@ -37,21 +37,14 @@
37#include <plat/cpu.h> 37#include <plat/cpu.h>
38#include <plat/pm.h> 38#include <plat/pm.h>
39 39
40#ifdef CONFIG_S3C2410_PM_DEBUG
41extern void pm_dbg(const char *fmt, ...);
42#define DBG(fmt...) pm_dbg(fmt)
43#else
44#define DBG(fmt...) printk(KERN_DEBUG fmt)
45#endif
46
47static void s3c2410_pm_prepare(void) 40static void s3c2410_pm_prepare(void)
48{ 41{
49 /* ensure at least GSTATUS3 has the resume address */ 42 /* ensure at least GSTATUS3 has the resume address */
50 43
51 __raw_writel(virt_to_phys(s3c2410_cpu_resume), S3C2410_GSTATUS3); 44 __raw_writel(virt_to_phys(s3c2410_cpu_resume), S3C2410_GSTATUS3);
52 45
53 DBG("GSTATUS3 0x%08x\n", __raw_readl(S3C2410_GSTATUS3)); 46 S3C_PMDBG("GSTATUS3 0x%08x\n", __raw_readl(S3C2410_GSTATUS3));
54 DBG("GSTATUS4 0x%08x\n", __raw_readl(S3C2410_GSTATUS4)); 47 S3C_PMDBG("GSTATUS4 0x%08x\n", __raw_readl(S3C2410_GSTATUS4));
55 48
56 if (machine_is_h1940()) { 49 if (machine_is_h1940()) {
57 void *base = phys_to_virt(H1940_SUSPEND_CHECK); 50 void *base = phys_to_virt(H1940_SUSPEND_CHECK);
diff --git a/arch/arm/mach-s3c2412/pm.c b/arch/arm/mach-s3c2412/pm.c
index 217e9e4ed45f..c9cfe40e21f6 100644
--- a/arch/arm/mach-s3c2412/pm.c
+++ b/arch/arm/mach-s3c2412/pm.c
@@ -85,7 +85,7 @@ static struct sleep_save s3c2412_sleep[] = {
85 85
86static int s3c2412_pm_suspend(struct sys_device *dev, pm_message_t state) 86static int s3c2412_pm_suspend(struct sys_device *dev, pm_message_t state)
87{ 87{
88 s3c2410_pm_do_save(s3c2412_sleep, ARRAY_SIZE(s3c2412_sleep)); 88 s3c_pm_do_save(s3c2412_sleep, ARRAY_SIZE(s3c2412_sleep));
89 return 0; 89 return 0;
90} 90}
91 91
@@ -98,7 +98,7 @@ static int s3c2412_pm_resume(struct sys_device *dev)
98 tmp |= S3C2412_PWRCFG_STANDBYWFI_IDLE; 98 tmp |= S3C2412_PWRCFG_STANDBYWFI_IDLE;
99 __raw_writel(tmp, S3C2412_PWRCFG); 99 __raw_writel(tmp, S3C2412_PWRCFG);
100 100
101 s3c2410_pm_do_restore(s3c2412_sleep, ARRAY_SIZE(s3c2412_sleep)); 101 s3c_pm_do_restore(s3c2412_sleep, ARRAY_SIZE(s3c2412_sleep));
102 return 0; 102 return 0;
103} 103}
104 104
diff --git a/arch/arm/plat-s3c/Makefile b/arch/arm/plat-s3c/Makefile
index 39195f972d5e..afd8d089ba16 100644
--- a/arch/arm/plat-s3c/Makefile
+++ b/arch/arm/plat-s3c/Makefile
@@ -18,6 +18,10 @@ obj-y += pwm-clock.o
18obj-y += gpio.o 18obj-y += gpio.o
19obj-y += gpio-config.o 19obj-y += gpio-config.o
20 20
21# PM support
22
23obj-$(CONFIG_PM) += pm.o
24
21# devices 25# devices
22 26
23obj-$(CONFIG_S3C_DEV_HSMMC) += dev-hsmmc.o 27obj-$(CONFIG_S3C_DEV_HSMMC) += dev-hsmmc.o
diff --git a/arch/arm/plat-s3c/include/plat/pm.h b/arch/arm/plat-s3c/include/plat/pm.h
index cc623667e48a..a1520997ab82 100644
--- a/arch/arm/plat-s3c/include/plat/pm.h
+++ b/arch/arm/plat-s3c/include/plat/pm.h
@@ -1,6 +1,7 @@
1/* linux/include/asm-arm/plat-s3c24xx/pm.h 1/* linux/include/asm-arm/plat-s3c24xx/pm.h
2 * 2 *
3 * Copyright (c) 2004 Simtec Electronics 3 * Copyright (c) 2004 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
4 * Written by Ben Dooks, <ben@simtec.co.uk> 5 * Written by Ben Dooks, <ben@simtec.co.uk>
5 * 6 *
6 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
@@ -49,10 +50,18 @@ extern int s3c2410_cpu_save(unsigned long *saveblk);
49extern void s3c2410_cpu_suspend(void); 50extern void s3c2410_cpu_suspend(void);
50extern void s3c2410_cpu_resume(void); 51extern void s3c2410_cpu_resume(void);
51 52
52extern unsigned long s3c2410_sleep_save_phys; 53extern unsigned long s3c_sleep_save_phys;
53 54
54/* sleep save info */ 55/* sleep save info */
55 56
57/**
58 * struct sleep_save - save information for shared peripherals.
59 * @reg: Pointer to the register to save.
60 * @val: Holder for the value saved from reg.
61 *
62 * This describes a list of registers which is used by the pm core and
63 * other subsystem to save and restore register values over suspend.
64 */
56struct sleep_save { 65struct sleep_save {
57 void __iomem *reg; 66 void __iomem *reg;
58 unsigned long val; 67 unsigned long val;
@@ -61,8 +70,11 @@ struct sleep_save {
61#define SAVE_ITEM(x) \ 70#define SAVE_ITEM(x) \
62 { .reg = (x) } 71 { .reg = (x) }
63 72
64extern void s3c2410_pm_do_save(struct sleep_save *ptr, int count); 73/* helper functions to save/restore lists of registers. */
65extern void s3c2410_pm_do_restore(struct sleep_save *ptr, int count); 74
75extern void s3c_pm_do_save(struct sleep_save *ptr, int count);
76extern void s3c_pm_do_restore(struct sleep_save *ptr, int count);
77extern void s3c_pm_do_restore_core(struct sleep_save *ptr, int count);
66 78
67#ifdef CONFIG_PM 79#ifdef CONFIG_PM
68extern int s3c24xx_irq_suspend(struct sys_device *dev, pm_message_t state); 80extern int s3c24xx_irq_suspend(struct sys_device *dev, pm_message_t state);
@@ -71,3 +83,21 @@ extern int s3c24xx_irq_resume(struct sys_device *dev);
71#define s3c24xx_irq_suspend NULL 83#define s3c24xx_irq_suspend NULL
72#define s3c24xx_irq_resume NULL 84#define s3c24xx_irq_resume NULL
73#endif 85#endif
86
87/* PM debug functions */
88
89#ifdef CONFIG_S3C2410_PM_DEBUG
90/**
91 * s3c_pm_dbg() - low level debug function for use in suspend/resume.
92 * @msg: The message to print.
93 *
94 * This function is used mainly to debug the resume process before the system
95 * can rely on printk/console output. It uses the low-level debugging output
96 * routine printascii() to do its work.
97 */
98extern void s3c_pm_dbg(const char *msg, ...);
99
100#define S3C_PMDBG(fmt...) s3c_pm_dbg(fmt)
101#else
102#define S3C_PMDBG(fmt...) printk(KERN_DEBUG fmt)
103#endif
diff --git a/arch/arm/plat-s3c/pm.c b/arch/arm/plat-s3c/pm.c
new file mode 100644
index 000000000000..122e9b91a7f4
--- /dev/null
+++ b/arch/arm/plat-s3c/pm.c
@@ -0,0 +1,97 @@
1/* linux/arch/arm/plat-s3c/pm.c
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2004,2006,2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * S3C common power management (suspend to ram) support.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#include <linux/init.h>
16#include <linux/suspend.h>
17#include <linux/errno.h>
18#include <linux/io.h>
19
20#include <plat/pm.h>
21
22/* for external use */
23
24unsigned long s3c_pm_flags;
25
26#ifdef CONFIG_S3C2410_PM_DEBUG
27extern void printascii(const char *);
28
29void s3c_pm_dbg(const char *fmt, ...)
30{
31 va_list va;
32 char buff[256];
33
34 va_start(va, fmt);
35 vsprintf(buff, fmt, va);
36 va_end(va);
37
38 printascii(buff);
39}
40#endif /* CONFIG_S3C2410_PM_DEBUG */
41
42
43/* helper functions to save and restore register state */
44
45/**
46 * s3c_pm_do_save() - save a set of registers for restoration on resume.
47 * @ptr: Pointer to an array of registers.
48 * @count: Size of the ptr array.
49 *
50 * Run through the list of registers given, saving their contents in the
51 * array for later restoration when we wakeup.
52 */
53void s3c_pm_do_save(struct sleep_save *ptr, int count)
54{
55 for (; count > 0; count--, ptr++) {
56 ptr->val = __raw_readl(ptr->reg);
57 S3C_PMDBG("saved %p value %08lx\n", ptr->reg, ptr->val);
58 }
59}
60
61/**
62 * s3c_pm_do_restore() - restore register values from the save list.
63 * @ptr: Pointer to an array of registers.
64 * @count: Size of the ptr array.
65 *
66 * Restore the register values saved from s3c_pm_do_save().
67 *
68 * Note, we do not use S3C_PMDBG() in here, as the system may not have
69 * restore the UARTs state yet
70*/
71
72void s3c_pm_do_restore(struct sleep_save *ptr, int count)
73{
74 for (; count > 0; count--, ptr++) {
75 printk(KERN_DEBUG "restore %p (restore %08lx, was %08x)\n",
76 ptr->reg, ptr->val, __raw_readl(ptr->reg));
77
78 __raw_writel(ptr->val, ptr->reg);
79 }
80}
81
82/**
83 * s3c_pm_do_restore_core() - early restore register values from save list.
84 *
85 * This is similar to s3c_pm_do_restore() except we try and minimise the
86 * side effects of the function in case registers that hardware might need
87 * to work has been restored.
88 *
89 * WARNING: Do not put any debug in here that may effect memory or use
90 * peripherals, as things may be changing!
91*/
92
93void s3c_pm_do_restore_core(struct sleep_save *ptr, int count)
94{
95 for (; count > 0; count--, ptr++)
96 __raw_writel(ptr->val, ptr->reg);
97}
diff --git a/arch/arm/plat-s3c24xx/irq.c b/arch/arm/plat-s3c24xx/irq.c
index 0192ecdc1442..2fa8c9f4b354 100644
--- a/arch/arm/plat-s3c24xx/irq.c
+++ b/arch/arm/plat-s3c24xx/irq.c
@@ -616,7 +616,7 @@ int s3c24xx_irq_suspend(struct sys_device *dev, pm_message_t state)
616 for (i = 0; i < ARRAY_SIZE(save_eintflt); i++) 616 for (i = 0; i < ARRAY_SIZE(save_eintflt); i++)
617 save_eintflt[i] = __raw_readl(S3C24XX_EINFLT0 + (i*4)); 617 save_eintflt[i] = __raw_readl(S3C24XX_EINFLT0 + (i*4));
618 618
619 s3c2410_pm_do_save(irq_save, ARRAY_SIZE(irq_save)); 619 s3c_pm_do_save(irq_save, ARRAY_SIZE(irq_save));
620 save_eintmask = __raw_readl(S3C24XX_EINTMASK); 620 save_eintmask = __raw_readl(S3C24XX_EINTMASK);
621 621
622 return 0; 622 return 0;
@@ -632,7 +632,7 @@ int s3c24xx_irq_resume(struct sys_device *dev)
632 for (i = 0; i < ARRAY_SIZE(save_eintflt); i++) 632 for (i = 0; i < ARRAY_SIZE(save_eintflt); i++)
633 __raw_writel(save_eintflt[i], S3C24XX_EINFLT0 + (i*4)); 633 __raw_writel(save_eintflt[i], S3C24XX_EINFLT0 + (i*4));
634 634
635 s3c2410_pm_do_restore(irq_save, ARRAY_SIZE(irq_save)); 635 s3c_pm_do_restore(irq_save, ARRAY_SIZE(irq_save));
636 __raw_writel(save_eintmask, S3C24XX_EINTMASK); 636 __raw_writel(save_eintmask, S3C24XX_EINTMASK);
637 637
638 return 0; 638 return 0;
diff --git a/arch/arm/plat-s3c24xx/pm.c b/arch/arm/plat-s3c24xx/pm.c
index 34ef18e5b2a1..c161f9c9a1d4 100644
--- a/arch/arm/plat-s3c24xx/pm.c
+++ b/arch/arm/plat-s3c24xx/pm.c
@@ -49,9 +49,6 @@
49 49
50#include <plat/pm.h> 50#include <plat/pm.h>
51 51
52/* for external use */
53
54unsigned long s3c_pm_flags;
55 52
56#define PFX "s3c24xx-pm: " 53#define PFX "s3c24xx-pm: "
57 54
@@ -143,20 +140,6 @@ static struct sleep_save uart_save[] = {
143 * system never wakes up from the sleep 140 * system never wakes up from the sleep
144*/ 141*/
145 142
146extern void printascii(const char *);
147
148void pm_dbg(const char *fmt, ...)
149{
150 va_list va;
151 char buff[256];
152
153 va_start(va, fmt);
154 vsprintf(buff, fmt, va);
155 va_end(va);
156
157 printascii(buff);
158}
159
160static void s3c2410_pm_debug_init(void) 143static void s3c2410_pm_debug_init(void)
161{ 144{
162 unsigned long tmp = __raw_readl(S3C2410_CLKCON); 145 unsigned long tmp = __raw_readl(S3C2410_CLKCON);
@@ -170,10 +153,7 @@ static void s3c2410_pm_debug_init(void)
170 udelay(10); 153 udelay(10);
171} 154}
172 155
173#define DBG(fmt...) pm_dbg(fmt)
174#else 156#else
175#define DBG(fmt...) printk(KERN_DEBUG fmt)
176
177#define s3c2410_pm_debug_init() do { } while(0) 157#define s3c2410_pm_debug_init() do { } while(0)
178 158
179static struct sleep_save uart_save[] = {}; 159static struct sleep_save uart_save[] = {};
@@ -211,7 +191,7 @@ static void s3c2410_pm_run_res(struct resource *ptr, run_fn_t fn, u32 *arg)
211 191
212 if ((ptr->flags & IORESOURCE_MEM) && 192 if ((ptr->flags & IORESOURCE_MEM) &&
213 strcmp(ptr->name, "System RAM") == 0) { 193 strcmp(ptr->name, "System RAM") == 0) {
214 DBG("Found system RAM at %08lx..%08lx\n", 194 S3C_PMDBG("Found system RAM at %08lx..%08lx\n",
215 ptr->start, ptr->end); 195 ptr->start, ptr->end);
216 arg = (fn)(ptr, arg); 196 arg = (fn)(ptr, arg);
217 } 197 }
@@ -232,7 +212,7 @@ static u32 *s3c2410_pm_countram(struct resource *res, u32 *val)
232 size += CHECK_CHUNKSIZE-1; 212 size += CHECK_CHUNKSIZE-1;
233 size /= CHECK_CHUNKSIZE; 213 size /= CHECK_CHUNKSIZE;
234 214
235 DBG("Area %08lx..%08lx, %d blocks\n", res->start, res->end, size); 215 S3C_PMDBG("Area %08lx..%08lx, %d blocks\n", res->start, res->end, size);
236 216
237 *val += size * sizeof(u32); 217 *val += size * sizeof(u32);
238 return val; 218 return val;
@@ -252,7 +232,7 @@ static void s3c2410_pm_check_prepare(void)
252 232
253 s3c2410_pm_run_sysram(s3c2410_pm_countram, &crc_size); 233 s3c2410_pm_run_sysram(s3c2410_pm_countram, &crc_size);
254 234
255 DBG("s3c2410_pm_prepare_check: %u checks needed\n", crc_size); 235 S3C_PMDBG("s3c2410_pm_prepare_check: %u checks needed\n", crc_size);
256 236
257 crcs = kmalloc(crc_size+4, GFP_KERNEL); 237 crcs = kmalloc(crc_size+4, GFP_KERNEL);
258 if (crcs == NULL) 238 if (crcs == NULL)
@@ -308,7 +288,7 @@ static inline int in_region(void *ptr, int size, void *what, size_t whatsz)
308 288
309static u32 *s3c2410_pm_runcheck(struct resource *res, u32 *val) 289static u32 *s3c2410_pm_runcheck(struct resource *res, u32 *val)
310{ 290{
311 void *save_at = phys_to_virt(s3c2410_sleep_save_phys); 291 void *save_at = phys_to_virt(s3c_sleep_save_phys);
312 unsigned long addr; 292 unsigned long addr;
313 unsigned long left; 293 unsigned long left;
314 void *ptr; 294 void *ptr;
@@ -324,12 +304,12 @@ static u32 *s3c2410_pm_runcheck(struct resource *res, u32 *val)
324 ptr = phys_to_virt(addr); 304 ptr = phys_to_virt(addr);
325 305
326 if (in_region(ptr, left, crcs, crc_size)) { 306 if (in_region(ptr, left, crcs, crc_size)) {
327 DBG("skipping %08lx, has crc block in\n", addr); 307 S3C_PMDBG("skipping %08lx, has crc block in\n", addr);
328 goto skip_check; 308 goto skip_check;
329 } 309 }
330 310
331 if (in_region(ptr, left, save_at, 32*4 )) { 311 if (in_region(ptr, left, save_at, 32*4 )) {
332 DBG("skipping %08lx, has save block in\n", addr); 312 S3C_PMDBG("skipping %08lx, has save block in\n", addr);
333 goto skip_check; 313 goto skip_check;
334 } 314 }
335 315
@@ -340,7 +320,7 @@ static u32 *s3c2410_pm_runcheck(struct resource *res, u32 *val)
340 printk(KERN_ERR PFX "Restore CRC error at " 320 printk(KERN_ERR PFX "Restore CRC error at "
341 "%08lx (%08x vs %08x)\n", addr, calc, *val); 321 "%08lx (%08x vs %08x)\n", addr, calc, *val);
342 322
343 DBG("Restore CRC error at %08lx (%08x vs %08x)\n", 323 S3C_PMDBG("Restore CRC error at %08lx (%08x vs %08x)\n",
344 addr, calc, *val); 324 addr, calc, *val);
345 } 325 }
346 326
@@ -373,49 +353,6 @@ static void s3c2410_pm_check_restore(void)
373#define s3c2410_pm_check_store() do { } while(0) 353#define s3c2410_pm_check_store() do { } while(0)
374#endif 354#endif
375 355
376/* helper functions to save and restore register state */
377
378void s3c2410_pm_do_save(struct sleep_save *ptr, int count)
379{
380 for (; count > 0; count--, ptr++) {
381 ptr->val = __raw_readl(ptr->reg);
382 DBG("saved %p value %08lx\n", ptr->reg, ptr->val);
383 }
384}
385
386/* s3c2410_pm_do_restore
387 *
388 * restore the system from the given list of saved registers
389 *
390 * Note, we do not use DBG() in here, as the system may not have
391 * restore the UARTs state yet
392*/
393
394void s3c2410_pm_do_restore(struct sleep_save *ptr, int count)
395{
396 for (; count > 0; count--, ptr++) {
397 printk(KERN_DEBUG "restore %p (restore %08lx, was %08x)\n",
398 ptr->reg, ptr->val, __raw_readl(ptr->reg));
399
400 __raw_writel(ptr->val, ptr->reg);
401 }
402}
403
404/* s3c2410_pm_do_restore_core
405 *
406 * similar to s3c2410_pm_do_restore_core
407 *
408 * WARNING: Do not put any debug in here that may effect memory or use
409 * peripherals, as things may be changing!
410*/
411
412static void s3c2410_pm_do_restore_core(struct sleep_save *ptr, int count)
413{
414 for (; count > 0; count--, ptr++) {
415 __raw_writel(ptr->val, ptr->reg);
416 }
417}
418
419/* s3c2410_pm_show_resume_irqs 356/* s3c2410_pm_show_resume_irqs
420 * 357 *
421 * print any IRQs asserted at resume time (ie, we woke from) 358 * print any IRQs asserted at resume time (ie, we woke from)
@@ -430,7 +367,7 @@ static void s3c2410_pm_show_resume_irqs(int start, unsigned long which,
430 367
431 for (i = 0; i <= 31; i++) { 368 for (i = 0; i <= 31; i++) {
432 if ((which) & (1L<<i)) { 369 if ((which) & (1L<<i)) {
433 DBG("IRQ %d asserted at resume\n", start+i); 370 S3C_PMDBG("IRQ %d asserted at resume\n", start+i);
434 } 371 }
435 } 372 }
436} 373}
@@ -456,10 +393,10 @@ static void s3c2410_pm_check_resume_pin(unsigned int pin, unsigned int irqoffs)
456 393
457 if (!irqstate) { 394 if (!irqstate) {
458 if (pinstate == S3C2410_GPIO_IRQ) 395 if (pinstate == S3C2410_GPIO_IRQ)
459 DBG("Leaving IRQ %d (pin %d) enabled\n", irq, pin); 396 S3C_PMDBG("Leaving IRQ %d (pin %d) enabled\n", irq, pin);
460 } else { 397 } else {
461 if (pinstate == S3C2410_GPIO_IRQ) { 398 if (pinstate == S3C2410_GPIO_IRQ) {
462 DBG("Disabling IRQ %d (pin %d)\n", irq, pin); 399 S3C_PMDBG("Disabling IRQ %d (pin %d)\n", irq, pin);
463 s3c2410_gpio_cfgpin(pin, S3C2410_GPIO_INPUT); 400 s3c2410_gpio_cfgpin(pin, S3C2410_GPIO_INPUT);
464 } 401 }
465 } 402 }
@@ -646,8 +583,8 @@ static void s3c2410_pm_restore_gpio(int index, struct gpio_sleep *gps)
646 __raw_writel(gps->gpup, base + OFFS_UP); 583 __raw_writel(gps->gpup, base + OFFS_UP);
647 } 584 }
648 585
649 DBG("GPIO[%d] CON %08lx => %08lx, DAT %08lx => %08lx\n", 586 S3C_PMDBG("GPIO[%d] CON %08lx => %08lx, DAT %08lx => %08lx\n",
650 index, old_gpcon, gps_gpcon, old_gpdat, gps_gpdat); 587 index, old_gpcon, gps_gpcon, old_gpdat, gps_gpdat);
651} 588}
652 589
653 590
@@ -684,7 +621,7 @@ static int s3c2410_pm_enter(suspend_state_t state)
684 621
685 s3c2410_pm_debug_init(); 622 s3c2410_pm_debug_init();
686 623
687 DBG("s3c2410_pm_enter(%d)\n", state); 624 S3C_PMDBG("s3c2410_pm_enter(%d)\n", state);
688 625
689 if (pm_cpu_prep == NULL || pm_cpu_sleep == NULL) { 626 if (pm_cpu_prep == NULL || pm_cpu_sleep == NULL) {
690 printk(KERN_ERR PFX "error: no cpu sleep functions set\n"); 627 printk(KERN_ERR PFX "error: no cpu sleep functions set\n");
@@ -709,22 +646,22 @@ static int s3c2410_pm_enter(suspend_state_t state)
709 646
710 /* store the physical address of the register recovery block */ 647 /* store the physical address of the register recovery block */
711 648
712 s3c2410_sleep_save_phys = virt_to_phys(regs_save); 649 s3c_sleep_save_phys = virt_to_phys(regs_save);
713 650
714 DBG("s3c2410_sleep_save_phys=0x%08lx\n", s3c2410_sleep_save_phys); 651 S3C_PMDBG("s3c_sleep_save_phys=0x%08lx\n", s3c_sleep_save_phys);
715 652
716 /* save all necessary core registers not covered by the drivers */ 653 /* save all necessary core registers not covered by the drivers */
717 654
718 s3c2410_pm_save_gpios(); 655 s3c2410_pm_save_gpios();
719 s3c2410_pm_do_save(misc_save, ARRAY_SIZE(misc_save)); 656 s3c_pm_do_save(misc_save, ARRAY_SIZE(misc_save));
720 s3c2410_pm_do_save(core_save, ARRAY_SIZE(core_save)); 657 s3c_pm_do_save(core_save, ARRAY_SIZE(core_save));
721 s3c2410_pm_do_save(uart_save, ARRAY_SIZE(uart_save)); 658 s3c_pm_do_save(uart_save, ARRAY_SIZE(uart_save));
722 659
723 /* set the irq configuration for wake */ 660 /* set the irq configuration for wake */
724 661
725 s3c2410_pm_configure_extint(); 662 s3c2410_pm_configure_extint();
726 663
727 DBG("sleep: irq wakeup masks: %08lx,%08lx\n", 664 S3C_PMDBG("sleep: irq wakeup masks: %08lx,%08lx\n",
728 s3c_irqwake_intmask, s3c_irqwake_eintmask); 665 s3c_irqwake_intmask, s3c_irqwake_eintmask);
729 666
730 __raw_writel(s3c_irqwake_intmask, S3C2410_INTMSK); 667 __raw_writel(s3c_irqwake_intmask, S3C2410_INTMSK);
@@ -765,16 +702,16 @@ static int s3c2410_pm_enter(suspend_state_t state)
765 702
766 /* restore the system state */ 703 /* restore the system state */
767 704
768 s3c2410_pm_do_restore_core(core_save, ARRAY_SIZE(core_save)); 705 s3c_pm_do_restore_core(core_save, ARRAY_SIZE(core_save));
769 s3c2410_pm_do_restore(misc_save, ARRAY_SIZE(misc_save)); 706 s3c_pm_do_restore(misc_save, ARRAY_SIZE(misc_save));
770 s3c2410_pm_do_restore(uart_save, ARRAY_SIZE(uart_save)); 707 s3c_pm_do_restore(uart_save, ARRAY_SIZE(uart_save));
771 s3c2410_pm_restore_gpios(); 708 s3c2410_pm_restore_gpios();
772 709
773 s3c2410_pm_debug_init(); 710 s3c2410_pm_debug_init();
774 711
775 /* check what irq (if any) restored the system */ 712 /* check what irq (if any) restored the system */
776 713
777 DBG("post sleep: IRQs 0x%08x, 0x%08x\n", 714 S3C_PMDBG("post sleep: IRQs 0x%08x, 0x%08x\n",
778 __raw_readl(S3C2410_SRCPND), 715 __raw_readl(S3C2410_SRCPND),
779 __raw_readl(S3C2410_EINTPEND)); 716 __raw_readl(S3C2410_EINTPEND));
780 717
@@ -784,13 +721,13 @@ static int s3c2410_pm_enter(suspend_state_t state)
784 s3c2410_pm_show_resume_irqs(IRQ_EINT4-4, __raw_readl(S3C2410_EINTPEND), 721 s3c2410_pm_show_resume_irqs(IRQ_EINT4-4, __raw_readl(S3C2410_EINTPEND),
785 s3c_irqwake_eintmask); 722 s3c_irqwake_eintmask);
786 723
787 DBG("post sleep, preparing to return\n"); 724 S3C_PMDBG("post sleep, preparing to return\n");
788 725
789 s3c2410_pm_check_restore(); 726 s3c2410_pm_check_restore();
790 727
791 /* ok, let's return from sleep */ 728 /* ok, let's return from sleep */
792 729
793 DBG("S3C2410 PM Resume (post-restore)\n"); 730 S3C_PMDBG("S3C2410 PM Resume (post-restore)\n");
794 return 0; 731 return 0;
795} 732}
796 733
diff --git a/arch/arm/plat-s3c24xx/s3c244x.c b/arch/arm/plat-s3c24xx/s3c244x.c
index c1de6bb0101b..1364317d421e 100644
--- a/arch/arm/plat-s3c24xx/s3c244x.c
+++ b/arch/arm/plat-s3c24xx/s3c244x.c
@@ -145,13 +145,13 @@ static struct sleep_save s3c244x_sleep[] = {
145 145
146static int s3c244x_suspend(struct sys_device *dev, pm_message_t state) 146static int s3c244x_suspend(struct sys_device *dev, pm_message_t state)
147{ 147{
148 s3c2410_pm_do_save(s3c244x_sleep, ARRAY_SIZE(s3c244x_sleep)); 148 s3c_pm_do_save(s3c244x_sleep, ARRAY_SIZE(s3c244x_sleep));
149 return 0; 149 return 0;
150} 150}
151 151
152static int s3c244x_resume(struct sys_device *dev) 152static int s3c244x_resume(struct sys_device *dev)
153{ 153{
154 s3c2410_pm_do_restore(s3c244x_sleep, ARRAY_SIZE(s3c244x_sleep)); 154 s3c_pm_do_restore(s3c244x_sleep, ARRAY_SIZE(s3c244x_sleep));
155 return 0; 155 return 0;
156} 156}
157 157
diff --git a/arch/arm/plat-s3c24xx/sleep.S b/arch/arm/plat-s3c24xx/sleep.S
index 76594b212802..7c1955ff3171 100644
--- a/arch/arm/plat-s3c24xx/sleep.S
+++ b/arch/arm/plat-s3c24xx/sleep.S
@@ -84,7 +84,7 @@ resume_with_mmu:
84 .ltorg 84 .ltorg
85 85
86 @@ the next bits sit in the .data segment, even though they 86 @@ the next bits sit in the .data segment, even though they
87 @@ happen to be code... the s3c2410_sleep_save_phys needs to be 87 @@ happen to be code... the s3c_sleep_save_phys needs to be
88 @@ accessed by the resume code before it can restore the MMU. 88 @@ accessed by the resume code before it can restore the MMU.
89 @@ This means that the variable has to be close enough for the 89 @@ This means that the variable has to be close enough for the
90 @@ code to read it... since the .text segment needs to be RO, 90 @@ code to read it... since the .text segment needs to be RO,
@@ -92,8 +92,8 @@ resume_with_mmu:
92 92
93 .data 93 .data
94 94
95 .global s3c2410_sleep_save_phys 95 .global s3c_sleep_save_phys
96s3c2410_sleep_save_phys: 96s3c_sleep_save_phys:
97 .word 0 97 .word 0
98 98
99 99
@@ -145,7 +145,7 @@ ENTRY(s3c2410_cpu_resume)
145 mcr p15, 0, r1, c8, c7, 0 @@ invalidate I & D TLBs 145 mcr p15, 0, r1, c8, c7, 0 @@ invalidate I & D TLBs
146 mcr p15, 0, r1, c7, c7, 0 @@ invalidate I & D caches 146 mcr p15, 0, r1, c7, c7, 0 @@ invalidate I & D caches
147 147
148 ldr r0, s3c2410_sleep_save_phys @ address of restore block 148 ldr r0, s3c_sleep_save_phys @ address of restore block
149 ldmia r0, { r4 - r13 } 149 ldmia r0, { r4 - r13 }
150 150
151 mcr p15, 0, r4, c13, c0, 0 @ PID 151 mcr p15, 0, r4, c13, c0, 0 @ PID