linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* tca-6416: interrupt device tree configuration
@ 2014-03-18 15:02 Yegor Yefremov
  2014-04-02 10:06 ` Yegor Yefremov
  0 siblings, 1 reply; 4+ messages in thread
From: Yegor Yefremov @ 2014-03-18 15:02 UTC (permalink / raw)
  To: linux-gpio

I've an am335x-based board with tca6416. The interrupt output of the
tca is connected to GPIO0_20 on my SoC. How should I configure this
wiring in device tree file?

I've already managed to hook it on I2C and it is working so far:

 tca6416: gpio@20 {
                compatible = "ti,tca6416";
                reg = <0x20>;
                gpio-controller;
                #gpio-cells = <2>;
  };

Documentation/devicetree/bindings/gpio/gpio-pcf857x.txt describes
following properties:

  - interrupt-controller: Identifies the node as an interrupt controller.
  - #interrupt-cells: Number of cells to encode an interrupt source, shall be 2.
  - interrupt-parent: phandle of the parent interrupt controller.
  - interrupts: Interrupt specifier for the controllers interrupt.

and following example:

        pcf8575: gpio@20 {
                compatible = "nxp,pcf8575";
                reg = <0x20>;
                interrupt-parent = <&irqpin2>;
                interrupts = <3 0>;
                gpio-controller;
                #gpio-cells = <2>;
                interrupt-controller;
                #interrupt-cells = <2>;
        };

Where does irqpin2 come from? How to specify GPIO0_20 in "interrupts" context?

Regards,
Yegor

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

* Re: tca-6416: interrupt device tree configuration
  2014-03-18 15:02 tca-6416: interrupt device tree configuration Yegor Yefremov
@ 2014-04-02 10:06 ` Yegor Yefremov
  2014-04-02 16:01   ` Maxime Ripard
  0 siblings, 1 reply; 4+ messages in thread
From: Yegor Yefremov @ 2014-04-02 10:06 UTC (permalink / raw)
  To: linux-gpio; +Cc: Maxime Ripard

On Tue, Mar 18, 2014 at 4:02 PM, Yegor Yefremov
<yegorslists@googlemail.com> wrote:
> I've an am335x-based board with tca6416. The interrupt output of the
> tca is connected to GPIO0_20 on my SoC. How should I configure this
> wiring in device tree file?
>
> I've already managed to hook it on I2C and it is working so far:
>
>  tca6416: gpio@20 {
>                 compatible = "ti,tca6416";
>                 reg = <0x20>;
>                 gpio-controller;
>                 #gpio-cells = <2>;
>   };
>
> Documentation/devicetree/bindings/gpio/gpio-pcf857x.txt describes
> following properties:
>
>   - interrupt-controller: Identifies the node as an interrupt controller.
>   - #interrupt-cells: Number of cells to encode an interrupt source, shall be 2.
>   - interrupt-parent: phandle of the parent interrupt controller.
>   - interrupts: Interrupt specifier for the controllers interrupt.
>
> and following example:
>
>         pcf8575: gpio@20 {
>                 compatible = "nxp,pcf8575";
>                 reg = <0x20>;
>                 interrupt-parent = <&irqpin2>;
>                 interrupts = <3 0>;
>                 gpio-controller;
>                 #gpio-cells = <2>;
>                 interrupt-controller;
>                 #interrupt-cells = <2>;
>         };
>
> Where does irqpin2 come from? How to specify GPIO0_20 in "interrupts" context?

Maxime, I've seen your irq domain related patch. Could you please
provide an example/hint for my question?

Thanks.

Yegor

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

* Re: tca-6416: interrupt device tree configuration
  2014-04-02 10:06 ` Yegor Yefremov
@ 2014-04-02 16:01   ` Maxime Ripard
  2014-04-07 15:00     ` Yegor Yefremov
  0 siblings, 1 reply; 4+ messages in thread
From: Maxime Ripard @ 2014-04-02 16:01 UTC (permalink / raw)
  To: Yegor Yefremov; +Cc: linux-gpio

