From patchwork Tue Jul 24 06:17:43 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilles Chanteperdrix X-Patchwork-Id: 1230281 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 982FA3FD4F for ; Tue, 24 Jul 2012 06:26:19 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1StYRz-0006nC-UC; Tue, 24 Jul 2012 06:18:32 +0000 Received: from casper.infradead.org ([2001:770:15f::2]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1StYRv-0006n7-T5 for linux-arm-kernel@merlin.infradead.org; Tue, 24 Jul 2012 06:18:28 +0000 Received: from xenomai.org ([88.191.95.136]) by casper.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1StYRt-00034a-OS for linux-arm-kernel@lists.infradead.org; Tue, 24 Jul 2012 06:18:26 +0000 Received: from men13-3-82-231-18-196.fbx.proxad.net ([82.231.18.196] helo=prometheus.local) by xenomai.org with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.72) (envelope-from ) id 1StYRk-0006ZW-7F; Tue, 24 Jul 2012 08:18:17 +0200 From: Gilles Chanteperdrix To: Nicolas Ferre , Jean-Christophe Plagniol-Villard , linux-arm-kernel@lists.infradead.org Subject: [PATCH] arm: at91: do not use irq_find_mapping for linear domain Date: Tue, 24 Jul 2012 08:17:43 +0200 Message-Id: <1343110663-14385-1-git-send-email-gilles.chanteperdrix@xenomai.org> X-Mailer: git-send-email 1.7.2.5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20120724_071825_873796_603E63AF X-CRM114-Status: GOOD ( 15.12 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on casper.infradead.org summary: Content analysis details: (-1.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 T_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] X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org When a gpio chip is registered through device tree, it declares an irq domain of the "linear" type. irq_find_mapping should not be used when translating between hw irq and linux irq numbers for such domains. So, replace irq_find_mapping with irq_linear_revmap. Signed-off-by: Gilles Chanteperdrix --- arch/arm/mach-at91/gpio.c | 13 ++++++++++++- 1 files changed, 12 insertions(+), 1 deletions(-) diff --git a/arch/arm/mach-at91/gpio.c b/arch/arm/mach-at91/gpio.c index 325837a..c98bb3c 100644 --- a/arch/arm/mach-at91/gpio.c +++ b/arch/arm/mach-at91/gpio.c @@ -39,6 +39,7 @@ struct at91_gpio_chip { int pioc_idx; /* PIO bank index */ void __iomem *regbase; /* PIO bank virtual address */ struct clk *clock; /* associated clock */ + bool linear_domain; struct irq_domain *domain; /* associated irq domain */ }; @@ -583,6 +584,14 @@ static struct irq_chip gpio_irqchip = { .irq_set_wake = gpio_irq_set_wake, }; +static unsigned gpio_revmap(struct at91_gpio_chip *at91_gpio, unsigned hwirq) +{ + if (at91_gpio->linear_domain) + return irq_linear_revmap(at91_gpio->domain, hwirq); + + return irq_find_mapping(at91_gpio->domain, hwirq); +} + static void gpio_irq_handler(unsigned irq, struct irq_desc *desc) { struct irq_data *idata = irq_desc_get_irq_data(desc); @@ -610,7 +619,7 @@ static void gpio_irq_handler(unsigned irq, struct irq_desc *desc) n = find_first_bit(&isr, BITS_PER_LONG); while (n < BITS_PER_LONG) { - generic_handle_irq(irq_find_mapping(at91_gpio->domain, n)); + generic_handle_irq(gpio_revmap(at91_gpio, n)); n = find_next_bit(&isr, BITS_PER_LONG, n + 1); } } @@ -759,6 +768,7 @@ int __init at91_gpio_of_irq_setup(struct device_node *node, if (!at91_gpio->domain) panic("at91_gpio.%d: couldn't allocate irq domain (DT).\n", at91_gpio->pioc_idx); + at91_gpio->linear_domain = true; /* Setup chained handler */ if (at91_gpio->pioc_idx) @@ -800,6 +810,7 @@ static void __init at91_gpio_irqdomain(struct at91_gpio_chip *at91_gpio) at91_gpio->domain = irq_domain_add_legacy(NULL, at91_gpio->chip.ngpio, irq_base, 0, &irq_domain_simple_ops, NULL); + at91_gpio->linear_domain = false; if (!at91_gpio->domain) panic("at91_gpio.%d: couldn't allocate irq domain.\n", at91_gpio->pioc_idx);