How to configure external interrupt IRQ2 in P2040

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to configure external interrupt IRQ2 in P2040

997 Views
gouravjain
Contributor IV

Hello,

In my design, based on P2041RDB, an external interrupt is hitting to pin IRQ2 from FPGA .

Can any one pls  guide me how to configure interrupts in kernel??

Thanks in advance..

regards,

Gourav

0 Kudos
1 Reply

670 Views
Pavel
NXP Employee
NXP Employee

Linux makes no difference between external and internal interrupts. All interrupts in the system are handled by the same Linux API. If this API didn't work, no driver in the system would be able to operate, not just your customer's module.

The resource number is an index to irq_desc table.

This index is generally _not_equal to the hardware IRQ line number. See Documentation/IRQ.txt for explanation.

To request an IRQ line in a proper way, the customer should:

 

  1. Declare the IRQ properly in the DTS. Refer to /Documentation/powerpc/booting-without-of.txt for details. The value of the "interrupt"

property is calculated by the following

   formula:

  

   [DTS_interrupt_number] = ([EIVPR/IIVPR_addr] - [Interrupt_Source_Configuration_Registers_Base]) / 0x20

 

                where [EIVPR/IIVPR_addr] is the address of the interrupt configuration registers

                of the IRQ being declared, [Interrupt_Source_Configuration_Registers_Base]

                is 0x50000 for the P2040

  

  1. Request the interrupt property from the Open Firmware in the driver.

 

  1. Map the interrupt to the resource ID. This can be done by of_irq_to_resource() or by irq_of_parse_and_map().

  

  1. Request the interrupt by the resource number.

 

All steps above are performed by _any_ device driver in the system. Just look how it is done in e.g. drivers/net/gianfar.c or  drivers/spi/fsl_espi.c

and do the same in your code.

 

The P2040 IRQ2 is shared with virtual PCIe INTC. It is needed to remove the corresponding PCIe node declaration from the .dts file and must not use that PCIe port. Otherwise, there will be a resource conflict.


Have a great day,
Pavel Chubakov

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos