diff options
Diffstat (limited to 'arch/frv/kernel/pm-mb93093.c')
-rw-r--r-- | arch/frv/kernel/pm-mb93093.c | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/arch/frv/kernel/pm-mb93093.c b/arch/frv/kernel/pm-mb93093.c new file mode 100644 index 000000000000..34d01d7dcc3b --- /dev/null +++ b/arch/frv/kernel/pm-mb93093.c | |||
@@ -0,0 +1,66 @@ | |||
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 | |||
13 | #include <linux/config.h> | ||
14 | #include <linux/init.h> | ||
15 | #include <linux/pm.h> | ||
16 | #include <linux/sched.h> | ||
17 | #include <linux/interrupt.h> | ||
18 | #include <linux/sysctl.h> | ||
19 | #include <linux/errno.h> | ||
20 | #include <linux/delay.h> | ||
21 | #include <asm/uaccess.h> | ||
22 | |||
23 | #include <asm/mb86943a.h> | ||
24 | |||
25 | #include "local.h" | ||
26 | |||
27 | static unsigned long imask; | ||
28 | /* | ||
29 | * Setup interrupt masks, etc to enable wakeup by power switch | ||
30 | */ | ||
31 | static void mb93093_power_switch_setup(void) | ||
32 | { | ||
33 | /* mask all but FPGA interrupt sources. */ | ||
34 | imask = *(volatile unsigned long *)0xfeff9820; | ||
35 | *(volatile unsigned long *)0xfeff9820 = ~(1 << (IRQ_XIRQ2_LEVEL + 16)) & 0xfffe0000; | ||
36 | } | ||
37 | |||
38 | /* | ||
39 | * Cleanup interrupt masks, etc after wakeup by power switch | ||
40 | */ | ||
41 | static void mb93093_power_switch_cleanup(void) | ||
42 | { | ||
43 | *(volatile unsigned long *)0xfeff9820 = imask; | ||
44 | } | ||
45 | |||
46 | /* | ||
47 | * Return non-zero if wakeup irq was caused by power switch | ||
48 | */ | ||
49 | static int mb93093_power_switch_check(void) | ||
50 | { | ||
51 | return 1; | ||
52 | } | ||
53 | |||
54 | /* | ||
55 | * Initialize power interface | ||
56 | */ | ||
57 | static int __init mb93093_pm_init(void) | ||
58 | { | ||
59 | __power_switch_wake_setup = mb93093_power_switch_setup; | ||
60 | __power_switch_wake_check = mb93093_power_switch_check; | ||
61 | __power_switch_wake_cleanup = mb93093_power_switch_cleanup; | ||
62 | return 0; | ||
63 | } | ||
64 | |||
65 | __initcall(mb93093_pm_init); | ||
66 | |||