diff mbox

[1/5] dts: gpio_atmel: adapt binding doc to reality

Message ID 20170526180609.2699-1-uwe@kleine-koenig.org
State Superseded, archived
Headers show

Commit Message

Uwe Kleine-König May 26, 2017, 6:06 p.m. UTC
The second cell in a gpio reference is used to pass GPIO_ACTIVE_LOW or
GPIO_ACTIVE_HIGH. The gpio device can also be used as irq controller and
a reference can contain the IRQ_TYPE_* values in the second cell.

Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
---
 Documentation/devicetree/bindings/gpio/gpio_atmel.txt | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

Comments

Andrew Lunn May 26, 2017, 6:52 p.m. UTC | #1
> +- interrupt-controller: Marks the device node as a GPIO controller.

Interrupt controller, not GPIO controller.

> +- #interrupt-cells: Should be two. The first cell is the pin number and the
> +  second cell is used to specify irq type flags:
> +      1 = low-to-high edge triggered.
> +      2 = high-to-low edge triggered.
> +      4 = active high level-sensitive.
> +      8 = active low level-sensitive.

Maybe just reference interrupts.txt?

      Andrew
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Marek Vasut May 26, 2017, 7:17 p.m. UTC | #2
On 05/26/2017 08:06 PM, Uwe Kleine-König wrote:
> According to the binding documentation and the source code the atmel-gpio
> controller takes IRQ_TYPE_* as its flags values, not GPIO_ACTIVE_*.
> 
> This patch uses the right variable type which yields the same result
> when compiled. Note that this might be wrong and actually
> IRQ_TYPE_LEVEL_LOW is intended by the dt author.
> 
> Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
> ---
> Hello,
> 
> can somebody with the hardware or it's documentation please check which
> flag is the right one?

It's correct, I tested the CAN, so:

Acked-by: Marek Vasut <marex@denx.de>

> Best regards
> Uwe
> 
>  arch/arm/boot/dts/at91-sama5d4_ma5d4.dtsi | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/at91-sama5d4_ma5d4.dtsi b/arch/arm/boot/dts/at91-sama5d4_ma5d4.dtsi
> index b5a5a91bc2ef..b813fdfa2842 100644
> --- a/arch/arm/boot/dts/at91-sama5d4_ma5d4.dtsi
> +++ b/arch/arm/boot/dts/at91-sama5d4_ma5d4.dtsi
> @@ -75,7 +75,7 @@
>  					reg = <0>;
>  					clocks = <&clk20m>;
>  					interrupt-parent = <&pioE>;
> -					interrupts = <6 GPIO_ACTIVE_LOW>;
> +					interrupts = <6 IRQ_TYPE_EDGE_RISING>;
>  					spi-max-frequency = <10000000>;
>  				};
>  
> @@ -84,7 +84,7 @@
>  					reg = <1>;
>  					clocks = <&clk20m>;
>  					interrupt-parent = <&pioE>;
> -					interrupts = <7 GPIO_ACTIVE_LOW>;
> +					interrupts = <7 IRQ_TYPE_EDGE_RISING>;
>  					spi-max-frequency = <10000000>;
>  				};
>  			};
>
Alexandre Belloni May 31, 2017, 9:52 a.m. UTC | #3
On 26/05/2017 at 21:17:37 +0200, Marek Vasut wrote:
> On 05/26/2017 08:06 PM, Uwe Kleine-König wrote:
> > According to the binding documentation and the source code the atmel-gpio
> > controller takes IRQ_TYPE_* as its flags values, not GPIO_ACTIVE_*.
> > 
> > This patch uses the right variable type which yields the same result
> > when compiled. Note that this might be wrong and actually
> > IRQ_TYPE_LEVEL_LOW is intended by the dt author.
> > 
> > Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
> > ---
> > Hello,
> > 
> > can somebody with the hardware or it's documentation please check which
> > flag is the right one?
> 
> It's correct, I tested the CAN, so:
> 
> Acked-by: Marek Vasut <marex@denx.de>
> 
> > Best regards
> > Uwe
> > 
> >  arch/arm/boot/dts/at91-sama5d4_ma5d4.dtsi | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
Applied, thanks.
Tony Lindgren May 31, 2017, 5:19 p.m. UTC | #4
* Uwe Kleine-König <uwe@kleine-koenig.org> [170526 11:09]:
> According to the binding documentation and the source code the omap-gpio
> controller takes IRQ_TYPE_* as its flags values, not GPIO_ACTIVE_*.
> 
> This patch uses the right variable type which yields the same result
> when compiled. Note that this might be wrong and actually
> IRQ_TYPE_LEVEL_LOW is intended by the dt author.
> 
> Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
> ---
> Hello,
> 
> can somebody with the hardware or it's documentation please check which
> flag is the right one?

