AnsweredAssumed Answered

Using DTS file to setup IRQ

Question asked by yensid on Jun 10, 2014
Latest reply on Jan 19, 2016 by li jie

Hi,

 

We have our own board designed after the P1010RDB and I am trying to setup IRQ2 through the DTS file.  I only have a little experiance with the device tree and would like to setup the IRQ the recommended way. This is the first project I have worked on with a newer kernel using a device tree.

 

Currently I have the IRQ setup this way (I understand this is not recommeneded & I remove this before tyring the DTS code below):

  virq = irq_create_mapping(NULL, 0x02);

  printk(KERN_INFO"hello_IRQHandler: ISR Setup VIRQ: %d \n", virq); 

 

  if (0 > (error=request_irq(virq, (int)&hello_IRQHandler, IRQF_SHARED, gDrvrName, "hello"))) {

    printk(KERN_WARNING"hello_IRQHandler: Init: Unable to allocate IRQ error = %dd\n\n", error);

    return -1;

}

 

This is my unsuccessful attempt at using the DTS file to setup the IRQ

     DTS file code snippet (This is added under board_soc)

hello {
compatible = "fsl,hello";
interrupts = <2 3>;
interrupt-parent = <&mpic>;
};

Code to setup the IRQ:

struct device_node * np = NULL;

.....

np = of_find_compatible_node(NULL,NULL,"hello");

  if (np == NULL)

    {

    printk("Error node not found\n");

    }

 

 

  virq = irq_of_parse_and_map(np,0);

   

  printk(KERN_INFO"hello_IRQHandler: ISR Setup VIRQ: %d \n" , virq); 

 

  if (0 > (error=request_irq(virq, (int)&hello_IRQHandler, IRQF_SHARED, gDrvrName, "hello"))) {

      printk(KERN_WARNING"hello_IRQHandler: Init: Unable to allocate IRQ error = %dd\n\n", error);

    return -1;

  }

 

When the code to use node from the dts file runs, request_irq returns -22.  If you have any ideas on this or info on how to debug it would be greatly appreciated.

 

Thanks

Outcomes