GPIO IRQ dts bindings for MPC85xx and QorIQ

Felix Radensky felix at embedded-sol.com
Tue Aug 9 18:14:39 EST 2011


Hi,

DTS bindings document for mpc8xxx GPIOs implies that to use GPIO as IRQ
one should specify GPIO controller node and GPIO number in device tree 
node,
like this:

     funkyfpga at 0 {
         compatible = "funky-fpga";
         ...
         interrupts = <9 2>;
         interrupt-parent = <&gpio2>;
     };

I suppose the intention here is to do the following in driver code:

int irq;
struct device node *np;

np = of_find_compatible_node((NULL, NULL, "funky-fpga");
irq = irq_of_parse_and_map(np, 0);
request_irq(irq, ...);

However this doesn't work as expected.  The resulting virq
is connected to real interrupt controller, mpic, and not to
GPIO controller. As a result, interrupt handler is never invoked.

This is what /proc/interrupts shows:

  20:          0    OpenPIC         Edge         funky-fpga


On the other hand, when using

#define FPGA_IRQ_GPIO    169

request_gpio(FPGA_IRQ_GPIO);
gpio_direction_input(FPGA_IRQ_GPIO);
irq = gpio_to_irq(FPGA_IRQ_GPIO);
request_irq(irq, ...);

the connection to GPIO controller is created properly,
/proc/interrupts shows

20:          0    mpc8xxx_gpio         Edge         funky-fpga

The drawback of this approach is that GPIO IRQ cannot
be naturally specified in device tree by GPIO controller number
and GPIO pin number.

So what is the correct way to refer to 85XX GPIO IRQs in driver
code ?

Thanks.

Felix.







More information about the Linuxppc-dev mailing list