From patchwork Fri May 24 09:13:07 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guennadi Liakhovetski X-Patchwork-Id: 2609801 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork2.kernel.org (Postfix) with ESMTP id ECF49DF24C for ; Fri, 24 May 2013 09:13:46 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Ufo4G-00074p-58; Fri, 24 May 2013 09:13:44 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Ufo4B-0000wH-Pg; Fri, 24 May 2013 09:13:39 +0000 Received: from moutng.kundenserver.de ([212.227.126.187]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Ufo48-0000vb-Vc for linux-arm-kernel@lists.infradead.org; Fri, 24 May 2013 09:13:37 +0000 Received: from axis700.grange (dslb-094-221-108-142.pools.arcor-ip.net [94.221.108.142]) by mrelayeu.kundenserver.de (node=mreu1) with ESMTP (Nemesis) id 0MAASz-1Um5Rl0zPd-00B44c; Fri, 24 May 2013 11:13:08 +0200 Received: by axis700.grange (Postfix, from userid 1000) id E7E1D40BB4; Fri, 24 May 2013 11:13:07 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by axis700.grange (Postfix) with ESMTP id E58F640BB3; Fri, 24 May 2013 11:13:07 +0200 (CEST) Date: Fri, 24 May 2013 11:13:07 +0200 (CEST) From: Guennadi Liakhovetski X-X-Sender: lyakh@axis700.grange To: linux-sh@vger.kernel.org Subject: [PATCH 2/2] ARM: shmobile: irqpin: map spurious interrupts in DT case In-Reply-To: Message-ID: References: MIME-Version: 1.0 X-Provags-ID: V02:K0:GE7BK4pKAIjh45U1ofWkPkbEin2YHOqf8/8vrLNHO5x PTyN8t6gCGZdQkc3ECHHSzDuMRjvTSnObyW3xpS7tlVxE1qSpe 0/Ptmj7NtZN5H9lFxftbESIvPZ6i3y0hrPNiVGT075QTZG7ikc y1YYH966uftv2eokOZvSm6JZNk2iax3ntJ23lIoqXlW3cuLKFE f1VCNRvV9Ykt+XtD0R14i3TvxGCNWqsU4o8nK6AdLtRcjgJ7ne FCl88PAr7LeFq67sJwPnjV+kg+LgbhpXmftFa46Rl4wp715N07 s/mhDUMMGlz4hh10ocAaTvhhKZgNfIrTdsrhd8AwvBFV3qTxlm weB0GQoeHyRg9XcFwiv6Oa8YV7sLyvokb4oc2Tx1kBlvwrTF2T TrSbBAJUMekVg== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130524_051337_261548_7BC06876 X-CRM114-Status: GOOD ( 13.33 ) X-Spam-Score: -3.0 (---) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-3.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (g.liakhovetski[at]gmx.de) -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [212.227.126.187 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.1 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: devicetree-discuss@lists.ozlabs.org, Simon Horman , Magnus Damm , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org In the non-DT case all interrupts get mapped statically during probing, therefore, if a spurious interrupt arrives, it can easily be mapped back to hardware registers and bits and handled. In the DT case interrupts are mapped only when a device, using that interrupt is instantiated from DT. So, spurious interrupts occur unmapped and thus cannot be handled properly. This patch fixes this by mapping such interrupts as they occur. Signed-off-by: Guennadi Liakhovetski --- drivers/irqchip/irq-renesas-intc-irqpin.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/drivers/irqchip/irq-renesas-intc-irqpin.c b/drivers/irqchip/irq-renesas-intc-irqpin.c index 82cec63..e62d76d 100644 --- a/drivers/irqchip/irq-renesas-intc-irqpin.c +++ b/drivers/irqchip/irq-renesas-intc-irqpin.c @@ -71,6 +71,7 @@ struct intc_irqpin_priv { struct intc_irqpin_iomem iomem[INTC_IRQPIN_REG_NR]; struct intc_irqpin_irq irq[INTC_IRQPIN_MAX]; struct renesas_intc_irqpin_config config; + unsigned int min_irq; unsigned int number_of_irqs; struct platform_device *pdev; struct irq_chip irq_chip; @@ -274,6 +275,10 @@ static irqreturn_t intc_irqpin_irq_handler(int irq, void *dev_id) struct intc_irqpin_priv *p = i->p; unsigned long bit; + if (!i->domain_irq) + /* unmapped: spurious IRQ, map it now */ + irq_create_mapping(p->irq_domain, irq - p->min_irq); + intc_irqpin_dbg(i, "demux1"); bit = intc_irqpin_hwirq_mask(p, INTC_IRQPIN_REG_SOURCE, i->hw_irq); @@ -372,6 +377,7 @@ static int intc_irqpin_probe(struct platform_device *pdev) } } + p->min_irq = INT_MAX; /* allow any number of IRQs between 1 and INTC_IRQPIN_MAX */ for (k = 0; k < INTC_IRQPIN_MAX; k++) { irq = platform_get_resource(pdev, IORESOURCE_IRQ, k); @@ -380,6 +386,8 @@ static int intc_irqpin_probe(struct platform_device *pdev) p->irq[k].p = p; p->irq[k].requested_irq = irq->start; + if (p->min_irq > irq->start) + p->min_irq = irq->start; } p->number_of_irqs = k;