Skip to contentSkip to conversation

irqchip: meson: add support for the gpio interrupt controller

PATCH Superseded Jerome Brunet 3 participants 6 messages Sep 18, 2017 – Oct 18, 2017

Subsystems (3)
lore
Share & tools
lore

Jerome Brunet

author reviewer
#0 lore raw

v4 cover irqchip: meson: add support for the gpio interrupt controller

This patch series adds support for the GPIO interrupt controller found on Amlogic's meson SoC families.

Unlike what the name suggests, this controller is not part of the SoC GPIO subsystem. It is a separate controller which can watch almost all gpio pads of the SoC and generate and interrupt from it. "Almost" because there are always exceptions and some specific gpios (TEST_N) lack this capability.

Hardware wise, the controller is a 256 to 8 router with a filtering block to select edge or level input and the polarity of the signal. We can't setup the filtring to generate a signal on both the high and low polarity so, ATM, IRQ_TYPE_EDGE_BOTH is not supported.

The number of interrupt line routed to the controller depends on the SoC, and essentially the total number of GPIO available on the different gpio controllers of the SoC.

This series has been tested on Amlogic S905-P200 board with the front panel power button. Also tested on the Nanopi-k2 with the ethernet PHY interrupt pin.

This work is derived from the previous work of Carlo Caione [1].

Changes since RFC : [2]
* Remove interrupt property in device tree: the controller cannot generate interrupts on its own and is merely routing the interrupt to the GIC, therefore it should not use the interrupt property. This data is now stored directly in the driver, same as the pinctrl data.
* Improve compatibility checking of meson pinctrl on its interrupt parent to activate gpio_to_irq callback
* Drop IRQ_BOTH hack. Need more work to have an acceptable solution for this

Changes since v1 : [3]
* Correct mistake in patch 4 when no compatible controller is found. Sorry for the inconvenience.

Changes since v2: [4]
* Address Marc's comment on the irqchip driver from v2
* Drop all gpio subsystem related patches. This will be dealt with separately.

Changes since v3: [5]
* Replace "upstream" irq with "channel" irq
* Improve documentation a bit.
* Drop DT patches: these will be sent later on to the DT maintainer if/when the driver is accepted.

[1] : https://lkml.kernel.org/r/1448987062-31225-1-git-send-email-carlo at caione.org
[2] : https://lkml.kernel.org/r/1475593708-10526-1-git-send-email-jbrunet at baylibre.com
[3] : https://lkml.kernel.org/r/1476871709-8359-1-git-send-email-jbrunet at baylibre.com
[4] : https://lkml.kernel.org/r/1476890480-8884-1-git-send-email-jbrunet at baylibre.com
[5] : https://lkml.kernel.org/r/20170615161804.32658-1-jbrunet at baylibre.com

Jerome Brunet (2):
dt-bindings: interrupt-controller: add DT binding for meson GPIO
interrupt controller
irqchip: meson: add support for gpio interrupt controller

 .../amlogic,meson-gpio-intc.txt                    |  35 ++
 drivers/irqchip/Kconfig                            |   8 +
 drivers/irqchip/Makefile                           |   1 +
 drivers/irqchip/irq-meson-gpio.c                   | 414 +++++++++++++++++++++
 4 files changed, 458 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/interrupt-controller/amlogic,meson-gpio-intc.txt
 create mode 100644 drivers/irqchip/irq-meson-gpio.c
Signature · 1 line
2.13.5
author reviewer
#1 lore raw

v4 cover irqchip: meson: add support for the gpio interrupt controller

This patch series adds support for the GPIO interrupt controller found on Amlogic's meson SoC families.

Unlike what the name suggests, this controller is not part of the SoC GPIO subsystem. It is a separate controller which can watch almost all gpio pads of the SoC and generate and interrupt from it. "Almost" because there are always exceptions and some specific gpios (TEST_N) lack this capability.

Hardware wise, the controller is a 256 to 8 router with a filtering block to select edge or level input and the polarity of the signal. We can't setup the filtring to generate a signal on both the high and low polarity so, ATM, IRQ_TYPE_EDGE_BOTH is not supported.

The number of interrupt line routed to the controller depends on the SoC, and essentially the total number of GPIO available on the different gpio controllers of the SoC.

This series has been tested on Amlogic S905-P200 board with the front panel power button. Also tested on the Nanopi-k2 with the ethernet PHY interrupt pin.

