OMAP: Add new function to check wether there is irq pending
authorJouni Hogander <jouni.hogander@nokia.com>
Tue, 3 Feb 2009 23:49:04 +0000 (15:49 -0800)
committerKevin Hilman <khilman@deeprootsystems.com>
Thu, 28 May 2009 17:59:04 +0000 (10:59 -0700)
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>
arch/arm/mach-omap2/irq.c
arch/arm/mach-omap2/pm24xx.c
arch/arm/plat-omap/include/mach/irqs.h

index 08a3b99abe615ce4891133ee1b933e252c32bfe1..b82863887f10ebe96a3d8db573d99d0c7ae6d9a3 100644 (file)
@@ -28,7 +28,6 @@
 #define INTC_MIR_CLEAR0                0x0088
 #define INTC_MIR_SET0          0x008c
 #define INTC_PENDING_IRQ0      0x0098
-
 /* Number of IRQ state bits in each MIR register */
 #define IRQ_BITS_PER_REG       32
 
@@ -156,6 +155,22 @@ static void __init omap_irq_bank_init_one(struct omap_irq_bank *bank)
        intc_bank_write_reg(1 << 0, bank, INTC_SYSCONFIG);
 }
 
+int omap_irq_pending(void)
+{
+       int i;
+
+       for (i = 0; i < ARRAY_SIZE(irq_banks); i++) {
+               struct omap_irq_bank *bank = irq_banks + i;
+               int irq;
+
+               for (irq = 0; irq < bank->nr_irqs; irq += 32)
+                       if (intc_bank_read_reg(bank, INTC_PENDING_IRQ0 +
+                                              ((irq >> 5) << 5)))
+                               return 1;
+       }
+       return 0;
+}
+
 void __init omap_init_irq(void)
 {
        unsigned long nr_of_irqs = 0;
index 232b9f6032e8db62264ddcdfcf2be68dc8c62c93..d38f3121dde995caee9c2ad22d547bea1b3a7cc5 100644 (file)
@@ -76,19 +76,6 @@ static int omap2_fclks_active(void)
        return 0;
 }
 
-static int omap2_irq_pending(void)
-{
-       u32 pending_reg = 0x480fe098;
-       int i;
-
-       for (i = 0; i < 4; i++) {
-               if (omap_readl(pending_reg))
-                       return 1;
-               pending_reg += 0x20;
-       }
-       return 0;
-}
-
 static void omap2_enter_full_retention(void)
 {
        u32 l;
@@ -127,7 +114,7 @@ static void omap2_enter_full_retention(void)
 
        /* One last check for pending IRQs to avoid extra latency due
         * to sleeping unnecessarily. */
-       if (omap2_irq_pending())
+       if (omap_irq_pending())
                goto no_sleep;
 
        /* Jump to SRAM suspend code */
@@ -262,13 +249,13 @@ static void omap2_pm_idle(void)
        local_fiq_disable();
 
        if (!omap2_can_sleep()) {
-               if (omap2_irq_pending())
+               if (omap_irq_pending())
                        goto out;
                omap2_enter_mpu_retention();
                goto out;
        }
 
-       if (omap2_irq_pending())
+       if (omap_irq_pending())
                goto out;
 
        omap2_enter_full_retention();
index 7f57ee66f364dd0ad65092f58d62066c95a3604d..f5f7c928b53dc712ca2ca4308491a7054a7f85a6 100644 (file)
 
 #ifndef __ASSEMBLY__
 extern void omap_init_irq(void);
+extern int omap_irq_pending(void);
 #endif
 
 #include <mach/hardware.h>