aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-pxa
diff options
context:
space:
mode:
authorSergey Lapin <slapin@ossfans.org>2008-08-29 10:53:24 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-10-09 10:12:07 -0400
commitfda50a1c49ad7483eaa29a268d560422c413933f (patch)
treed7b066fd49df37879f261c92f8b1bfcce4aad402 /arch/arm/mach-pxa
parentd8aa0251f12546e9bd1e9ee1d9782d6492819a04 (diff)
[ARM] 5239/1: Palm Zire 72 power management support
This patch contains Palm Zire 72 power management support. Depends on #5238/1 Signed-off-by: Sergey Lapin <slapin@ossfans.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-pxa')
-rw-r--r--arch/arm/mach-pxa/include/mach/palmz72.h13
-rw-r--r--arch/arm/mach-pxa/palmz72.c74
2 files changed, 87 insertions, 0 deletions
diff --git a/arch/arm/mach-pxa/include/mach/palmz72.h b/arch/arm/mach-pxa/include/mach/palmz72.h
index 8fd30bcecb7c..5032307ebf7d 100644
--- a/arch/arm/mach-pxa/include/mach/palmz72.h
+++ b/arch/arm/mach-pxa/include/mach/palmz72.h
@@ -63,5 +63,18 @@
63#define PALMZ72_PRESCALER 0x3F 63#define PALMZ72_PRESCALER 0x3F
64#define PALMZ72_PERIOD_NS 3500 64#define PALMZ72_PERIOD_NS 3500
65 65
66#ifdef CONFIG_PM
67struct palmz72_resume_info {
68 u32 magic0; /* 0x0 */
69 u32 magic1; /* 0x4 */
70 u32 resume_addr; /* 0x8 */
71 u32 pad[11]; /* 0xc..0x37 */
72 u32 arm_control; /* 0x38 */
73 u32 aux_control; /* 0x3c */
74 u32 ttb; /* 0x40 */
75 u32 domain_access; /* 0x44 */
76 u32 process_id; /* 0x48 */
77};
78#endif
66#endif 79#endif
67 80
diff --git a/arch/arm/mach-pxa/palmz72.c b/arch/arm/mach-pxa/palmz72.c
index a90b4d77a201..2f730da3bba8 100644
--- a/arch/arm/mach-pxa/palmz72.c
+++ b/arch/arm/mach-pxa/palmz72.c
@@ -449,6 +449,80 @@ static struct pxafb_mach_info palmz72_lcd_screen = {
449 .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL, 449 .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
450}; 450};
451 451
452#ifdef CONFIG_PM
453
454/* We have some black magic here
455 * PalmOS ROM on recover expects special struct physical address
456 * to be transferred via PSPR. Using this struct PalmOS restores
457 * its state after sleep. As for Linux, we need to setup it the
458 * same way. More than that, PalmOS ROM changes some values in memory.
459 * For now only one location is found, which needs special treatment.
460 * Thanks to Alex Osborne, Andrzej Zaborowski, and lots of other people
461 * for reading backtraces for me :)
462 */
463
464#define PALMZ72_SAVE_DWORD ((unsigned long *)0xc0000050)
465
466static struct palmz72_resume_info palmz72_resume_info = {
467 .magic0 = 0xb4e6,
468 .magic1 = 1,
469
470 /* reset state, MMU off etc */
471 .arm_control = 0,
472 .aux_control = 0,
473 .ttb = 0,
474 .domain_access = 0,
475 .process_id = 0,
476};
477
478static unsigned long store_ptr;
479
480/* sys_device for Palm Zire 72 PM */
481
482static int palmz72_pm_suspend(struct sys_device *dev, pm_message_t msg)
483{
484 /* setup the resume_info struct for the original bootloader */
485 palmz72_resume_info.resume_addr = (u32) pxa_cpu_resume;
486
487 /* Storing memory touched by ROM */
488 store_ptr = *PALMZ72_SAVE_DWORD;
489
490 /* Setting PSPR to a proper value */
491 PSPR = virt_to_phys(&palmz72_resume_info);
492
493 return 0;
494}
495
496static int palmz72_pm_resume(struct sys_device *dev)
497{
498 *PALMZ72_SAVE_DWORD = store_ptr;
499 return 0;
500}
501
502static struct sysdev_class palmz72_pm_sysclass = {
503 .name = "palmz72_pm",
504 .suspend = palmz72_pm_suspend,
505 .resume = palmz72_pm_resume,
506};
507
508static struct sys_device palmz72_pm_device = {
509 .cls = &palmz72_pm_sysclass,
510};
511
512static int __init palmz72_pm_init(void)
513{
514 int ret = -ENODEV;
515 if (machine_is_palmz72()) {
516 ret = sysdev_class_register(&palmz72_pm_sysclass);
517 if (ret == 0)
518 ret = sysdev_register(&palmz72_pm_device);
519 }
520 return ret;
521}
522
523device_initcall(palmz72_pm_init);
524#endif
525
452/****************************************************************************** 526/******************************************************************************
453 * Machine init 527 * Machine init
454 ******************************************************************************/ 528 ******************************************************************************/