[RFC 1/2] powerpc/5200: add general purpose timer API for the MPC5200

Grant Likely grant.likely at secretlab.ca
Sat Mar 7 08:39:45 EST 2009


On Fri, Mar 6, 2009 at 2:29 PM, Jon Smirl <jonsmirl at gmail.com> wrote:
> I'm using a GPT pin in input capture mode to implement IR. I attached
> my GPT driver code. I can convert to your API. That's a really cheap
> way to do IR, just IR sensor, resistor and a cap.

The driver I posted can't do input capture mode yet, but it shouldn't
be too difficult to add.  Just another api function for setting the
mode I think.  I don't have a use for that yet, so I haven't thought
much about it.  Feel free to suggest what you think the API should
look like.

> This is my old device tree, what should the new one look like?
>
>                ir0 at 670 { /* General Purpose Timer 6 in Input mode */
>                        compatible = "gpt-ir";
>                        cell-index = <7>;
>                        reg = <0x670 0x10>;
>                        interrupts = <0x1 0x10 0x0>;
>                        interrupt-parent = <&mpc5200_pic>;
>                };

You'd want a node for the IR device which uses the GPT node as its
interrupt controller.

so:
    gpt7: gpt at 670 {
        compatible = "fsl,mpc5200b-gpt"
        reg = <0x670 0x10>;
        interrupt = <1 16 0>;
        interrupt-controller;
        #interrupt-cells = <1>;
    };

Then elsewhere:
    ir {
        compatible = "digispeaker,ir";  // or whatever best matches your board
        interrupt-parent = <&gpt>;
        interrupts = <0>;  // IIRC, '0' means irq on both edges for
the GPT irq controller
    };

g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.



More information about the Linuxppc-dev mailing list