linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] Orion irqchip and Kirkwood SDIO
@ 2013-11-15 14:22 Sebastian Hesselbarth
  2013-11-15 14:22 ` [PATCH 1/3] irqchip: orion: reverse irq handling priority Sebastian Hesselbarth
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Sebastian Hesselbarth @ 2013-11-15 14:22 UTC (permalink / raw)
  To: Sebastian Hesselbarth
  Cc: Sebastian Hesselbarth, Thomas Gleixner, Nicolas Pitre,
	Chris Ball, Thomas Petazzoni, Jason Cooper, Andrew Lunn,
	linux-mmc, linux-arm-kernel, linux-kernel

This patch set tries to deal with a minor irq issue seen on Marvell
Kirkwood SoCs with irqchip/irq-orion and mvsdio drivers. In contrast
to non-DT irq handling, irqchip driver does handle irqs a little bit
different. First of all, it reads irq cause register once and works
through all bits set while non-DT irq handling read irq cause and
handled only one irq. Second, irqchip reverses irq priorities by
using ffs() instead of fls().

This now, seems to trigger a minor ip design issue in sdio peripheral
where sdio irq can occur upstream while sdio interrupts are all
disabled in the ip registers. This extra, unexpected irq does neither
harm correct function of HW nor SW driver but triggers a warning in
mvsdio irq handler.

I have tried to debug this and can say that the sequence of irq
related events is:
(a) sdio irq is set in upstream irq
(b) generic-chip handler masks sdio irq
(c) sdio irq handler deals with it,
    acks and disables all peripheral irq registers
(d) sdio irq cause is cleared
(e) generic-chip handler unmasks sdio irq
(f) sdio irq is set in upstream irq and cleared little later
(g) sdio irq handler is upset about being called with no irq to handle

This patch set is actually three independent patches in one as mvsdio
irq workaround just motivates irqchip handling changes. The third just
silences a noisy mvsdio dev_notice down to dev_dbg. I have chosen to
keep them together anyway. Below is a more detailed description of the
individual patches.

First patch reverses irq handling priority for irqchip driver to what
non-DT irq did before by using fls() instead of ffs(). The "read cause
once, work through all irqs" handling is maintained.

Second patch works around the spurious irq issue by bailing out of the
irq handler early, if peripheral irq registers indicate that none should
have been fired.

Third patch silences a card detect mechanism related dev_notice to
dev_dbg to not bother users with that.

All patches are based on v3.12. I suggest to take irqchip patch though
mvebu branch, while mmc related patches should go though mmc tree.

Sebastian Hesselbarth (3):
  irqchip: orion: reverse irq handling priority
  mmc: mvsdio: workaround for spurious irqs
  mmc: mvsdio: silence card detect notice

 drivers/irqchip/irq-orion.c |    4 ++--
 drivers/mmc/host/mvsdio.c   |   20 +++++++++++++++++---
 2 files changed, 19 insertions(+), 5 deletions(-)

---
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Nicolas Pitre <nico@fluxnic.net>
Cc: Chris Ball <cjb@laptop.org>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: linux-mmc@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
-- 
1.7.2.5


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/3] irqchip: orion: reverse irq handling priority
  2013-11-15 14:22 [PATCH 0/3] Orion irqchip and Kirkwood SDIO Sebastian Hesselbarth
@ 2013-11-15 14:22 ` Sebastian Hesselbarth
  2013-11-24 17:04   ` Jason Cooper
  2013-11-15 14:22 ` [PATCH 2/3] mmc: mvsdio: workaround for spurious irqs Sebastian Hesselbarth
  2013-11-15 14:22 ` [PATCH 3/3] mmc: mvsdio: silence card detect notice Sebastian Hesselbarth
  2 siblings, 1 reply; 7+ messages in thread
From: Sebastian Hesselbarth @ 2013-11-15 14:22 UTC (permalink / raw)
  To: Sebastian Hesselbarth
  Cc: Sebastian Hesselbarth, Thomas Gleixner, Jason Cooper,
	Andrew Lunn, Russell King, linux-arm-kernel, linux-kernel

Non-DT irq handlers were working through irq causes from most-significant
to least-significant bit, while DT irqchip driver does it the other way
round. This revealed some more HW issues on Kirkwood peripheral IP, where
spurious sdio irqs can happen although IP's irq enable registers are all
zero. Although, not directly related with the described issue, reverse
irq bit handling back to original order by replacing ffs() with fls().

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
---
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 drivers/irqchip/irq-orion.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/irqchip/irq-orion.c b/drivers/irqchip/irq-orion.c
index e51d400..de30d5c 100644
--- a/drivers/irqchip/irq-orion.c
+++ b/drivers/irqchip/irq-orion.c
@@ -42,7 +42,7 @@ __exception_irq_entry orion_handle_irq(struct pt_regs *regs)
 		u32 stat = readl_relaxed(gc->reg_base + ORION_IRQ_CAUSE) &
 			gc->mask_cache;
 		while (stat) {
-			u32 hwirq = ffs(stat) - 1;
+			u32 hwirq = __fls(stat);
 			u32 irq = irq_find_mapping(orion_irq_domain,
 						   gc->irq_base + hwirq);
 			handle_IRQ(irq, regs);
@@ -116,7 +116,7 @@ static void orion_bridge_irq_handler(unsigned int irq, struct irq_desc *desc)
 		   gc->mask_cache;
 
 	while (stat) {
-		u32 hwirq = ffs(stat) - 1;
+		u32 hwirq = __fls(stat);
 
 		generic_handle_irq(irq_find_mapping(d, gc->irq_base + hwirq));
 		stat &= ~(1 << hwirq);
-- 
1.7.2.5


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/3] mmc: mvsdio: workaround for spurious irqs
  2013-11-15 14:22 [PATCH 0/3] Orion irqchip and Kirkwood SDIO Sebastian Hesselbarth
  2013-11-15 14:22 ` [PATCH 1/3] irqchip: orion: reverse irq handling priority Sebastian Hesselbarth
@ 2013-11-15 14:22 ` Sebastian Hesselbarth
  2013-11-24 17:06   ` Jason Cooper
  2013-11-15 14:22 ` [PATCH 3/3] mmc: mvsdio: silence card detect notice Sebastian Hesselbarth
  2 siblings, 1 reply; 7+ messages in thread
From: Sebastian Hesselbarth @ 2013-11-15 14:22 UTC (permalink / raw)
  To: Sebastian Hesselbarth
  Cc: Sebastian Hesselbarth, Nicolas Pitre, Chris Ball,
	Thomas Petazzoni, Jason Cooper, Andrew Lunn, linux-mmc,
	linux-arm-kernel, linux-kernel

SDIO controllers found on Marvell Kirkwood SoCs seem to cause a late,
spurious irq although all interrupts have been disabled. This irq
doesn't do any harm, neither to HW nor driver. To avoid some
"unexpected irq" warning later, we workaround above issue by bailing
out of irq handler early, if we didn't expect any.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
---
Cc: Nicolas Pitre <nico@fluxnic.net>
Cc: Chris Ball <cjb@laptop.org>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: linux-mmc@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 drivers/mmc/host/mvsdio.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/host/mvsdio.c b/drivers/mmc/host/mvsdio.c
index 06c5b0b..25f51be 100644
--- a/drivers/mmc/host/mvsdio.c
+++ b/drivers/mmc/host/mvsdio.c
@@ -354,6 +354,21 @@ static irqreturn_t mvsd_irq(int irq, void *dev)
 		intr_status, mvsd_read(MVSD_NOR_INTR_EN),
 		mvsd_read(MVSD_HW_STATE));
 
+	/*
+	 * It looks like, SDIO IP can issue one late, spurious irq
+	 * although all irqs should be disabled. To work around this,
+	 * bail out early, if we didn't expect any irqs to occur.
+	 */
+	if (!mvsd_read(MVSD_NOR_INTR_EN) && !mvsd_read(MVSD_ERR_INTR_EN)) {
+		dev_dbg(host->dev,
+			"spurious irq detected intr 0x%04x intr_en 0x%04x erri 0x%04x erri_en 0x%04x\n",
+			mvsd_read(MVSD_NOR_INTR_STATUS),
+			mvsd_read(MVSD_NOR_INTR_EN),
+			mvsd_read(MVSD_ERR_INTR_STATUS),
+			mvsd_read(MVSD_ERR_INTR_EN));
+		return IRQ_HANDLED;
+	}
+
 	spin_lock(&host->lock);
 
 	/* PIO handling, if needed. Messy business... */
-- 
1.7.2.5


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/3] mmc: mvsdio: silence card detect notice
  2013-11-15 14:22 [PATCH 0/3] Orion irqchip and Kirkwood SDIO Sebastian Hesselbarth
  2013-11-15 14:22 ` [PATCH 1/3] irqchip: orion: reverse irq handling priority Sebastian Hesselbarth
  2013-11-15 14:22 ` [PATCH 2/3] mmc: mvsdio: workaround for spurious irqs Sebastian Hesselbarth
@ 2013-11-15 14:22 ` Sebastian Hesselbarth
  2013-11-24 17:07   ` Jason Cooper
  2 siblings, 1 reply; 7+ messages in thread
From: Sebastian Hesselbarth @ 2013-11-15 14:22 UTC (permalink / raw)
  To: Sebastian Hesselbarth
  Cc: Sebastian Hesselbarth, Nicolas Pitre, Chris Ball,
	Thomas Petazzoni, Jason Cooper, Andrew Lunn, linux-mmc,
	linux-arm-kernel, linux-kernel

mvsdio reports method of card detection with dev_notice, while for
removable cards it may be sane, for non-removable cards it is not.
Also, as the user cannot do anything about it, silence the message
by reducing it from dev_notice to dev_dbg.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
---
Cc: Nicolas Pitre <nico@fluxnic.net>
Cc: Chris Ball <cjb@laptop.org>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: linux-mmc@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 drivers/mmc/host/mvsdio.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/host/mvsdio.c b/drivers/mmc/host/mvsdio.c
index 25f51be..d17b399 100644
--- a/drivers/mmc/host/mvsdio.c
+++ b/drivers/mmc/host/mvsdio.c
@@ -816,10 +816,9 @@ static int __init mvsd_probe(struct platform_device *pdev)
 		goto out;
 
 	if (!(mmc->caps & MMC_CAP_NEEDS_POLL))
-		dev_notice(&pdev->dev, "using GPIO for card detection\n");
+		dev_dbg(&pdev->dev, "using GPIO for card detection\n");
 	else
-		dev_notice(&pdev->dev,
-			   "lacking card detect (fall back to polling)\n");
+		dev_dbg(&pdev->dev, "lacking card detect, fall back to polling\n");
 	return 0;
 
 out:
-- 
1.7.2.5


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/3] irqchip: orion: reverse irq handling priority
  2013-11-15 14:22 ` [PATCH 1/3] irqchip: orion: reverse irq handling priority Sebastian Hesselbarth