This work is derived from the previous work of Carlo Caione [1].

Changes since RFC : [2]
* Remove interrupt property in device tree: the controller cannot generate interrupts on its own and is merely routing the interrupt to the GIC, therefore it should not use the interrupt property. This data is now stored directly in the driver, same as the pinctrl data.
* Improve compatibility checking of meson pinctrl on its interrupt parent to activate gpio_to_irq callback
* Drop IRQ_BOTH hack. Need more work to have an acceptable solution for this

Changes since v1 : [3]
* Correct mistake in patch 4 when no compatible controller is found. Sorry for the inconvenience.

Changes since v2: [4]
* Address Marc's comment on the irqchip driver from v2
* Drop all gpio subsystem related patches. This will be dealt with separately.

Changes since v3: [5]
* Replace "upstream" irq with "channel" irq
* Improve documentation a bit.
* Drop DT patches: these will be sent later on to the DT maintainer if/when the driver is accepted.

[1] : https://lkml.kernel.org/r/1448987062-31225-1-git-send-email-carlo at caione.org
[2] : https://lkml.kernel.org/r/1475593708-10526-1-git-send-email-jbrunet at baylibre.com
[3] : https://lkml.kernel.org/r/1476871709-8359-1-git-send-email-jbrunet at baylibre.com
[4] : https://lkml.kernel.org/r/1476890480-8884-1-git-send-email-jbrunet at baylibre.com
[5] : https://lkml.kernel.org/r/20170615161804.32658-1-jbrunet at baylibre.com

Jerome Brunet (2):
dt-bindings: interrupt-controller: add DT binding for meson GPIO
interrupt controller
irqchip: meson: add support for gpio interrupt controller

 .../amlogic,meson-gpio-intc.txt                    |  35 ++
 drivers/irqchip/Kconfig                            |   8 +
 drivers/irqchip/Makefile                           |   1 +
 drivers/irqchip/irq-meson-gpio.c                   | 414 +++++++++++++++++++++
 4 files changed, 458 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/interrupt-controller/amlogic,meson-gpio-intc.txt
 create mode 100644 drivers/irqchip/irq-meson-gpio.c
Signature · 1 line
2.13.5
author reviewer
#2 lore raw

PATCH v4 1/2 dt-bindings: interrupt-controller: add DT binding for meson GPIO interrupt controller

In reply to Jerome Brunet

This commit adds the device tree bindings description for Amlogic's GPIO interrupt controller available on the meson8b, gxbb and gxl SoC families

Cc Heiner Kallweit <[email protected]>
---
 .../amlogic,meson-gpio-intc.txt                    | 35 ++++++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/interrupt-controller/amlogic,meson-gpio-intc.txt
Documentation/devicetree/bindings/interrupt-controller/amlogic,meson-gpio-intc.txt new file +35 -0
new file mode 100644
index 000000000000..633e21ce4b17
@@ -0,0 +1,35 @@
+Amlogic meson GPIO interrupt controller
+
+Meson SoCs contains an interrupt controller which is able to watch the SoC
+pads and generate an interrupt on edge or level. The controller is essentially
+a 256 pads to 8 GIC interrupt multiplexer, with a filter block to select edge
+or level and polarity. It does not expose all 256 mux inputs because the
+documentation shows that the upper part is not mapped to any pad. The actual
+number of interrupt exposed depends on the SoC.
+
+Required properties:
+
+- compatible : must have "amlogic,meson8-gpio-intc? and either
+   ?amlogic,meson8b-gpio-intc? for meson8b SoCs (S805) or
+   ?amlogic,meson-gxbb-gpio-intc? for GXBB SoCs (S905) or
+   ?amlogic,meson-gxl-gpio-intc? for GXL SoCs (S905X, S912)
+- interrupt-parent : a phandle to the GIC the interrupts are routed to.
+   Usually this is provided at the root level of the device tree as it is
+   common to most of the SoC.
+- reg : Specifies base physical address and size of the registers.
+- interrupt-controller : Identifies the node as an interrupt controller.
+- #interrupt-cells : Specifies the number of cells needed to encode an
+   interrupt source. The value must be 2.
+- meson,channel-interrupts: Array with the 8 upstream hwirq numbers. These
+   are the hwirqs used on the parent interrupt controller.
+
+Example:
+
+gpio_interrupt: interrupt-controller at 9880 {
+	compatible = "amlogic,meson-gxbb-gpio-intc",
+		     "amlogic,meson-gpio-intc";
+	reg = <0x0 0x9880 0x0 0x10>;
+	interrupt-controller;
+	#interrupt-cells = <2>;
+	meson,channel-interrupts = <64 65 66 67 68 69 70 71>;
+};
Signature · 1 line
2.13.5
maintainer Acked-by on v4 1/2
#3 lore raw

