aboutsummaryrefslogtreecommitdiffstats
path: root/arch/blackfin/mach-common
diff options
context:
space:
mode:
authorMichael Hennerich <michael.hennerich@analog.com>2008-08-05 05:38:41 -0400
committerBryan Wu <cooloney@kernel.org>2008-08-05 05:38:41 -0400
commit4a88d0ce494034fbb8dd0076d80e71b38abf5748 (patch)
treec9c560f0314e3d494ae1b9020921128fa1e3e9f5 /arch/blackfin/mach-common
parent5400c5aa2de41501be7529831c9df36c729bf371 (diff)
Blackfin arch: Functional power management support
Merge VR Regulator Hibernate wakeups into set_irq_wake for internal interrupts. Signed-off-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Bryan Wu <cooloney@kernel.org>
Diffstat (limited to 'arch/blackfin/mach-common')
-rw-r--r--arch/blackfin/mach-common/ints-priority.c46
-rw-r--r--arch/blackfin/mach-common/pm.c18
2 files changed, 44 insertions, 20 deletions
diff --git a/arch/blackfin/mach-common/ints-priority.c b/arch/blackfin/mach-common/ints-priority.c
index 64d746114e4b..e713b9db867d 100644
--- a/arch/blackfin/mach-common/ints-priority.c
+++ b/arch/blackfin/mach-common/ints-priority.c
@@ -71,6 +71,7 @@ atomic_t num_spurious;
71 71
72#ifdef CONFIG_PM 72#ifdef CONFIG_PM
73unsigned long bfin_sic_iwr[3]; /* Up to 3 SIC_IWRx registers */ 73unsigned long bfin_sic_iwr[3]; /* Up to 3 SIC_IWRx registers */
74unsigned vr_wakeup;
74#endif 75#endif
75 76
76struct ivgx { 77struct ivgx {
@@ -184,17 +185,56 @@ static void bfin_internal_unmask_irq(unsigned int irq)
184#ifdef CONFIG_PM 185#ifdef CONFIG_PM
185int bfin_internal_set_wake(unsigned int irq, unsigned int state) 186int bfin_internal_set_wake(unsigned int irq, unsigned int state)
186{ 187{
187 unsigned bank, bit; 188 unsigned bank, bit, wakeup = 0;
188 unsigned long flags; 189 unsigned long flags;
189 bank = SIC_SYSIRQ(irq) / 32; 190 bank = SIC_SYSIRQ(irq) / 32;
190 bit = SIC_SYSIRQ(irq) % 32; 191 bit = SIC_SYSIRQ(irq) % 32;
191 192
193 switch (irq) {
194#ifdef IRQ_RTC
195 case IRQ_RTC:
196 wakeup |= WAKE;
197 break;
198#endif
199#ifdef IRQ_CAN0_RX
200 case IRQ_CAN0_RX:
201 wakeup |= CANWE;
202 break;
203#endif
204#ifdef IRQ_CAN1_RX
205 case IRQ_CAN1_RX:
206 wakeup |= CANWE;
207 break;
208#endif
209#ifdef IRQ_USB_INT0
210 case IRQ_USB_INT0:
211 wakeup |= USBWE;
212 break;
213#endif
214#ifdef IRQ_KEY
215 case IRQ_KEY:
216 wakeup |= KPADWE;
217 break;
218#endif
219#ifdef IRQ_CNT
220 case IRQ_CNT:
221 wakeup |= ROTWE;
222 break;
223#endif
224 default:
225 break;
226 }
227
192 local_irq_save(flags); 228 local_irq_save(flags);
193 229
194 if (state) 230 if (state) {
195 bfin_sic_iwr[bank] |= (1 << bit); 231 bfin_sic_iwr[bank] |= (1 << bit);
196 else 232 vr_wakeup |= wakeup;
233
234 } else {
197 bfin_sic_iwr[bank] &= ~(1 << bit); 235 bfin_sic_iwr[bank] &= ~(1 << bit);
236 vr_wakeup &= ~wakeup;
237 }
198 238
199 local_irq_restore(flags); 239 local_irq_restore(flags);
200 240
diff --git a/arch/blackfin/mach-common/pm.c b/arch/blackfin/mach-common/pm.c
index 4fe6a2366b13..143134b852ea 100644
--- a/arch/blackfin/mach-common/pm.c
+++ b/arch/blackfin/mach-common/pm.c
@@ -229,28 +229,12 @@ int bfin_pm_suspend_mem_enter(void)
229 wakeup = bfin_read_VR_CTL() & ~FREQ; 229 wakeup = bfin_read_VR_CTL() & ~FREQ;
230 wakeup |= SCKELOW; 230 wakeup |= SCKELOW;
231 231
232 /* FIXME: merge this somehow with set_irq_wake */
233#ifdef CONFIG_PM_BFIN_WAKE_RTC
234 wakeup |= WAKE;
235#endif
236#ifdef CONFIG_PM_BFIN_WAKE_PH6 232#ifdef CONFIG_PM_BFIN_WAKE_PH6
237 wakeup |= PHYWE; 233 wakeup |= PHYWE;
238#endif 234#endif
239#ifdef CONFIG_PM_BFIN_WAKE_CAN
240 wakeup |= CANWE;
241#endif
242#ifdef CONFIG_PM_BFIN_WAKE_GP 235#ifdef CONFIG_PM_BFIN_WAKE_GP
243 wakeup |= GPWE; 236 wakeup |= GPWE;
244#endif 237#endif
245#ifdef CONFIG_PM_BFIN_WAKE_USB
246 wakeup |= USBWE;
247#endif
248#ifdef CONFIG_PM_BFIN_WAKE_KEYPAD
249 wakeup |= KPADWE;
250#endif
251#ifdef CONFIG_PM_BFIN_WAKE_ROTARY
252 wakeup |= ROTWE;
253#endif
254 238
255 local_irq_save(flags); 239 local_irq_save(flags);
256 240
@@ -268,7 +252,7 @@ int bfin_pm_suspend_mem_enter(void)
268 icache_disable(); 252 icache_disable();
269 bf53x_suspend_l1_mem(memptr); 253 bf53x_suspend_l1_mem(memptr);
270 254
271 do_hibernate(wakeup); /* Goodbye */ 255 do_hibernate(wakeup | vr_wakeup); /* Goodbye */
272 256
273 bf53x_resume_l1_mem(memptr); 257 bf53x_resume_l1_mem(memptr);
274 258