]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
OMAP: Add new function to check wether there is irq pending
authorJouni Hogander <jouni.hogander@nokia.com>
Fri, 16 May 2008 10:57:15 +0000 (13:57 +0300)
committerTony Lindgren <tony@atomide.com>
Tue, 20 May 2008 17:30:09 +0000 (10:30 -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>
arch/arm/mach-omap2/irq.c
arch/arm/mach-omap2/pm24xx.c
include/asm-arm/arch-omap/irqs.h

index ac062ee4e55333558694db68170e0ffb7515e9bb..f1e1e2ef157796662df2b17042d35f114de11b32 100644 (file)
 
 /* selected INTC register offsets */
 
-#define INTC_REVISION  0x0000
-#define INTC_SYSCONFIG 0x0010
-#define INTC_SYSSTATUS 0x0014
-#define INTC_CONTROL   0x0048
-#define INTC_MIR_CLEAR0        0x0088
-#define INTC_MIR_SET0  0x008c
+#define INTC_REVISION          0x0000
+#define INTC_SYSCONFIG         0x0010
+#define INTC_SYSSTATUS         0x0014
+#define INTC_CONTROL           0x0048
+#define INTC_MIR_CLEAR0                0x0088
+#define INTC_MIR_SET0          0x008c
+#define INTC_PENDING_IRQ0      0x0098
 
 /*
  * OMAP2 has a number of different interrupt controllers, each interrupt
@@ -122,6 +123,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_irqs = 0;
index 7bb654f14e7da2f8a0503e77ec6fb6ad1589f0fc..8636f1cf3d0536dbef7b5334168b5fcedc4cac47 100644 (file)
@@ -74,19 +74,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, sleep_time = 0;
@@ -121,7 +108,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;
 
        serial_console_sleep(1);
@@ -272,7 +259,7 @@ static void omap2_pm_idle(void)
                 */
                if (atomic_read(&sleep_block) == 0) {
                        timer_dyn_reprogram();
-                       if (omap2_irq_pending())
+                       if (omap_irq_pending())
                                goto out;
                }
                omap2_enter_mpu_retention();
@@ -286,7 +273,7 @@ static void omap2_pm_idle(void)
         */
        timer_dyn_reprogram();
 
-       if (omap2_irq_pending())
+       if (omap_irq_pending())
                goto out;
 
        omap2_enter_full_retention();
index c80e1602f50fb883258922b4c8302ae39de71b5f..343e93eb8edfe91a79e3952b7c88f0483e247f66 100644 (file)
 
 #ifndef __ASSEMBLY__
 extern void omap_init_irq(void);
+extern int omap_irq_pending(void);
 #endif
 
 #include <asm/hardware.h>