It looks like IRQ 2
does NOT yet exist on your hardware. i.e. when you call request_irq()
the Linux kernel does NOT yet know which interrrupt on which physical line from which peripheral hardware must be treated as the trigger for IRQ number "2" as it is just a number which is NOT yet associated with any actual physical interrupt yet).
Basically one first needs to associate a particular IRQ number with an actual physical
hardware interrupt before attempting to register an ISR for that IRQ number. thsi is commonly done in the Linux kernel using irq_domain_add_linear()
.
In the past, IRQ numbers could be chosen so they matched the hardware IRQ line into the root interrupt controller (i.e. the component actually firing the interrupt line to the CPU) nowadays this number is just a number.
The
irq_alloc_desc*()
andirq_free_desc*()
APIs provide allocation of irq numbers, but they don't provide any support for reverse mapping of the controller-local IRQ (hwirq) number into the Linux IRQ number space.The current design of the Linux kernel uses a single large number space where each separate IRQ source is assigned a different number. This is simple when there is only one interrupt controller, but in systems with multiple interrupt controllers the kernel must ensure that each one gets assigned non-overlapping allocations of Linux IRQ numbers.
More details in the Linux-kernel Documentation/IRQ-domain.txt.
Also you may be interested in registering an ISR for an existing interrupt (say the keyboard IRQ?) When multiple ISRs are registered for a single IRQ, the Linux kernel will call each of the ISRs in each drivers that register a shared irq.