Re: [PATCH v4 1/2] dt-bindings: interrupt-controller: add DT binding for meson GPIO interrupt controller

Quoted 9 lines · Jerome Brunet

This commit adds the device tree bindings description for Amlogic's GPIO interrupt controller available on the meson8b, gxbb and gxl SoC families

Cc Heiner Kallweit <[email protected]>
---
 .../amlogic,meson-gpio-intc.txt                    | 35 ++++++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/interrupt-controller/amlogic,meson-gpio-intc.txt
author reviewer
#4 lore raw

PATCH v4 2/2 irqchip: meson: add support for gpio interrupt controller

In reply to Jerome Brunet

Add support for the interrupt gpio controller found on Amlogic's meson SoC family.

This controller is a separate controller from the gpio controller. It is able to spy on the SoC pad. It is essentially a 256 to 8 router with a filtering block to select level or edge and polarity. The number of actual mappable inputs depends on the SoC.

Cc Heiner Kallweit <[email protected]>
---
 drivers/irqchip/Kconfig          |   8 +
 drivers/irqchip/Makefile         |   1 +
 drivers/irqchip/irq-meson-gpio.c | 414 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 423 insertions(+)
 create mode 100644 drivers/irqchip/irq-meson-gpio.c
drivers/irqchip/Kconfig +8 -0
index 9d8a1dd2e2c2..8e50dfea0973 100644
@@ -321,3 +321,11 @@ config IRQ_UNIPHIER_AIDET
 	select IRQ_DOMAIN_HIERARCHY
 	help
 	  Support for the UniPhier AIDET (ARM Interrupt Detector).
+
+config MESON_IRQ_GPIO
+       bool "Meson GPIO Interrupt Multiplexer"
+       depends on ARCH_MESON || COMPILE_TEST
+       select IRQ_DOMAIN
+       select IRQ_DOMAIN_HIERARCHY
+       help
+         Support Meson SoC Family GPIO Interrupt Multiplexer
drivers/irqchip/Makefile +1 -0
index 845abc107ad5..065adf4102c9 100644
@@ -79,3 +79,4 @@ obj-$(CONFIG_ARCH_ASPEED)		+= irq-aspeed-vic.o irq-aspeed-i2c-ic.o
 obj-$(CONFIG_STM32_EXTI) 		+= irq-stm32-exti.o
 obj-$(CONFIG_QCOM_IRQ_COMBINER)		+= qcom-irq-combiner.o
 obj-$(CONFIG_IRQ_UNIPHIER_AIDET)	+= irq-uniphier-aidet.o
+obj-$(CONFIG_MESON_IRQ_GPIO)		+= irq-meson-gpio.o
drivers/irqchip/irq-meson-gpio.c new file +414 -0

414 lines not on this page · raw message

Signature · 1 line
2.13.5
#5 lore raw
In reply to Jerome Brunet
Quoted 18 lines · Jerome Brunet

This patch series adds support for the GPIO interrupt controller found on Amlogic's meson SoC families.

Unlike what the name suggests, this controller is not part of the SoC GPIO subsystem. It is a separate controller which can watch almost all gpio pads of the SoC and generate and interrupt from it. "Almost" because there are always exceptions and some specific gpios (TEST_N) lack this capability.

Hardware wise, the controller is a 256 to 8 router with a filtering block to select edge or level input and the polarity of the signal. We can't setup the filtring to generate a signal on both the high and low polarity so, ATM, IRQ_TYPE_EDGE_BOTH is not supported.

The number of interrupt line routed to the controller depends on the SoC, and essentially the total number of GPIO available on the different gpio controllers of the SoC.

Quoted 5 lines

This series has been tested on Amlogic S905-P200 board with the front panel power button. Also tested on the Nanopi-k2 with the ethernet PHY interrupt pin.

This work is derived from the previous work of Carlo Caione [1].

Queued for 4.15.

	M.
Signature · 1 line
Jazz is not dead, it just smell funny.