using general IRQs

Ran Shalit ranshalit at gmail.com
Tue Aug 11 13:45:21 AEST 2015


On Tue, Aug 11, 2015 at 5:29 AM, Scott Wood <scottwood at freescale.com> wrote:
> On Mon, 2015-08-10 at 13:40 +0300, Ran Shalit wrote:
>> On Mon, Aug 10, 2015 at 10:48 AM, Ran Shalit <ranshalit at gmail.com> wrote:
>> > Hello,
>> >
>> > MPC8349 has general IRQ numbered 0-7,
>> > It is required to bind these IRQs with some routine , i.e. they are
>> > not used with any specific driver.
>> >
>> > - Should they be configured as gpios in device tree so that we can use
>> > the gpio as irq in linux ? Is there any example ?
>> > - After configuration, can the gpios be used in linux using the
>> > standard /sys/class/gpio ?
>> >
>> > Regards,
>> > Ran
>
> What do you mean by "general IRQ"?  Do you mean external IRQs?
>
>> I am trying to use only IRQ4, so I have tried to configure it as
>> following in device tree:
>>
>> device tree:
>>
>>   intc at 0{
>>  compatible = "intc";
>>  #address-cells = <1>;
>>  #size-cells = <0>;
>>  reg = <0 0x1000>;
>>  interrupts = <4 0x8>;
>>   };
>>
>> But I don't see IRQ4 listed in the interrupt list:
>> # cat /proc/interrupts
>
> /proc/interrupts shows virtual interrupts, which do not necessarily
> correspond to anything in the device tree.  In particular, virtual interrupts
> under 16 are reserved for ISA interrupts, and thus any mpic interrupts in
> that range will be remapped.
>
> Additionally, putting an interrupt in the device tree does not make it show
> up in /proc/interrupts.  Only interrupts for which a driver has registered a
> handler will show up in /proc/interrupts.
>
> -Scott
>
>
Hi Scott,

I meant  external IRQ.
I am actually trying to use irq 4 interrupt.

I've added the above in device tree, and in kernel code I do:
np = of_find_node_by_name(NULL,"hello");
  if (np == NULL)
    {
    printk("Error node not found\n");
    }
  printk("Node np = 0x%0x\n",np);                     <-- Node np = 0xdfffe2f0
  virq = irq_of_parse_and_map(np,0);

  printk(" VIRQ: %d \n" , virq);                              <-- virq = 0 !!??
  if (0 > (error=request_irq(virq, &hello_IRQHandler, IRQF_SHARED,
"hello", &value))) {
      printk(KERN_WARNING"hello_IRQHandler: Init: Unable to allocate
IRQ error = %d\n\n", error);
    return -1;
  <-- request_irq return -22 ....
  }


 But it fails in request_irq (it return -22).
Also, irq_of_parse_and_map(np,0) returns 0. I think it should have returned 4.

Regards,
Ran


More information about the Linuxppc-dev mailing list