@ 2013-11-24 17:04   ` Jason Cooper
  0 siblings, 0 replies; 7+ messages in thread
From: Jason Cooper @ 2013-11-24 17:04 UTC (permalink / raw)
  To: Sebastian Hesselbarth
  Cc: Andrew Lunn, Russell King, linux-kernel, Thomas Gleixner,
	linux-arm-kernel

On Fri, Nov 15, 2013 at 03:22:32PM +0100, Sebastian Hesselbarth wrote:
> Non-DT irq handlers were working through irq causes from most-significant
> to least-significant bit, while DT irqchip driver does it the other way
> round. This revealed some more HW issues on Kirkwood peripheral IP, where
> spurious sdio irqs can happen although IP's irq enable registers are all
> zero. Although, not directly related with the described issue, reverse
> irq bit handling back to original order by replacing ffs() with fls().
> 
> Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
> ---
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Jason Cooper <jason@lakedaemon.net>
> Cc: Andrew Lunn <andrew@lunn.ch>
> Cc: Russell King <linux@arm.linux.org.uk>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-kernel@vger.kernel.org
> ---
>  drivers/irqchip/irq-orion.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)

Acked-by: Jason Cooper <jason@lakedaemon.net>

thx,

Jason.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/3] mmc: mvsdio: workaround for spurious irqs
  2013-11-15 14:22 ` [PATCH 2/3] mmc: mvsdio: workaround for spurious irqs Sebastian Hesselbarth
