How to Use an External IRQ in a Linux Driver?

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

How to Use an External IRQ in a Linux Driver?

1,559 Views
Steve_W
Contributor I

I am working with the LS1046A and I need to use external IRQ6 in a driver to measure a pulse train with minimal latency. For this reason I don't want to use the pin configured as a GPIO. Is there an example of how to configure an external IRQ in the device tree and a code example showing what is required to handle the IRQ in my driver?

Thanks, Steve.

Labels (1)
0 Kudos
Reply
1 Reply

1,539 Views
yipingwang
NXP TechSupport
NXP TechSupport

The usage of external IRQ is same as other IP's irq, normally you need:
1) enable IRQ pin function in RCW, bit 373-381
I checked the default rcw, IRQ already supported by default.

2) Add interrupt related description in dts node
interrupts = <GIC_SPI 145 IRQ_TYPE_LEVEL_HIGH>;

Please be aware that the irq in dts is calculated as : irq = hwirq - 32.
According to chapter <interrupt assignment > of LS1046A, the hwirq num of IRQ6 is 177, so in dts file it should be 177 - 32 = 145.

There is no device connected with IRQ6, The following steps.
3) map hwirq to Linux irq
4) request irq in device driver.