[-- Attachment #1: Type: text/plain, Size: 2550 bytes --]

On Wed, Apr 02, 2014 at 12:06:03PM +0200, Yegor Yefremov wrote:
> On Tue, Mar 18, 2014 at 4:02 PM, Yegor Yefremov
> <yegorslists@googlemail.com> wrote:
> > I've an am335x-based board with tca6416. The interrupt output of the
> > tca is connected to GPIO0_20 on my SoC. How should I configure this
> > wiring in device tree file?
> >
> > I've already managed to hook it on I2C and it is working so far:
> >
> >  tca6416: gpio@20 {
> >                 compatible = "ti,tca6416";
> >                 reg = <0x20>;
> >                 gpio-controller;
> >                 #gpio-cells = <2>;
> >   };
> >
> > Documentation/devicetree/bindings/gpio/gpio-pcf857x.txt describes
> > following properties:
> >
> >   - interrupt-controller: Identifies the node as an interrupt controller.
> >   - #interrupt-cells: Number of cells to encode an interrupt source, shall be 2.
> >   - interrupt-parent: phandle of the parent interrupt controller.
> >   - interrupts: Interrupt specifier for the controllers interrupt.
> >
> > and following example:
> >
> >         pcf8575: gpio@20 {
> >                 compatible = "nxp,pcf8575";
> >                 reg = <0x20>;
> >                 interrupt-parent = <&irqpin2>;
> >                 interrupts = <3 0>;
> >                 gpio-controller;
> >                 #gpio-cells = <2>;
> >                 interrupt-controller;
> >                 #interrupt-cells = <2>;
> >         };
> >
> > Where does irqpin2 come from? How to specify GPIO0_20 in "interrupts" context?
> 
> Maxime, I've seen your irq domain related patch. Could you please
> provide an example/hint for my question?

<&irqpin2> is called a phandle, and it's actually a reference to
another device tree node. So the answer to your question is from
somewhere else in the device tree.

It will be the parent interrupt controller, so in your case, I guess
you will have to do two things:
  - Say that your interrupt comes from

interrupt-parent = <&something>;

  - Say the actual interrupt it is using inside that parent

interrupts = <42>;

In your case, I guess something like:
interrupt-parent = <&gpio0>;
interrupts = <20 GPIO_ACTIVE_HIGH>;

Will work, but I'm not familiar enough with the am335x platform to
know for sure.

In any case, you should probably go through this talk:
http://elinux.org/images/a/a3/Elce2013-petazzoni-devicetree-for-dummies.pdf

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: tca-6416: interrupt device tree configuration
  2014-04-02 16:01   ` Maxime Ripard
@ 2014-04-07 15:00     ` Yegor Yefremov
  0 siblings, 0 replies; 4+ messages in thread
From: Yegor Yefremov @ 2014-04-07 15:00 UTC (permalink / raw)
  To: Maxime Ripard; +Cc: linux-gpio

On Wed, Apr 2, 2014 at 6:01 PM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:
> On Wed, Apr 02, 2014 at 12:06:03PM +0200, Yegor Yefremov wrote:
>> On Tue, Mar 18, 2014 at 4:02 PM, Yegor Yefremov
>> <yegorslists@googlemail.com> wrote:
>> > I've an am335x-based board with tca6416. The interrupt output of the
>> > tca is connected to GPIO0_20 on my SoC. How should I configure this
>> > wiring in device tree file?
>> >
>> > I've already managed to hook it on I2C and it is working so far:
>> >
>> >  tca6416: gpio@20 {
>> >                 compatible = "ti,tca6416";
>> >                 reg = <0x20>;
>> >                 gpio-controller;
>> >                 #gpio-cells = <2>;
>> >   };
>> >
>> > Documentation/devicetree/bindings/gpio/gpio-pcf857x.txt describes
>> > following properties:
>> >
>> >   - interrupt-controller: Identifies the node as an interrupt controller.
>> >   - #interrupt-cells: Number of cells to encode an interrupt source, shall be 2.
>> >   - interrupt-parent: phandle of the parent interrupt controller.
>> >   - interrupts: Interrupt specifier for the controllers interrupt.
>> >
>> > and following example:
>> >
>> >         pcf8575: gpio@20 {
>> >                 compatible = "nxp,pcf8575";
>> >                 reg = <0x20>;
>> >                 interrupt-parent = <&irqpin2>;
>> >                 interrupts = <3 0>;
>> >                 gpio-controller;
>> >                 #gpio-cells = <2>;
>> >                 interrupt-controller;
>> >                 #interrupt-cells = <2>;
>> >         };
>> >
>> > Where does irqpin2 come from? How to specify GPIO0_20 in "interrupts" context?
>>
>> Maxime, I've seen your irq domain related patch. Could you please
>> provide an example/hint for my question?
>
> <&irqpin2> is called a phandle, and it's actually a reference to
> another device tree node. So the answer to your question is from
> somewhere else in the device tree.
>
> It will be the parent interrupt controller, so in your case, I guess
> you will have to do two things:
>   - Say that your interrupt comes from
>
> interrupt-parent = <&something>;
>
>   - Say the actual interrupt it is using inside that parent
>
> interrupts = <42>;
>
> In your case, I guess something like:
> interrupt-parent = <&gpio0>;
> interrupts = <20 GPIO_ACTIVE_HIGH>;
>
> Will work, but I'm not familiar enough with the am335x platform to
> know for sure.
>
> In any case, you should probably go through this talk:
> http://elinux.org/images/a/a3/Elce2013-petazzoni-devicetree-for-dummies.pdf

Thanks. My setup is working now. At least I can see interrupt counting
in /proc/interrupts.

Now I'm trying to find out, how to assign base GPIO number right after
the last CPU's GPIO. By default I get 496, though am335x has only 4x32
GPIO blocks.

Yegor

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

end of thread, other threads:[~2014-04-07 15:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-18 15:02 tca-6416: interrupt device tree configuration Yegor Yefremov
2014-04-02 10:06 ` Yegor Yefremov
2014-04-02 16:01   ` Maxime Ripard
2014-04-07 15:00     ` Yegor Yefremov

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).