linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] dt: Document general interrupt controller bindings
@ 2012-09-19  8:57 Thierry Reding
  2012-09-19  8:57 ` [PATCH 2/2] gpio: adnp: dt: Reference generic interrupt binding Thierry Reding
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Thierry Reding @ 2012-09-19  8:57 UTC (permalink / raw)
  To: Rob Herring; +Cc: Linus Walleij, Grant Likely, devicetree-discuss, linux-kernel

In order to use a device as interrupt controller, it needs to be marked
with the DT interrupt-controller property. This commit adds rudimentary
documentation about the required standard properties and describes the
most commonly used interrupt specifiers.

Cc: Linus Walleij <linus.walleij@stericsson.com>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Rob Herring <rob.herring@calxeda.com>
Cc: devicetree-discuss@lists.ozlabs.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
---
This patch is for Rob's tree as it documents the general bindings.

 .../bindings/interrupt-controller/interrupts.txt   | 94 ++++++++++++++++++++++
 1 file changed, 94 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/interrupt-controller/interrupts.txt

diff --git a/Documentation/devicetree/bindings/interrupt-controller/interrupts.txt b/Documentation/devicetree/bindings/interrupt-controller/interrupts.txt
new file mode 100644
index 0000000..6cafe3a
--- /dev/null
+++ b/Documentation/devicetree/bindings/interrupt-controller/interrupts.txt
@@ -0,0 +1,94 @@
+Specifying interrupt information for devices
+============================================
+
+1) Interrupt user nodes
+-----------------------
+
+A device that generates interrupts can specify the interrupt controller to
+which the interrupts are routed by passing the controller's phandle in the
+"interrupt-parent" property.
+
+The "interrupts" property is a list of specifiers that describe each of the
+interrupts. See section 2 below for details.
+
+2) Interrupt controller nodes
+-----------------------------
+
+A device is marked as an interrupt controller with the "interrupt-controller"
+property. This is a empty, boolean property. An additional "#interrupt-cells"
+property defines the number of cells needed to specify a single interrupt.
+
+It is the responsibility of the interrupt controller's binding to define the
+length and format of the interrupt specifier. The following two variants are
+commonly used:
+
+  a) one cell
+  -----------
+  The #interrupt-cells property is set to 1 and the single cell defines the
+  index of the interrupt within the controller.
+
+  Example:
+
+	vic: intc@10140000 {
+		compatible = "arm,versatile-vic";
+		interrupt-controller;
+		#interrupt-cells = <1>;
+		reg = <0x10140000 0x1000>;
+	};
+
+	sic: intc@10003000 {
+		compatible = "arm,versatile-sic";
+		interrupt-controller;
+		#interrupt-cells = <1>;
+		reg = <0x10003000 0x1000>;
+		interrupt-parent = <&vic>;
+		interrupts = <31>; /* Cascaded to vic */
+	};
+
+  b) two cells
+  ------------
+  The #interrupt-cells property is set to 2 and the first cell defines the
+  index of the interrupt within the controller, while the second cell is used
+  to specify any of the following flags:
+    - bits[3:0] trigger type and level flags
+        1 = low-to-high edge triggered
+        2 = high-to-low edge triggered
+        4 = active high level-sensitive
+        8 = active low level-sensitive
+
+  Example:
+
+	gpio: gpio {
+		compatible = "nvidia,tegra20-gpio";
+		reg = <0x6000d000 0x1000>;
+		interrupts = <0 32 0x04
+			      0 33 0x04
+			      0 34 0x04
+			      0 35 0x04
+			      0 55 0x04
+			      0 87 0x04
+			      0 89 0x04>;
+		#gpio-cells = <2>;
+		gpio-controller;
+		#interrupt-cells = <2>;
+		interrupt-controller;
+	};
+
+	i2c@7000c000 {
+		status = "okay";
+		clock-frequency = <400000>;
+
+		wm8903: wm8903@1a {
+			compatible = "wlf,wm8903";
+			reg = <0x1a>;
+			interrupt-parent = <&gpio>;
+			interrupts = <187 0x04>;
+
+			gpio-controller;
+			#gpio-cells = <2>;
+
+			micdet-cfg = <0>;
+			micdet-delay = <100>;
+			gpio-cfg = <0xffffffff 0xffffffff 0 0xffffffff 0xffffffff>;
+		};
+	};
-- 
1.7.12


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] gpio: adnp: dt: Reference generic interrupt binding
  2012-09-19  8:57 [PATCH 1/2] dt: Document general interrupt controller bindings Thierry Reding
@ 2012-09-19  8:57 ` Thierry Reding
  2012-09-19 15:45   ` Rob Herring
  2012-09-20  6:55   ` Linus Walleij
  2012-09-19 15:25 ` [PATCH 1/2] dt: Document general interrupt controller bindings Stephen Warren
  2012-09-19 15:45 ` Rob Herring
  2 siblings, 2 replies; 6+ messages in thread
From: Thierry Reding @ 2012-09-19  8:57 UTC (permalink / raw)
  To: Rob Herring; +Cc: Linus Walleij, Grant Likely, devicetree-discuss, linux-kernel

Instead of having to duplicate the description of the properties needed
for interrupt support, reference the new standard document.

Cc: Linus Walleij <linus.walleij@stericsson.com>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Rob Herring <rob.herring@calxeda.com>
Cc: devicetree-discuss@lists.ozlabs.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
---
This patch should go through LinusW's tree because it already carries
the patch that created this documentation.

 Documentation/devicetree/bindings/gpio/gpio-adnp.txt | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Documentation/devicetree/bindings/gpio/gpio-adnp.txt b/Documentation/devicetree/bindings/gpio/gpio-adnp.txt
index 5a09a21..625eee7 100644
--- a/Documentation/devicetree/bindings/gpio/gpio-adnp.txt
+++ b/Documentation/devicetree/bindings/gpio/gpio-adnp.txt
@@ -11,6 +11,10 @@ Required properties:
 - gpio-controller: Marks the device as a GPIO controller
 - nr-gpios: The number of pins supported by the controller.
 
+The GPIO exander can optionally be used as an interrupt controller, in
+which case it uses the default two cell specifier as described in
+Documentation/devicetree/bindings/interrupt-controller/interrupts.txt.
+
 Example:
 
 	gpioext: gpio-controller@41 {
-- 
1.7.12


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] dt: Document general interrupt controller bindings
  2012-09-19  8:57 [PATCH 1/2] dt: Document general interrupt controller bindings Thierry Reding
  2012-09-19  8:57 ` [PATCH 2/2] gpio: adnp: dt: Reference generic interrupt binding Thierry Reding
@ 2012-09-19 15:25 ` Stephen Warren
  2012-09-19 15:45 ` Rob Herring
  2 siblings, 0 replies; 6+ messages in thread
From: Stephen Warren @ 2012-09-19 15:25 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Rob Herring, devicetree-discuss, Linus Walleij, linux-kernel

On 09/19/2012 02:57 AM, Thierry Reding wrote:
> In order to use a device as interrupt controller, it needs to be marked
> with the DT interrupt-controller property. This commit adds rudimentary
> documentation about the required standard properties and describes the
> most commonly used interrupt specifiers.

> +++ b/Documentation/devicetree/bindings/interrupt-controller/interrupts.txt
> @@ -0,0 +1,94 @@
> +Specifying interrupt information for devices
> +============================================
> +
> +1) Interrupt user nodes
> +-----------------------

s/user/client/? Bike-shedding a little I suppose.

> +
> +A device that generates interrupts can specify the interrupt controller to
> +which the interrupts are routed by passing the controller's phandle in the
> +"interrupt-parent" property.
> +
> +The "interrupts" property is a list of specifiers that describe each of the
> +interrupts. See section 2 below for details.

This should probably mention that interrupt-parent cascades from parent
nodes. How about the following instead:

Nodes that describe devices which generate interrupts must contain an
"interrupts" property. This property must contain a list of interrupt
specifiers, one per output interrupt. The format of the interrupt
specifier is determined by the interrupt controller to which the
interrupts are routed; see section 2 below for details.

The interrupt-parent property is used to define the controller to which
interrupts are routed; it contains a single phandle referring to the
interrupt controller node. This property may be specified in any
interrupt client node, or in any parent node of the device.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] dt: Document general interrupt controller bindings
  2012-09-19  8:57 [PATCH 1/2] dt: Document general interrupt controller bindings Thierry Reding
  2012-09-19  8:57 ` [PATCH 2/2] gpio: adnp: dt: Reference generic interrupt binding Thierry Reding
  2012-09-19 15:25 ` [PATCH 1/2] dt: Document general interrupt controller bindings Stephen Warren
@ 2012-09-19 15:45 ` Rob Herring
  2 siblings, 0 replies; 6+ messages in thread