@ 2013-11-24 17:06   ` Jason Cooper
  0 siblings, 0 replies; 7+ messages in thread
From: Jason Cooper @ 2013-11-24 17:06 UTC (permalink / raw)
  To: Sebastian Hesselbarth
  Cc: Thomas Petazzoni, Andrew Lunn, Nicolas Pitre, linux-mmc,
	linux-kernel, Chris Ball, linux-arm-kernel

On Fri, Nov 15, 2013 at 03:22:33PM +0100, Sebastian Hesselbarth wrote:
> SDIO controllers found on Marvell Kirkwood SoCs seem to cause a late,
> spurious irq although all interrupts have been disabled. This irq
> doesn't do any harm, neither to HW nor driver. To avoid some
> "unexpected irq" warning later, we workaround above issue by bailing
> out of irq handler early, if we didn't expect any.
> 
> Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
> ---
> Cc: Nicolas Pitre <nico@fluxnic.net>
> Cc: Chris Ball <cjb@laptop.org>
> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> Cc: Jason Cooper <jason@lakedaemon.net>
> Cc: Andrew Lunn <andrew@lunn.ch>
> Cc: linux-mmc@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-kernel@vger.kernel.org
> ---
>  drivers/mmc/host/mvsdio.c |   15 +++++++++++++++
>  1 files changed, 15 insertions(+), 0 deletions(-)

Acked-by: Jason Cooper <jason@lakedaemon.net>

thx,

Jason.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 3/3] mmc: mvsdio: silence card detect notice
  2013-11-15 14:22 ` [PATCH 3/3] mmc: mvsdio: silence card detect notice Sebastian Hesselbarth
@ 2013-11-24 17:07   ` Jason Cooper
  0 siblings, 0 replies; 7+ messages in thread
From: Jason Cooper @ 2013-11-24 17:07 UTC (permalink / raw)
  To: Sebastian Hesselbarth
  Cc: Thomas Petazzoni, Andrew Lunn, Nicolas Pitre, linux-mmc,
	linux-kernel, Chris Ball, linux-arm-kernel

On Fri, Nov 15, 2013 at 03:22:34PM +0100, Sebastian Hesselbarth wrote:
> mvsdio reports method of card detection with dev_notice, while for
> removable cards it may be sane, for non-removable cards it is not.
> Also, as the user cannot do anything about it, silence the message
> by reducing it from dev_notice to dev_dbg.
> 
> Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
> ---
> Cc: Nicolas Pitre <nico@fluxnic.net>
> Cc: Chris Ball <cjb@laptop.org>
> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> Cc: Jason Cooper <jason@lakedaemon.net>
> Cc: Andrew Lunn <andrew@lunn.ch>
> Cc: linux-mmc@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-kernel@vger.kernel.org
> ---
>  drivers/mmc/host/mvsdio.c |    5 ++---
>  1 files changed, 2 insertions(+), 3 deletions(-)

Acked-by: Jason Cooper <jason@lakedaemon.net>

thx,

Jason.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-11-24 17:07 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-15 14:22 [PATCH 0/3] Orion irqchip and Kirkwood SDIO Sebastian Hesselbarth
2013-11-15 14:22 ` [PATCH 1/3] irqchip: orion: reverse irq handling priority Sebastian Hesselbarth
2013-11-24 17:04   ` Jason Cooper
2013-11-15 14:22 ` [PATCH 2/3] mmc: mvsdio: workaround for spurious irqs Sebastian Hesselbarth
2013-11-24 17:06   ` Jason Cooper
2013-11-15 14:22 ` [PATCH 3/3] mmc: mvsdio: silence card detect notice Sebastian Hesselbarth
2013-11-24 17:07   ` Jason Cooper

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).