I'll wait on this one until we have somebody test it.

Regards,

Tony
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Yegor Yefremov May 31, 2017, 5:22 p.m. UTC | #5
Hi Uwe, Tony,

On Wed, May 31, 2017 at 7:19 PM, Tony Lindgren <tony@atomide.com> wrote:
> * Uwe Kleine-König <uwe@kleine-koenig.org> [170526 11:09]:
>> According to the binding documentation and the source code the omap-gpio
>> controller takes IRQ_TYPE_* as its flags values, not GPIO_ACTIVE_*.
>>
>> This patch uses the right variable type which yields the same result
>> when compiled. Note that this might be wrong and actually
>> IRQ_TYPE_LEVEL_LOW is intended by the dt author.
>>
>> Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
>> ---
>> Hello,
>>
>> can somebody with the hardware or it's documentation please check which
>> flag is the right one?
>
> I'll wait on this one until we have somebody test it.

I'll look at it this week.

Yegor
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Shawn Guo June 4, 2017, 3:49 a.m. UTC | #6
On Fri, May 26, 2017 at 08:06:09PM +0200, Uwe Kleine-König wrote:
> According to the binding documentation and the source code the
> vf610-gpio controller takes IRQ_TYPE_* as its flags values, not
> GPIO_ACTIVE_*.
> 
> This patch uses the right variable type which yields the same result
> when compiled. Note that this might be wrong and actually
> IRQ_TYPE_LEVEL_LOW is intended by the dt author.
> 
> Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
> ---
> Hello,
> 
> can somebody with the hardware or it's documentation please check which
> flag is the right one?

@Stefan, can you help to confirm?

Shawn

> 
> Best regards
> Uwe
> 
>  arch/arm/boot/dts/vf-colibri-eval-v3.dtsi | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/boot/dts/vf-colibri-eval-v3.dtsi b/arch/arm/boot/dts/vf-colibri-eval-v3.dtsi
> index 091b738041a0..3e0c84d79c43 100644
> --- a/arch/arm/boot/dts/vf-colibri-eval-v3.dtsi
> +++ b/arch/arm/boot/dts/vf-colibri-eval-v3.dtsi
> @@ -117,7 +117,7 @@
>  		clocks = <&clk16m>;
>  		spi-max-frequency = <10000000>;
>  		interrupt-parent = <&gpio1>;
> -		interrupts = <11 GPIO_ACTIVE_LOW>;
> +		interrupts = <11 IRQ_TYPE_EDGE_RISING>;
>  	};
>  };
>  
> -- 
> 2.11.0
> 
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Stefan Agner June 5, 2017, 2:17 a.m. UTC | #7
On 2017-06-03 20:49, Shawn Guo wrote:
> On Fri, May 26, 2017 at 08:06:09PM +0200, Uwe Kleine-König wrote:
>> According to the binding documentation and the source code the
>> vf610-gpio controller takes IRQ_TYPE_* as its flags values, not
>> GPIO_ACTIVE_*.
>>
>> This patch uses the right variable type which yields the same result
>> when compiled. Note that this might be wrong and actually
>> IRQ_TYPE_LEVEL_LOW is intended by the dt author.
>>
>> Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
>> ---
>> Hello,
>>
>> can somebody with the hardware or it's documentation please check which
>> flag is the right one?
> 
> @Stefan, can you help to confirm?
> 

Thanks for spotting! According to the data sheet it is a low active
signal, so I guess IRQ_TYPE_LEVEL_LOW is correct. But the driver
actually explicitly requests IRQF_TRIGGER_FALLING, that has been the
case since its inception. IMHO LEVEL_LOW should be more rigid since it
helps for missed interrupt edges...

--
Stefan