From: Rob Herring @ 2012-09-19 15:45 UTC (permalink / raw)
  To: Thierry Reding; +Cc: devicetree-discuss, Linus Walleij, linux-kernel

On 09/19/2012 03:57 AM, Thierry Reding wrote:
> In order to use a device as interrupt controller, it needs to be marked
> with the DT interrupt-controller property. This commit adds rudimentary
> documentation about the required standard properties and describes the
> most commonly used interrupt specifiers.
> 
> Cc: Linus Walleij <linus.walleij@stericsson.com>
> Cc: Grant Likely <grant.likely@secretlab.ca>
> Cc: Rob Herring <rob.herring@calxeda.com>
> Cc: devicetree-discuss@lists.ozlabs.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
> ---
> This patch is for Rob's tree as it documents the general bindings.
> 
>  .../bindings/interrupt-controller/interrupts.txt   | 94 ++++++++++++++++++++++
>  1 file changed, 94 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/interrupt-controller/interrupts.txt
> 
> diff --git a/Documentation/devicetree/bindings/interrupt-controller/interrupts.txt b/Documentation/devicetree/bindings/interrupt-controller/interrupts.txt
> new file mode 100644
> index 0000000..6cafe3a
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/interrupt-controller/interrupts.txt
> @@ -0,0 +1,94 @@
> +Specifying interrupt information for devices
> +============================================
> +
> +1) Interrupt user nodes
> +-----------------------
> +
> +A device that generates interrupts can specify the interrupt controller to
> +which the interrupts are routed by passing the controller's phandle in the
> +"interrupt-parent" property.
> +
> +The "interrupts" property is a list of specifiers that describe each of the
> +interrupts. See section 2 below for details.
> +
> +2) Interrupt controller nodes
> +-----------------------------
> +
> +A device is marked as an interrupt controller with the "interrupt-controller"
> +property. This is a empty, boolean property. An additional "#interrupt-cells"
> +property defines the number of cells needed to specify a single interrupt.
> +
> +It is the responsibility of the interrupt controller's binding to define the
> +length and format of the interrupt specifier. The following two variants are
> +commonly used:
> +
> +  a) one cell
> +  -----------
> +  The #interrupt-cells property is set to 1 and the single cell defines the
> +  index of the interrupt within the controller.
> +
> +  Example:
> +
> +	vic: intc@10140000 {
> +		compatible = "arm,versatile-vic";
> +		interrupt-controller;
> +		#interrupt-cells = <1>;
> +		reg = <0x10140000 0x1000>;
> +	};
> +
> +	sic: intc@10003000 {
> +		compatible = "arm,versatile-sic";
> +		interrupt-controller;
> +		#interrupt-cells = <1>;
> +		reg = <0x10003000 0x1000>;
> +		interrupt-parent = <&vic>;
> +		interrupts = <31>; /* Cascaded to vic */
> +	};
> +
> +  b) two cells
> +  ------------
> +  The #interrupt-cells property is set to 2 and the first cell defines the
> +  index of the interrupt within the controller, while the second cell is used
> +  to specify any of the following flags:
> +    - bits[3:0] trigger type and level flags
> +        1 = low-to-high edge triggered
> +        2 = high-to-low edge triggered
> +        4 = active high level-sensitive
> +        8 = active low level-sensitive
> +
> +  Example:
> +
> +	gpio: gpio {
> +		compatible = "nvidia,tegra20-gpio";
> +		reg = <0x6000d000 0x1000>;
> +		interrupts = <0 32 0x04
> +			      0 33 0x04
> +			      0 34 0x04
> +			      0 35 0x04
> +			      0 55 0x04
> +			      0 87 0x04
> +			      0 89 0x04>;

Might be better to have an example where the parent here also follows
the documentation. There's no reason this needs to match a real binding,
so you could just drop the 1st cell.

Otherwise, I'll wait for Stephen to comment before I pick it up.

Rob

> +		#gpio-cells = <2>;
> +		gpio-controller;
> +		#interrupt-cells = <2>;
> +		interrupt-controller;
> +	};
> +
> +	i2c@7000c000 {
> +		status = "okay";
> +		clock-frequency = <400000>;
> +
> +		wm8903: wm8903@1a {
> +			compatible = "wlf,wm8903";
> +			reg = <0x1a>;
> +			interrupt-parent = <&gpio>;
> +			interrupts = <187 0x04>;
> +
> +			gpio-controller;
> +			#gpio-cells = <2>;
> +
> +			micdet-cfg = <0>;
> +			micdet-delay = <100>;
> +			gpio-cfg = <0xffffffff 0xffffffff 0 0xffffffff 0xffffffff>;
> +		};
> +	};
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] gpio: adnp: dt: Reference generic interrupt binding
  2012-09-19  8:57 ` [PATCH 2/2] gpio: adnp: dt: Reference generic interrupt binding Thierry Reding
@ 2012-09-19 15:45   ` Rob Herring
  2012-09-20  6:55   ` Linus Walleij
  1 sibling, 0 replies; 6+ messages in thread
From: Rob Herring @ 2012-09-19 15:45 UTC (permalink / raw)
  To: Thierry Reding; +Cc: devicetree-discuss, Linus Walleij, linux-kernel

On 09/19/2012 03:57 AM, Thierry Reding wrote:
> Instead of having to duplicate the description of the properties needed
> for interrupt support, reference the new standard document.
> 
> Cc: Linus Walleij <linus.walleij@stericsson.com>
> Cc: Grant Likely <grant.likely@secretlab.ca>
> Cc: Rob Herring <rob.herring@calxeda.com>
> Cc: devicetree-discuss@lists.ozlabs.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
> ---
> This patch should go through LinusW's tree because it already carries
> the patch that created this documentation.
> 
>  Documentation/devicetree/bindings/gpio/gpio-adnp.txt | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/gpio/gpio-adnp.txt b/Documentation/devicetree/bindings/gpio/gpio-adnp.txt
> index 5a09a21..625eee7 100644
> --- a/Documentation/devicetree/bindings/gpio/gpio-adnp.txt
> +++ b/Documentation/devicetree/bindings/gpio/gpio-adnp.txt
> @@ -11,6 +11,10 @@ Required properties:
>  - gpio-controller: Marks the device as a GPIO controller
>  - nr-gpios: The number of pins supported by the controller.
>  
> +The GPIO exander can optionally be used as an interrupt controller, in

s/exander/expander/

Otherwise,

Acked-by: Rob Herring <rob.herring@calxeda.com>

> +which case it uses the default two cell specifier as described in
> +Documentation/devicetree/bindings/interrupt-controller/interrupts.txt.
> +
>  Example:
>  
>  	gpioext: gpio-controller@41 {
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] gpio: adnp: dt: Reference generic interrupt binding
  2012-09-19  8:57 ` [PATCH 2/2] gpio: adnp: dt: Reference generic interrupt binding Thierry Reding
  2012-09-19 15:45   ` Rob Herring
@ 2012-09-20  6:55   ` Linus Walleij
  1 sibling, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2012-09-20  6:55 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Rob Herring, devicetree-discuss, Linus Walleij, linux-kernel

On Wed, Sep 19, 2012 at 10:57 AM, Thierry Reding
<thierry.reding@avionic-design.de> wrote:

> Instead of having to duplicate the description of the properties needed
> for interrupt support, reference the new standard document.
>
> Cc: Linus Walleij <linus.walleij@stericsson.com>
> Cc: Grant Likely <grant.likely@secretlab.ca>
> Cc: Rob Herring <rob.herring@calxeda.com>
> Cc: devicetree-discuss@lists.ozlabs.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
> ---
> This patch should go through LinusW's tree because it already carries
> the patch that created this documentation.

Applied with Rob's ACK and the minor spelling correction.

Thanks!
Linus Walleij

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-09-20  6:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-19  8:57 [PATCH 1/2] dt: Document general interrupt controller bindings Thierry Reding
2012-09-19  8:57 ` [PATCH 2/2] gpio: adnp: dt: Reference generic interrupt binding Thierry Reding
2012-09-19 15:45   ` Rob Herring
2012-09-20  6:55   ` Linus Walleij
2012-09-19 15:25 ` [PATCH 1/2] dt: Document general interrupt controller bindings Stephen Warren
2012-09-19 15:45 ` Rob Herring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).