From patchwork Wed Apr 10 10:39:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Belloni X-Patchwork-Id: 1083300 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-gpio-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=bootlin.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 44fLJK6JCyz9s70 for ; Wed, 10 Apr 2019 20:39:45 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730639AbfDJKjp (ORCPT ); Wed, 10 Apr 2019 06:39:45 -0400 Received: from relay11.mail.gandi.net ([217.70.178.231]:49561 "EHLO relay11.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727943AbfDJKjp (ORCPT ); Wed, 10 Apr 2019 06:39:45 -0400 Received: from localhost (alyon-652-1-42-177.w109-213.abo.wanadoo.fr [109.213.33.177]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay11.mail.gandi.net (Postfix) with ESMTPSA id 725D3100008; Wed, 10 Apr 2019 10:39:41 +0000 (UTC) From: Alexandre Belloni To: Linus Walleij , Bartosz Golaszewski Cc: Vladimir Zapolskiy , devicetree@vger.kernel.org, linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Alexandre Belloni , Rob Herring Subject: [PATCH 1/3] dt-bindings: gpio: lpc32xx: document interrupt bindings Date: Wed, 10 Apr 2019 12:39:24 +0200 Message-Id: <20190410103926.8781-2-alexandre.belloni@bootlin.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190410103926.8781-1-alexandre.belloni@bootlin.com> References: <20190410103926.8781-1-alexandre.belloni@bootlin.com> MIME-Version: 1.0 Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Some of the LPC32xx gpios are wired directly to one of the interrupt controllers while port 0 and port 1 share the same interrupt for their interrupt capable gpios. Cc: Rob Herring Signed-off-by: Alexandre Belloni --- Documentation/devicetree/bindings/gpio/gpio_lpc32xx.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/devicetree/bindings/gpio/gpio_lpc32xx.txt b/Documentation/devicetree/bindings/gpio/gpio_lpc32xx.txt index 49819367a011..e7957a17e4db 100644 --- a/Documentation/devicetree/bindings/gpio/gpio_lpc32xx.txt +++ b/Documentation/devicetree/bindings/gpio/gpio_lpc32xx.txt @@ -16,6 +16,10 @@ Required properties: 3) optional parameters: - bit 0 specifies polarity (0 for normal, 1 for inverted) - reg: Index of the GPIO group +- interrupts: Should be the interrupt shared by port 0 and port 1 and the + interrupts for individual pins from port 3. +- interrupt-names : Should be the names of irq resources. The shared port + interrupt is named "p01", the other use the pin names. Example: From patchwork Wed Apr 10 10:39:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Belloni X-Patchwork-Id: 1083302 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-gpio-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=bootlin.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 44fLJS6rgSz9s4V for ; Wed, 10 Apr 2019 20:39:52 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730606AbfDJKjw (ORCPT ); Wed, 10 Apr 2019 06:39:52 -0400 Received: from relay7-d.mail.gandi.net ([217.70.183.200]:46691 "EHLO relay7-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727943AbfDJKjw (ORCPT ); Wed, 10 Apr 2019 06:39:52 -0400 X-Originating-IP: 109.213.33.177 Received: from localhost (alyon-652-1-42-177.w109-213.abo.wanadoo.fr [109.213.33.177]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 836392000E; Wed, 10 Apr 2019 10:39:46 +0000 (UTC) From: Alexandre Belloni To: Linus Walleij , Bartosz Golaszewski Cc: Vladimir Zapolskiy , devicetree@vger.kernel.org, linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Alexandre Belloni Subject: [PATCH 2/3] gpio: lpc32xx: enable interrupt lookup for port 3 Date: Wed, 10 Apr 2019 12:39:25 +0200 Message-Id: <20190410103926.8781-3-alexandre.belloni@bootlin.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190410103926.8781-1-alexandre.belloni@bootlin.com> References: <20190410103926.8781-1-alexandre.belloni@bootlin.com> MIME-Version: 1.0 Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Interrupt support was disabled "temporarily" in commit 320a6480ef24 ("gpio: lpc32xx: disable broken to_irq support"). Reenable to_irq for port 3 as they are directly connected to an interrupt controller and a simple lookup is working. Signed-off-by: Alexandre Belloni --- drivers/gpio/gpio-lpc32xx.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/gpio/gpio-lpc32xx.c b/drivers/gpio/gpio-lpc32xx.c index aa74cc4d8b14..24f09b08e319 100644 --- a/drivers/gpio/gpio-lpc32xx.c +++ b/drivers/gpio/gpio-lpc32xx.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -385,14 +386,9 @@ static int lpc32xx_gpio_to_irq_p01(struct gpio_chip *chip, unsigned offset) return -ENXIO; } -static int lpc32xx_gpio_to_irq_gpio_p3(struct gpio_chip *chip, unsigned offset) +static int lpc32xx_gpio_to_irq_p3(struct gpio_chip *chip, unsigned int offset) { - return -ENXIO; -} - -static int lpc32xx_gpio_to_irq_gpi_p3(struct gpio_chip *chip, unsigned offset) -{ - return -ENXIO; + return of_irq_get_byname(chip->of_node, chip->names[offset]); } static struct lpc32xx_gpio_chip lpc32xx_gpiochip[] = { @@ -451,7 +447,7 @@ static struct lpc32xx_gpio_chip lpc32xx_gpiochip[] = { .direction_output = lpc32xx_gpio_dir_output_p3, .set = lpc32xx_gpio_set_value_p3, .request = lpc32xx_gpio_request, - .to_irq = lpc32xx_gpio_to_irq_gpio_p3, + .to_irq = lpc32xx_gpio_to_irq_p3, .base = LPC32XX_GPIO_P3_GRP, .ngpio = LPC32XX_GPIO_P3_MAX, .names = gpio_p3_names, @@ -465,7 +461,7 @@ static struct lpc32xx_gpio_chip lpc32xx_gpiochip[] = { .direction_input = lpc32xx_gpio_dir_in_always, .get = lpc32xx_gpi_get_value, .request = lpc32xx_gpio_request, - .to_irq = lpc32xx_gpio_to_irq_gpi_p3, + .to_irq = lpc32xx_gpio_to_irq_p3, .base = LPC32XX_GPI_P3_GRP, .ngpio = LPC32XX_GPI_P3_MAX, .names = gpi_p3_names, From patchwork Wed Apr 10 10:39:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Belloni X-Patchwork-Id: 1083304 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-gpio-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=bootlin.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 44fLJh5qBdz9s70 for ; Wed, 10 Apr 2019 20:40:04 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730674AbfDJKj7 (ORCPT ); Wed, 10 Apr 2019 06:39:59 -0400 Received: from relay7-d.mail.gandi.net ([217.70.183.200]:40861 "EHLO relay7-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727943AbfDJKj6 (ORCPT ); Wed, 10 Apr 2019 06:39:58 -0400 X-Originating-IP: 109.213.33.177 Received: from localhost (alyon-652-1-42-177.w109-213.abo.wanadoo.fr [109.213.33.177]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 41D7020010; Wed, 10 Apr 2019 10:39:54 +0000 (UTC) From: Alexandre Belloni To: Linus Walleij , Bartosz Golaszewski Cc: Vladimir Zapolskiy , devicetree@vger.kernel.org, linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Alexandre Belloni Subject: [PATCH 3/3] ARM: dts: lpc32xx: add GPIO interrupts Date: Wed, 10 Apr 2019 12:39:26 +0200 Message-Id: <20190410103926.8781-4-alexandre.belloni@bootlin.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190410103926.8781-1-alexandre.belloni@bootlin.com> References: <20190410103926.8781-1-alexandre.belloni@bootlin.com> MIME-Version: 1.0 Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Add the interrupts for the GPIO controller. Signed-off-by: Alexandre Belloni --- arch/arm/boot/dts/lpc32xx.dtsi | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/arch/arm/boot/dts/lpc32xx.dtsi b/arch/arm/boot/dts/lpc32xx.dtsi index 20b38f4ade37..9c61b1856291 100644 --- a/arch/arm/boot/dts/lpc32xx.dtsi +++ b/arch/arm/boot/dts/lpc32xx.dtsi @@ -392,6 +392,31 @@ reg = <0x40028000 0x1000>; gpio-controller; #gpio-cells = <3>; /* bank, pin, flags */ + interrupts-extended = <&sic2 8 IRQ_TYPE_NONE>, + <&sic2 22 IRQ_TYPE_NONE>, + <&sic2 23 IRQ_TYPE_NONE>, + <&sic2 24 IRQ_TYPE_NONE>, + <&sic2 25 IRQ_TYPE_NONE>, + <&sic2 26 IRQ_TYPE_NONE>, + <&sic2 27 IRQ_TYPE_NONE>, + <&sic2 28 IRQ_TYPE_NONE>, + <&sic2 15 IRQ_TYPE_NONE>, + <&sic2 9 IRQ_TYPE_NONE>, + <&sic2 10 IRQ_TYPE_NONE>, + <&sic1 4 IRQ_TYPE_NONE>, + <&sic2 0 IRQ_TYPE_NONE>, + <&sic2 1 IRQ_TYPE_NONE>, + <&sic2 2 IRQ_TYPE_NONE>, + <&sic2 3 IRQ_TYPE_NONE>, + <&sic2 4 IRQ_TYPE_NONE>, + <&sic2 5 IRQ_TYPE_NONE>; + interrupt-names = "p01", + "gpi00", "gpi01", "gpi02", + "gpi03", "gpi04", "gpi05", + "gpi06", "gpi07", "gpi08", + "gpi09", "gpi19", "gpi28", + "gpio00", "gpio01", "gpio02", + "gpio03", "gpio04", "gpio05"; }; timer4: timer@4002c000 {