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: 2609781 Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id A85C1DF24C for ; Fri, 24 May 2013 09:13:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760087Ab3EXJNN (ORCPT ); Fri, 24 May 2013 05:13:13 -0400 Received: from moutng.kundenserver.de ([212.227.126.187]:57629 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759741Ab3EXJNM (ORCPT ); Fri, 24 May 2013 05:13:12 -0400 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 cc: Magnus Damm , Simon Horman , linux-arm-kernel@lists.infradead.org, devicetree-discuss@lists.ozlabs.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== Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.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;