]>
Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
2 | * FR-V MB93093 Power Management Routines | |
3 | * | |
4 | * Copyright (c) 2004 Red Hat, Inc. | |
5 | * | |
6 | * Written by: msalter@redhat.com | |
7 | * | |
8 | * This program is free software; you can redistribute it and/or | |
9 | * modify it under the terms of the GNU General Public License. | |
10 | * | |
11 | */ | |
12 | ||
1da177e4 LT |
13 | #include <linux/init.h> |
14 | #include <linux/pm.h> | |
15 | #include <linux/sched.h> | |
16 | #include <linux/interrupt.h> | |
17 | #include <linux/sysctl.h> | |
18 | #include <linux/errno.h> | |
19 | #include <linux/delay.h> | |
7c0f6ba6 | 20 | #include <linux/uaccess.h> |
1da177e4 LT |
21 | |
22 | #include <asm/mb86943a.h> | |
23 | ||
24 | #include "local.h" | |
25 | ||
26 | static unsigned long imask; | |
27 | /* | |
28 | * Setup interrupt masks, etc to enable wakeup by power switch | |
29 | */ | |
30 | static void mb93093_power_switch_setup(void) | |
31 | { | |
32 | /* mask all but FPGA interrupt sources. */ | |
33 | imask = *(volatile unsigned long *)0xfeff9820; | |
34 | *(volatile unsigned long *)0xfeff9820 = ~(1 << (IRQ_XIRQ2_LEVEL + 16)) & 0xfffe0000; | |
35 | } | |
36 | ||
37 | /* | |
38 | * Cleanup interrupt masks, etc after wakeup by power switch | |
39 | */ | |
40 | static void mb93093_power_switch_cleanup(void) | |
41 | { | |
42 | *(volatile unsigned long *)0xfeff9820 = imask; | |
43 | } | |
44 | ||
45 | /* | |
46 | * Return non-zero if wakeup irq was caused by power switch | |
47 | */ | |
48 | static int mb93093_power_switch_check(void) | |
49 | { | |
50 | return 1; | |
51 | } | |
52 | ||
53 | /* | |
54 | * Initialize power interface | |
55 | */ | |
56 | static int __init mb93093_pm_init(void) | |
57 | { | |
58 | __power_switch_wake_setup = mb93093_power_switch_setup; | |
59 | __power_switch_wake_check = mb93093_power_switch_check; | |
60 | __power_switch_wake_cleanup = mb93093_power_switch_cleanup; | |
61 | return 0; | |
62 | } | |
63 | ||
64 | __initcall(mb93093_pm_init); | |
65 |