public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: Tero Kristo <t-kristo@ti.com>
To: "Mohammed, Afzal" <afzal@ti.com>
Cc: Paul Walmsley <paul@pwsan.com>,
	"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>
Subject: RE: OMAP3EVM not booting on l-o master
Date: Mon, 23 Apr 2012 12:24:04 +0300	[thread overview]
Message-ID: <1335173044.2149.64.camel@sokoban> (raw)
In-Reply-To: <C8443D0743D26F4388EA172BF4E2A7A9317C5EEF@DBDE01.ent.ti.com>

[-- Attachment #1: Type: text/plain, Size: 586 bytes --]

On Fri, 2012-04-06 at 07:52 +0000, Mohammed, Afzal wrote:
> Hi Paul,
> 
> On Fri, Apr 06, 2012 at 12:43:06, Paul Walmsley wrote:
> > Perhaps you might be willing to add some debugging to omap_mux_late_init() 
> > to find out what part of that function is causing it to hang?
> 
> It is getting hung as interrupt handler "omap_hwmod_mux_handle_irq"
> is being repeatedly called.
> 

Hi Afzal,

can you try the attached patch with this branch and omap3evm board? I
don't have the board myself so I can't test it myself (I tested this
with omap3beagle and it works with that one.)

-Tero


[-- Attachment #2: 0001-ARM-OMAP3-PM-move-wakeup-event-ack-to-hwmod_io-handl.patch --]
[-- Type: text/x-patch, Size: 4173 bytes --]

>From 26733dd988ccc9e72355a39e01b2d6e9215a892d Mon Sep 17 00:00:00 2001
From: Tero Kristo <t-kristo@ti.com>
Date: Mon, 23 Apr 2012 12:14:46 +0300
Subject: [PATCH] ARM: OMAP3: PM: move wakeup event ack to hwmod_io handler

PRCM IO interrupts are handled with a shared interrupt handler logic.
Currently hwmod_io is processing the actual event, but the acking
of the IO wakeups is done from the PM code with a separate handler.
If a wakeup event is detected during init before the PM code is in
place, the interrupt handler can hang in an infinite loop. Fix this
by removing the pm_io handler, and calling its functionality from
within the hwmod_io handler. This fix applies only to OMAP3, as
OMAP4 does not have similar wakeup handling logic.

Signed-off-by: Tero Kristo <t-kristo@ti.com>
---
 arch/arm/mach-omap2/mux.c    |   18 +++++++++++++++++-
 arch/arm/mach-omap2/pm.h     |    1 +
 arch/arm/mach-omap2/pm34xx.c |   18 ++----------------
 3 files changed, 20 insertions(+), 17 deletions(-)

diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c
index 65c3391..17349e3 100644
--- a/arch/arm/mach-omap2/mux.c
+++ b/arch/arm/mach-omap2/mux.c
@@ -41,6 +41,7 @@
 #include "control.h"
 #include "mux.h"
 #include "prm.h"
+#include "pm.h"
 
 #define OMAP_MUX_BASE_OFFSET		0x30	/* Offset from CTRL_BASE */
 #define OMAP_MUX_BASE_SZ		0x5ca
@@ -427,6 +428,13 @@ static irqreturn_t omap_hwmod_mux_handle_irq(int irq, void *unused)
 	return IRQ_HANDLED;
 }
 
+static irqreturn_t omap34xx_hwmod_mux_handle_irq(int irq, void *unused)
+{
+	omap_hwmod_for_each(_omap_hwmod_mux_handle_irq, NULL);
+	prcm_int_ack_io();
+	return IRQ_HANDLED;
+}
+
 /* Assumes the calling function takes care of locking */
 void omap_hwmod_mux(struct omap_hwmod_mux_info *hmux, u8 state)
 {
@@ -792,6 +800,7 @@ static int __init omap_mux_late_init(void)
 {
 	struct omap_mux_partition *partition;
 	int ret;
+	irq_handler_t irq_handler;
 
 	list_for_each_entry(partition, &mux_partitions, node) {
 		struct omap_mux_entry *e, *tmp;
@@ -812,12 +821,19 @@ static int __init omap_mux_late_init(void)
 		}
 	}
 
+#ifdef CONFIG_PM
+	if (cpu_is_omap34xx())
+		irq_handler = omap34xx_hwmod_mux_handle_irq;
+	else
+		irq_handler = omap_hwmod_mux_handle_irq;
+
 	ret = request_irq(omap_prcm_event_to_irq("io"),
-		omap_hwmod_mux_handle_irq, IRQF_SHARED | IRQF_NO_SUSPEND,
+		irq_handler, IRQF_SHARED | IRQF_NO_SUSPEND,
 			"hwmod_io", omap_mux_late_init);
 
 	if (ret)
 		pr_warning("mux: Failed to setup hwmod io irq %d\n", ret);
+#endif
 
 	omap_mux_dbg_init();
 
diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h
index 36fa90b..09ba9e7 100644
--- a/arch/arm/mach-omap2/pm.h
+++ b/arch/arm/mach-omap2/pm.h
@@ -20,6 +20,7 @@ extern void omap3_pm_off_mode_enable(int);
 extern void omap_sram_idle(void);
 extern int omap_set_pwrdm_state(struct powerdomain *pwrdm, u32 state);
 extern int omap3_idle_init(void);
+extern void prcm_int_ack_io(void);
 extern int omap4_idle_init(void);
 extern int omap_pm_clkdms_setup(struct clockdomain *clkdm, void *unused);
 extern int (*omap_pm_suspend)(void);
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index afe3dda..cea4408 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -182,14 +182,10 @@ static int prcm_clear_mod_irqs(s16 module, u8 regs, u32 ignore_bits)
 	return c;
 }
 
-static irqreturn_t _prcm_int_handle_io(int irq, void *unused)
+void prcm_int_ack_io(void)
 {
-	int c;
-
-	c = prcm_clear_mod_irqs(WKUP_MOD, 1,
+	prcm_clear_mod_irqs(WKUP_MOD, 1,
 		~(OMAP3430_ST_IO_MASK | OMAP3430_ST_IO_CHAIN_MASK));
-
-	return c ? IRQ_HANDLED : IRQ_NONE;
 }
 
 static irqreturn_t _prcm_int_handle_wakeup(int irq, void *unused)
@@ -683,16 +679,6 @@ static int __init omap3_pm_init(void)
 		goto err1;
 	}
 
-	/* IO interrupt is shared with mux code */
-	ret = request_irq(omap_prcm_event_to_irq("io"),
-		_prcm_int_handle_io, IRQF_SHARED | IRQF_NO_SUSPEND, "pm_io",
-		omap3_pm_init);
-
-	if (ret) {
-		pr_err("pm: Failed to request pm_io irq\n");
-		goto err1;
-	}
-
 	ret = pwrdm_for_each(pwrdms_setup, NULL);
 	if (ret) {
 		printk(KERN_ERR "Failed to setup powerdomains\n");
-- 
1.7.4.1


  reply	other threads:[~2012-04-23  9:24 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-04  5:36 OMAP3EVM not booting on l-o master Mohammed, Afzal
2012-04-04  9:11 ` Mohammed, Afzal
2012-04-05  9:33   ` Paul Walmsley
2012-04-05 10:07     ` Paul Walmsley
2012-04-05 16:22       ` Mohammed, Afzal
2012-04-05 19:52         ` Paul Walmsley
2012-04-06  5:09           ` Mohammed, Afzal
2012-04-06  7:13             ` Paul Walmsley
2012-04-06  7:52               ` Mohammed, Afzal
2012-04-23  9:24                 ` Tero Kristo [this message]
2012-04-23 10:07                   ` Mohammed, Afzal
2012-04-23 10:13                     ` Tero Kristo
2012-04-23 10:43                       ` Mohammed, Afzal
2012-04-23 11:59                         ` Tero Kristo
2012-04-24 12:00                           ` Mohammed, Afzal
2012-04-24 12:23                             ` Tero Kristo
2012-04-24 17:07                   ` Kevin Hilman
2012-04-27 13:16                     ` Tero Kristo
2012-04-27 23:15                       ` Kevin Hilman
2012-04-28 11:51                         ` Mohammed, Afzal
2012-04-30 12:46                         ` Tero Kristo
2012-04-30 20:40                           ` Kevin Hilman
2012-05-01 12:55                             ` Mohammed, Afzal
2012-05-01 14:08                               ` Kevin Hilman
2012-05-02  5:48                                 ` Mohammed, Afzal
2012-05-02  8:39                                   ` Tero Kristo
2012-05-02  8:45                             ` Paul Walmsley
2012-05-02 14:27                               ` Kevin Hilman
2012-05-11 22:39                                 ` Paul Walmsley
2012-04-05 21:21       ` Kevin Hilman
2012-04-05 10:11     ` Mohammed, Afzal
2012-04-05 10:17       ` Paul Walmsley
2012-04-05 10:23         ` Raja, Govindraj
2012-04-05 16:19           ` Mohammed, Afzal
2012-04-05 17:16             ` Tony Lindgren
2012-04-06  4:54               ` Mohammed, Afzal
2012-04-06 17:41                 ` Tony Lindgren
2012-04-06 18:08                   ` Paul Walmsley
2012-04-06 18:24                     ` Tony Lindgren

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=1335173044.2149.64.camel@sokoban \
    --to=t-kristo@ti.com \
    --cc=afzal@ti.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=paul@pwsan.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox