From patchwork Sat Nov 15 11:53:52 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 5311701 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9C9A99FD26 for ; Sat, 15 Nov 2014 11:57:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A73C020155 for ; Sat, 15 Nov 2014 11:57:43 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CF7B820149 for ; Sat, 15 Nov 2014 11:57:42 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XpbxJ-0003th-Or; Sat, 15 Nov 2014 11:55:53 +0000 Received: from mail-wg0-x235.google.com ([2a00:1450:400c:c00::235]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Xpbw8-000274-FC for linux-arm-kernel@lists.infradead.org; Sat, 15 Nov 2014 11:54:41 +0000 Received: by mail-wg0-f53.google.com with SMTP id b13so21339602wgh.12 for ; Sat, 15 Nov 2014 03:54:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=BJEWZy/xjL1uSey0PgsR1bHxGbURYMkEk37Nu1BZutU=; b=HY4yUONen4/EQWOLl3dWveO96KcwiRPFW/IgpogSSl9/Av+aEChm+9atMIqzzp0LJn F0v2bLmtM34QRQhrDvhIxecZPa2I6LORcEkcGwSFLibWe3jNLBkYfdVaWtORumJQyG+V 8LY+Y4WincO4DgL29sSVKxYaBq47mo0c7y0NPtw42IAlEvsFF9iYNpZYLReoacXqP+wB dBu4hGhUm1pqjpGeZIzsdyR0Ju0iL5CWC685sF3naIZqoOKpNJ2MgD4/E8NR99KjqDTW +oiKFR/XsIrRTY0i9pXTUv2r0wE/PdkAvZae14x5CmyMTTC0s5agJwpLlSvZ37KujQdw Okqw== X-Received: by 10.180.88.162 with SMTP id bh2mr15425538wib.77.1416052458438; Sat, 15 Nov 2014 03:54:18 -0800 (PST) Received: from fangorn.rup.mentorg.com (nat-min.mentorg.com. [139.181.32.34]) by mx.google.com with ESMTPSA id iz19sm320959wic.8.2014.11.15.03.54.16 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 15 Nov 2014 03:54:17 -0800 (PST) From: Dmitry Eremin-Solenikov To: Russell King Subject: [PATCH 6/6] ARM: sa1100: switch to hwirq usage Date: Sat, 15 Nov 2014 14:53:52 +0300 Message-Id: <1416052432-26192-7-git-send-email-dbaryshkov@gmail.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1416052432-26192-1-git-send-email-dbaryshkov@gmail.com> References: <1416052432-26192-1-git-send-email-dbaryshkov@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141115_035440_695304_232A96E5 X-CRM114-Status: GOOD ( 13.72 ) X-Spam-Score: -0.8 (/) Cc: Linus Walleij , Arnd Bergmann , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Switch internally to using hardware irq numbers (hwirq). In case of GPIO interrupts, hwirq is equal to GPIO number. In case of system interrupts, hwirq is equal to interrupt number in the interrupt controller. Signed-off-by: Dmitry Eremin-Solenikov --- arch/arm/mach-sa1100/irq.c | 37 ++++++++++++++----------------------- 1 file changed, 14 insertions(+), 23 deletions(-) diff --git a/arch/arm/mach-sa1100/irq.c b/arch/arm/mach-sa1100/irq.c index 36dd45e..c88d9c3 100644 --- a/arch/arm/mach-sa1100/irq.c +++ b/arch/arm/mach-sa1100/irq.c @@ -35,20 +35,11 @@ static int GPIO_IRQ_rising_edge; static int GPIO_IRQ_falling_edge; static int GPIO_IRQ_mask = (1 << 11) - 1; -/* - * To get the GPIO number from an IRQ number - */ -#define GPIO_11_27_IRQ(i) ((i) - 21) -#define GPIO11_27_MASK(irq) (1 << GPIO_11_27_IRQ(irq)) - static int sa1100_gpio_type(struct irq_data *d, unsigned int type) { unsigned int mask; - if (d->irq <= 10) - mask = 1 << d->irq; - else - mask = GPIO11_27_MASK(d->irq); + mask = BIT(d->hwirq); if (type == IRQ_TYPE_PROBE) { if ((GPIO_IRQ_rising_edge | GPIO_IRQ_falling_edge) & mask) @@ -76,25 +67,25 @@ static int sa1100_gpio_type(struct irq_data *d, unsigned int type) */ static void sa1100_low_gpio_ack(struct irq_data *d) { - GEDR = (1 << d->irq); + GEDR = BIT(d->hwirq); } static void sa1100_low_gpio_mask(struct irq_data *d) { - ICMR &= ~(1 << d->irq); + ICMR &= ~BIT(d->hwirq); } static void sa1100_low_gpio_unmask(struct irq_data *d) { - ICMR |= 1 << d->irq; + ICMR |= BIT(d->hwirq); } static int sa1100_low_gpio_wake(struct irq_data *d, unsigned int on) { if (on) - PWER |= 1 << d->irq; + PWER |= BIT(d->hwirq); else - PWER &= ~(1 << d->irq); + PWER &= ~BIT(d->hwirq); return 0; } @@ -162,14 +153,14 @@ sa1100_high_gpio_handler(unsigned int irq, struct irq_desc *desc) */ static void sa1100_high_gpio_ack(struct irq_data *d) { - unsigned int mask = GPIO11_27_MASK(d->irq); + unsigned int mask = BIT(d->hwirq); GEDR = mask; } static void sa1100_high_gpio_mask(struct irq_data *d) { - unsigned int mask = GPIO11_27_MASK(d->irq); + unsigned int mask = BIT(d->hwirq); GPIO_IRQ_mask &= ~mask; @@ -179,7 +170,7 @@ static void sa1100_high_gpio_mask(struct irq_data *d) static void sa1100_high_gpio_unmask(struct irq_data *d) { - unsigned int mask = GPIO11_27_MASK(d->irq); + unsigned int mask = BIT(d->hwirq); GPIO_IRQ_mask |= mask; @@ -190,9 +181,9 @@ static void sa1100_high_gpio_unmask(struct irq_data *d) static int sa1100_high_gpio_wake(struct irq_data *d, unsigned int on) { if (on) - PWER |= GPIO11_27_MASK(d->irq); + PWER |= BIT(d->hwirq); else - PWER &= ~GPIO11_27_MASK(d->irq); + PWER &= ~BIT(d->hwirq); return 0; } @@ -228,12 +219,12 @@ static struct irq_domain *sa1100_high_gpio_irqdomain; */ static void sa1100_mask_irq(struct irq_data *d) { - ICMR &= ~(1 << d->irq); + ICMR &= ~BIT(d->hwirq); } static void sa1100_unmask_irq(struct irq_data *d) { - ICMR |= (1 << d->irq); + ICMR |= BIT(d->hwirq); } /* @@ -241,7 +232,7 @@ static void sa1100_unmask_irq(struct irq_data *d) */ static int sa1100_set_wake(struct irq_data *d, unsigned int on) { - if (d->irq == IRQ_RTCAlrm) { + if (d->hwirq == IRQ_RTCAlrm) { if (on) PWER |= PWER_RTC; else