diff options
author | Jouni Hogander <jouni.hogander@nokia.com> | 2009-02-03 18:49:04 -0500 |
---|---|---|
committer | Kevin Hilman <khilman@deeprootsystems.com> | 2009-05-28 13:59:04 -0400 |
commit | 94434535bd36ca010a81e1199f954beef2c4de64 (patch) | |
tree | 7abfddf6812d4b88bb4cc8bff5a6acbbc0664a1b /arch | |
parent | 8bd229492209c0c7d050e2f9a600c12f035d72f7 (diff) |
OMAP: Add new function to check wether there is irq pending
Add common omap2/3 function to check wether there is irq pending.
Switch to use it in omap2 pm code instead of its own.
Signed-off-by: Jouni Hogander <jouni.hogander@nokia.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-omap2/irq.c | 17 | ||||
-rw-r--r-- | arch/arm/mach-omap2/pm24xx.c | 19 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/mach/irqs.h | 1 |
3 files changed, 20 insertions, 17 deletions
diff --git a/arch/arm/mach-omap2/irq.c b/arch/arm/mach-omap2/irq.c index 08a3b99abe61..b82863887f10 100644 --- a/arch/arm/mach-omap2/irq.c +++ b/arch/arm/mach-omap2/irq.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #define INTC_MIR_CLEAR0 0x0088 | 28 | #define INTC_MIR_CLEAR0 0x0088 |
29 | #define INTC_MIR_SET0 0x008c | 29 | #define INTC_MIR_SET0 0x008c |
30 | #define INTC_PENDING_IRQ0 0x0098 | 30 | #define INTC_PENDING_IRQ0 0x0098 |
31 | |||
32 | /* Number of IRQ state bits in each MIR register */ | 31 | /* Number of IRQ state bits in each MIR register */ |
33 | #define IRQ_BITS_PER_REG 32 | 32 | #define IRQ_BITS_PER_REG 32 |
34 | 33 | ||
@@ -156,6 +155,22 @@ static void __init omap_irq_bank_init_one(struct omap_irq_bank *bank) | |||
156 | intc_bank_write_reg(1 << 0, bank, INTC_SYSCONFIG); | 155 | intc_bank_write_reg(1 << 0, bank, INTC_SYSCONFIG); |
157 | } | 156 | } |
158 | 157 | ||
158 | int omap_irq_pending(void) | ||
159 | { | ||
160 | int i; | ||
161 | |||
162 | for (i = 0; i < ARRAY_SIZE(irq_banks); i++) { | ||
163 | struct omap_irq_bank *bank = irq_banks + i; | ||
164 | int irq; | ||
165 | |||
166 | for (irq = 0; irq < bank->nr_irqs; irq += 32) | ||
167 | if (intc_bank_read_reg(bank, INTC_PENDING_IRQ0 + | ||
168 | ((irq >> 5) << 5))) | ||
169 | return 1; | ||
170 | } | ||
171 | return 0; | ||
172 | } | ||
173 | |||
159 | void __init omap_init_irq(void) | 174 | void __init omap_init_irq(void) |
160 | { | 175 | { |
161 | unsigned long nr_of_irqs = 0; | 176 | unsigned long nr_of_irqs = 0; |
diff --git a/arch/arm/mach-omap2/pm24xx.c b/arch/arm/mach-omap2/pm24xx.c index 232b9f6032e8..d38f3121dde9 100644 --- a/arch/arm/mach-omap2/pm24xx.c +++ b/arch/arm/mach-omap2/pm24xx.c | |||
@@ -76,19 +76,6 @@ static int omap2_fclks_active(void) | |||
76 | return 0; | 76 | return 0; |
77 | } | 77 | } |
78 | 78 | ||
79 | static int omap2_irq_pending(void) | ||
80 | { | ||
81 | u32 pending_reg = 0x480fe098; | ||
82 | int i; | ||
83 | |||
84 | for (i = 0; i < 4; i++) { | ||
85 | if (omap_readl(pending_reg)) | ||
86 | return 1; | ||
87 | pending_reg += 0x20; | ||
88 | } | ||
89 | return 0; | ||
90 | } | ||
91 | |||
92 | static void omap2_enter_full_retention(void) | 79 | static void omap2_enter_full_retention(void) |
93 | { | 80 | { |
94 | u32 l; | 81 | u32 l; |
@@ -127,7 +114,7 @@ static void omap2_enter_full_retention(void) | |||
127 | 114 | ||
128 | /* One last check for pending IRQs to avoid extra latency due | 115 | /* One last check for pending IRQs to avoid extra latency due |
129 | * to sleeping unnecessarily. */ | 116 | * to sleeping unnecessarily. */ |
130 | if (omap2_irq_pending()) | 117 | if (omap_irq_pending()) |
131 | goto no_sleep; | 118 | goto no_sleep; |
132 | 119 | ||
133 | /* Jump to SRAM suspend code */ | 120 | /* Jump to SRAM suspend code */ |
@@ -262,13 +249,13 @@ static void omap2_pm_idle(void) | |||
262 | local_fiq_disable(); | 249 | local_fiq_disable(); |
263 | 250 | ||
264 | if (!omap2_can_sleep()) { | 251 | if (!omap2_can_sleep()) { |
265 | if (omap2_irq_pending()) | 252 | if (omap_irq_pending()) |
266 | goto out; | 253 | goto out; |
267 | omap2_enter_mpu_retention(); | 254 | omap2_enter_mpu_retention(); |
268 | goto out; | 255 | goto out; |
269 | } | 256 | } |
270 | 257 | ||
271 | if (omap2_irq_pending()) | 258 | if (omap_irq_pending()) |
272 | goto out; | 259 | goto out; |
273 | 260 | ||
274 | omap2_enter_full_retention(); | 261 | omap2_enter_full_retention(); |
diff --git a/arch/arm/plat-omap/include/mach/irqs.h b/arch/arm/plat-omap/include/mach/irqs.h index 7f57ee66f364..f5f7c928b53d 100644 --- a/arch/arm/plat-omap/include/mach/irqs.h +++ b/arch/arm/plat-omap/include/mach/irqs.h | |||
@@ -467,6 +467,7 @@ | |||
467 | 467 | ||
468 | #ifndef __ASSEMBLY__ | 468 | #ifndef __ASSEMBLY__ |
469 | extern void omap_init_irq(void); | 469 | extern void omap_init_irq(void); |
470 | extern int omap_irq_pending(void); | ||
470 | #endif | 471 | #endif |
471 | 472 | ||
472 | #include <mach/hardware.h> | 473 | #include <mach/hardware.h> |