All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Hilman <khilman@deeprootsystems.com>
To: linux-arm-kernel@lists.arm.linux.org.uk
Cc: linux-omap@vger.kernel.org,
	Jouni Hogander <jouni.hogander@nokia.com>,
	Tony Lindgren <tony@atomide.com>
Subject: [PATCH 02/21] OMAP: Add new function to check wether there is irq pending
Date: Wed,  4 Feb 2009 18:05:48 -0800	[thread overview]
Message-ID: <1233799567-22250-3-git-send-email-khilman@deeprootsystems.com> (raw)
In-Reply-To: <1233799567-22250-2-git-send-email-khilman@deeprootsystems.com>

From: Jouni Hogander <jouni.hogander@nokia.com>

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              |   17 ++++++++++++++++-
 arch/arm/mach-omap2/pm24xx.c           |   19 +++----------------
 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 636e282..6d5b8c1 100644
--- a/arch/arm/mach-omap2/irq.c
+++ b/arch/arm/mach-omap2/irq.c
@@ -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;
diff --git a/arch/arm/mach-omap2/pm24xx.c b/arch/arm/mach-omap2/pm24xx.c
index b3268c5..3e9ed3f 100644
--- a/arch/arm/mach-omap2/pm24xx.c
+++ b/arch/arm/mach-omap2/pm24xx.c
@@ -78,19 +78,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;
@@ -129,7 +116,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 */
@@ -275,13 +262,13 @@ static void omap2_pm_idle(void)
 	local_fiq_disable();
 
 	if (!omap2_can_sleep()) {
-		if (!atomic_read(&sleep_block) && omap2_irq_pending())
+		if (!atomic_read(&sleep_block) && 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();
diff --git a/arch/arm/plat-omap/include/mach/irqs.h b/arch/arm/plat-omap/include/mach/irqs.h
index bed5274..990573f 100644
--- a/arch/arm/plat-omap/include/mach/irqs.h
+++ b/arch/arm/plat-omap/include/mach/irqs.h
@@ -386,6 +386,7 @@
 
 #ifndef __ASSEMBLY__
 extern void omap_init_irq(void);
+extern int omap_irq_pending(void);
 #endif
 
 #include <mach/hardware.h>
-- 
1.6.1


  reply	other threads:[~2009-02-05  2:06 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-05  2:05 [PATCH 00/21] OMAP: update PM infrastructure Kevin Hilman
2009-02-05  2:05 ` [PATCH 01/21] OMAP2/3: PM: push core PM code from linux-omap Kevin Hilman
2009-02-05  2:05   ` Kevin Hilman [this message]
2009-02-05  2:05     ` [PATCH 03/21] OMAP3: PM: SmartReflex driver integration Kevin Hilman
2009-02-05  2:05       ` [PATCH 04/21] OMAP: Kconfig: move GP timer selection alongside other timer options Kevin Hilman
2009-02-05  2:05         ` [PATCH 05/21] OMAP: dmtimer: enable all timers to be wakeup events Kevin Hilman
2009-02-05  2:05           ` [PATCH 06/21] OMAP3: PM: Add wake-up bit defintiions for CONTROL_PADCONF_X Kevin Hilman
2009-02-05  2:05             ` [PATCH 07/21] OMAP3: PM: UART: disable clocks when idle and off-mode support Kevin Hilman
2009-02-05  2:05               ` [PATCH 08/21] OMAP: UART: Add sysfs interface for adjusting UART sleep timeout Kevin Hilman
2009-02-05  2:05                 ` [PATCH 09/21] OMAP3: PM: Force IVA2 into idle during bootup Kevin Hilman
2009-02-05  2:05                   ` [PATCH 10/21] OMAP3: PM: Add D2D clocks and auto-idle setup to PRCM init Kevin Hilman
2009-02-05  2:05                     ` [PATCH 11/21] OMAP3: PM: D2D clockdomain supports SW supervised transitions Kevin Hilman
2009-02-05  2:05                       ` [PATCH 12/21] OMAP: PM counter infrastructure Kevin Hilman
2009-02-05  2:05                         ` [PATCH 13/21] OMAP: PM: Hook into PM counters Kevin Hilman
2009-02-05  2:06                           ` [PATCH 14/21] OMAP: PM: Add closures to clkdm_for_each and pwrdm_for_each Kevin Hilman
2009-02-05  2:06                             ` [PATCH 15/21] OMAP: PM: Add pm-debug counters Kevin Hilman
2009-02-05  2:06                               ` [PATCH 16/21] OMAP: PM debug: make powerdomains use PM-debug counters Kevin Hilman
2009-02-05  2:06                                 ` [PATCH 17/21] OMAP: PM debug: do not print out status for meta powerdomains (dpll*) Kevin Hilman
2009-02-05  2:06                                   ` [PATCH 18/21] OMAP: PM debug: Add PRCM register dump support Kevin Hilman
2009-02-05  2:06                                     ` [PATCH 19/21] OMAP: PM: Add definitions for ETK pads and observability registers Kevin Hilman
2009-02-05  2:06                                       ` [PATCH 20/21] OMAP: Debug observability and ETK padconf implementation Kevin Hilman
2009-02-05  2:06                                         ` [PATCH 21/21] OMAP: Add debug observablity (debobs) Kconfig item Kevin Hilman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1233799567-22250-3-git-send-email-khilman@deeprootsystems.com \
    --to=khilman@deeprootsystems.com \
    --cc=jouni.hogander@nokia.com \
    --cc=linux-arm-kernel@lists.arm.linux.org.uk \
    --cc=linux-omap@vger.kernel.org \
    --cc=tony@atomide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.