[IPV4]: Correct rp_filter help text.
[linux-2.6/verdex.git] / arch / arm / mach-sa1100 / pm.c
blobd674cf3431567c88bdf5181ef99a7ab17c04fb36
1 /*
2 * SA1100 Power Management Routines
4 * Copyright (c) 2001 Cliff Brake <cbrake@accelent.com>
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License.
9 * History:
11 * 2001-02-06: Cliff Brake Initial code
13 * 2001-02-25: Sukjae Cho <sjcho@east.isi.edu> &
14 * Chester Kuo <chester@linux.org.tw>
15 * Save more value for the resume function! Support
16 * Bitsy/Assabet/Freebird board
18 * 2001-08-29: Nicolas Pitre <nico@cam.org>
19 * Cleaned up, pushed platform dependent stuff
20 * in the platform specific files.
22 * 2002-05-27: Nicolas Pitre Killed sleep.h and the kmalloced save array.
23 * Storage is local on the stack now.
25 #include <linux/init.h>
26 #include <linux/suspend.h>
27 #include <linux/errno.h>
28 #include <linux/time.h>
30 #include <asm/hardware.h>
31 #include <asm/memory.h>
32 #include <asm/system.h>
33 #include <asm/mach/time.h>
35 extern void sa1100_cpu_suspend(void);
36 extern void sa1100_cpu_resume(void);
38 #define SAVE(x) sleep_save[SLEEP_SAVE_##x] = x
39 #define RESTORE(x) x = sleep_save[SLEEP_SAVE_##x]
42 * List of global SA11x0 peripheral registers to preserve.
43 * More ones like CP and general purpose register values are preserved
44 * on the stack and then the stack pointer is stored last in sleep.S.
46 enum { SLEEP_SAVE_SP = 0,
48 SLEEP_SAVE_GPDR, SLEEP_SAVE_GAFR,
49 SLEEP_SAVE_PPDR, SLEEP_SAVE_PPSR, SLEEP_SAVE_PPAR, SLEEP_SAVE_PSDR,
51 SLEEP_SAVE_Ser1SDCR0,
53 SLEEP_SAVE_SIZE
57 static int sa11x0_pm_enter(suspend_state_t state)
59 unsigned long gpio, sleep_save[SLEEP_SAVE_SIZE];
60 struct timespec delta, rtc;
62 /* preserve current time */
63 rtc.tv_sec = RCNR;
64 rtc.tv_nsec = 0;
65 save_time_delta(&delta, &rtc);
66 gpio = GPLR;
68 /* save vital registers */
69 SAVE(GPDR);
70 SAVE(GAFR);
72 SAVE(PPDR);
73 SAVE(PPSR);
74 SAVE(PPAR);
75 SAVE(PSDR);
77 SAVE(Ser1SDCR0);
79 /* Clear previous reset status */
80 RCSR = RCSR_HWR | RCSR_SWR | RCSR_WDR | RCSR_SMR;
82 /* set resume return address */
83 PSPR = virt_to_phys(sa1100_cpu_resume);
85 /* go zzz */
86 sa1100_cpu_suspend();
88 cpu_init();
91 * Ensure not to come back here if it wasn't intended
93 PSPR = 0;
96 * Ensure interrupt sources are disabled; we will re-init
97 * the interrupt subsystem via the device manager.
99 ICLR = 0;
100 ICCR = 1;
101 ICMR = 0;
103 /* restore registers */
104 RESTORE(GPDR);
105 RESTORE(GAFR);
107 RESTORE(PPDR);
108 RESTORE(PPSR);
109 RESTORE(PPAR);
110 RESTORE(PSDR);
112 RESTORE(Ser1SDCR0);
114 GPSR = gpio;
115 GPCR = ~gpio;
118 * Clear the peripheral sleep-hold bit.
120 PSSR = PSSR_PH;
122 /* restore current time */
123 rtc.tv_sec = RCNR;
124 restore_time_delta(&delta, &rtc);
126 return 0;
129 unsigned long sleep_phys_sp(void *sp)
131 return virt_to_phys(sp);
134 static struct pm_ops sa11x0_pm_ops = {
135 .enter = sa11x0_pm_enter,
136 .valid = pm_valid_only_mem,
139 static int __init sa11x0_pm_init(void)
141 pm_set_ops(&sa11x0_pm_ops);
142 return 0;
145 late_initcall(sa11x0_pm_init);