diff options
Diffstat (limited to 'arch/arm/mach-s3c2410/pm.c')
-rw-r--r-- | arch/arm/mach-s3c2410/pm.c | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/arch/arm/mach-s3c2410/pm.c b/arch/arm/mach-s3c2410/pm.c index 46dedd37f438..9402583a1294 100644 --- a/arch/arm/mach-s3c2410/pm.c +++ b/arch/arm/mach-s3c2410/pm.c | |||
@@ -142,7 +142,7 @@ static struct sleep_save uart_save[] = { | |||
142 | 142 | ||
143 | extern void printascii(const char *); | 143 | extern void printascii(const char *); |
144 | 144 | ||
145 | static void pm_dbg(const char *fmt, ...) | 145 | void pm_dbg(const char *fmt, ...) |
146 | { | 146 | { |
147 | va_list va; | 147 | va_list va; |
148 | char buff[256]; | 148 | char buff[256]; |
@@ -486,6 +486,9 @@ static void s3c2410_pm_configure_extint(void) | |||
486 | } | 486 | } |
487 | } | 487 | } |
488 | 488 | ||
489 | void (*pm_cpu_prep)(void); | ||
490 | void (*pm_cpu_sleep)(void); | ||
491 | |||
489 | #define any_allowed(mask, allow) (((mask) & (allow)) != (allow)) | 492 | #define any_allowed(mask, allow) (((mask) & (allow)) != (allow)) |
490 | 493 | ||
491 | /* s3c2410_pm_enter | 494 | /* s3c2410_pm_enter |
@@ -496,7 +499,6 @@ static void s3c2410_pm_configure_extint(void) | |||
496 | static int s3c2410_pm_enter(suspend_state_t state) | 499 | static int s3c2410_pm_enter(suspend_state_t state) |
497 | { | 500 | { |
498 | unsigned long regs_save[16]; | 501 | unsigned long regs_save[16]; |
499 | unsigned long tmp; | ||
500 | 502 | ||
501 | /* ensure the debug is initialised (if enabled) */ | 503 | /* ensure the debug is initialised (if enabled) */ |
502 | 504 | ||
@@ -504,6 +506,11 @@ static int s3c2410_pm_enter(suspend_state_t state) | |||
504 | 506 | ||
505 | DBG("s3c2410_pm_enter(%d)\n", state); | 507 | DBG("s3c2410_pm_enter(%d)\n", state); |
506 | 508 | ||
509 | if (pm_cpu_prep == NULL || pm_cpu_sleep == NULL) { | ||
510 | printk(KERN_ERR PFX "error: no cpu sleep functions set\n"); | ||
511 | return -EINVAL; | ||
512 | } | ||
513 | |||
507 | if (state != PM_SUSPEND_MEM) { | 514 | if (state != PM_SUSPEND_MEM) { |
508 | printk(KERN_ERR PFX "error: only PM_SUSPEND_MEM supported\n"); | 515 | printk(KERN_ERR PFX "error: only PM_SUSPEND_MEM supported\n"); |
509 | return -EINVAL; | 516 | return -EINVAL; |
@@ -531,13 +538,6 @@ static int s3c2410_pm_enter(suspend_state_t state) | |||
531 | 538 | ||
532 | DBG("s3c2410_sleep_save_phys=0x%08lx\n", s3c2410_sleep_save_phys); | 539 | DBG("s3c2410_sleep_save_phys=0x%08lx\n", s3c2410_sleep_save_phys); |
533 | 540 | ||
534 | /* ensure at least GESTATUS3 has the resume address */ | ||
535 | |||
536 | __raw_writel(virt_to_phys(s3c2410_cpu_resume), S3C2410_GSTATUS3); | ||
537 | |||
538 | DBG("GSTATUS3 0x%08x\n", __raw_readl(S3C2410_GSTATUS3)); | ||
539 | DBG("GSTATUS4 0x%08x\n", __raw_readl(S3C2410_GSTATUS4)); | ||
540 | |||
541 | /* save all necessary core registers not covered by the drivers */ | 541 | /* save all necessary core registers not covered by the drivers */ |
542 | 542 | ||
543 | s3c2410_pm_do_save(gpio_save, ARRAY_SIZE(gpio_save)); | 543 | s3c2410_pm_do_save(gpio_save, ARRAY_SIZE(gpio_save)); |
@@ -558,6 +558,10 @@ static int s3c2410_pm_enter(suspend_state_t state) | |||
558 | 558 | ||
559 | __raw_writel(__raw_readl(S3C2410_EINTPEND), S3C2410_EINTPEND); | 559 | __raw_writel(__raw_readl(S3C2410_EINTPEND), S3C2410_EINTPEND); |
560 | 560 | ||
561 | /* call cpu specific preperation */ | ||
562 | |||
563 | pm_cpu_prep(); | ||
564 | |||
561 | /* flush cache back to ram */ | 565 | /* flush cache back to ram */ |
562 | 566 | ||
563 | flush_cache_all(); | 567 | flush_cache_all(); |
@@ -574,19 +578,13 @@ static int s3c2410_pm_enter(suspend_state_t state) | |||
574 | 578 | ||
575 | if (s3c2410_cpu_save(regs_save) == 0) { | 579 | if (s3c2410_cpu_save(regs_save) == 0) { |
576 | flush_cache_all(); | 580 | flush_cache_all(); |
577 | s3c2410_cpu_suspend(); | 581 | pm_cpu_sleep(); |
578 | } | 582 | } |
579 | 583 | ||
580 | /* restore the cpu state */ | 584 | /* restore the cpu state */ |
581 | 585 | ||
582 | cpu_init(); | 586 | cpu_init(); |
583 | 587 | ||
584 | /* unset the return-from-sleep flag, to ensure reset */ | ||
585 | |||
586 | tmp = __raw_readl(S3C2410_GSTATUS2); | ||
587 | tmp &= S3C2410_GSTATUS2_OFFRESET; | ||
588 | __raw_writel(tmp, S3C2410_GSTATUS2); | ||
589 | |||
590 | /* restore the system state */ | 588 | /* restore the system state */ |
591 | 589 | ||
592 | s3c2410_pm_do_restore_core(core_save, ARRAY_SIZE(core_save)); | 590 | s3c2410_pm_do_restore_core(core_save, ARRAY_SIZE(core_save)); |