>>
>> Best regards
>> Uwe
>>
>>  arch/arm/boot/dts/vf-colibri-eval-v3.dtsi | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/arm/boot/dts/vf-colibri-eval-v3.dtsi b/arch/arm/boot/dts/vf-colibri-eval-v3.dtsi
>> index 091b738041a0..3e0c84d79c43 100644
>> --- a/arch/arm/boot/dts/vf-colibri-eval-v3.dtsi
>> +++ b/arch/arm/boot/dts/vf-colibri-eval-v3.dtsi
>> @@ -117,7 +117,7 @@
>>  		clocks = <&clk16m>;
>>  		spi-max-frequency = <10000000>;
>>  		interrupt-parent = <&gpio1>;
>> -		interrupts = <11 GPIO_ACTIVE_LOW>;
>> +		interrupts = <11 IRQ_TYPE_EDGE_RISING>;
>>  	};
>>  };
>>
>> --
>> 2.11.0
>>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Tony Lindgren June 12, 2017, 7:32 a.m. UTC | #8
* Yegor Yefremov <yegorslists@googlemail.com> [170606 07:37]:
> On Wed, May 31, 2017 at 7:22 PM, Yegor Yefremov
> <yegorslists@googlemail.com> wrote:
> > Hi Uwe, Tony,
> >
> > On Wed, May 31, 2017 at 7:19 PM, Tony Lindgren <tony@atomide.com> wrote:
> >> * Uwe Kleine-König <uwe@kleine-koenig.org> [170526 11:09]:
> >>> According to the binding documentation and the source code the omap-gpio
> >>> controller takes IRQ_TYPE_* as its flags values, not GPIO_ACTIVE_*.
> >>>
> >>> This patch uses the right variable type which yields the same result
> >>> when compiled. Note that this might be wrong and actually
> >>> IRQ_TYPE_LEVEL_LOW is intended by the dt author.
> >>>
> >>> Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
> >>> ---
> >>> Hello,
> >>>
> >>> can somebody with the hardware or it's documentation please check which
> >>> flag is the right one?
> >>
> >> I'll wait on this one until we have somebody test it.
> >
> > I'll look at it this week.
> 
> This is what works for me (at least it doesn't produce "irq 88: nobody
> cared (try booting with the "irqpoll" option)").
> 
> As for tca6416 it is working with all possible settings (from
> IRQ_TYPE_EDGE_RISING till IRQ_TYPE_LEVEL_LOW). "cat /proc/interrupts"
> always shows Level type:
> 
> 47:          5  44e07000.gpio  20 Level     1-0020

OK, can you please send a proper patch with description
and Signed-off-by? That is unless Uwe cares to update his
patch. Otherwise add Reported-by for Uwe :)

Regards,

Tony
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/Documentation/devicetree/bindings/gpio/gpio_atmel.txt b/Documentation/devicetree/bindings/gpio/gpio_atmel.txt
index 85f8c0d084fa..b53fe3bce270 100644
--- a/Documentation/devicetree/bindings/gpio/gpio_atmel.txt
+++ b/Documentation/devicetree/bindings/gpio/gpio_atmel.txt
@@ -5,9 +5,16 @@  Required properties:
 - reg: Should contain GPIO controller registers location and length
 - interrupts: Should be the port interrupt shared by all the pins.
 - #gpio-cells: Should be two.  The first cell is the pin number and
-  the second cell is used to specify optional parameters (currently
-  unused).
+  the second cell is used to specify optional parameters to declare if the GPIO
+  is active high or low. See gpio.txt.
 - gpio-controller: Marks the device node as a GPIO controller.
+- interrupt-controller: Marks the device node as a GPIO controller.
+- #interrupt-cells: Should be two. The first cell is the pin number and the
+  second cell is used to specify irq type flags:
+      1 = low-to-high edge triggered.
+      2 = high-to-low edge triggered.
+      4 = active high level-sensitive.
+      8 = active low level-sensitive.
 
 optional properties:
 - #gpio-lines: Number of gpio if absent 32.
@@ -21,5 +28,7 @@  Example:
 		#gpio-cells = <2>;
 		gpio-controller;
 		#gpio-lines = <19>;
+		interrupt-controller;
+		#interrupt-cells = <2>;
 	};