Question

I'm working with the linux kernel device tree and at first sight there seems to be a missing functionality for nodes with multiple interrupt parents. I have a driver that is controlling a custom ARM embedded board, it takes GPIOs and pin interrupts from multiple GPIO interrupt parents and manages the on board battery, voltage low irqs, reset_pending irq, etc.

I've found one source where someone seems to have hacked in additional functionality to deal with this but that isn't offical and involves modifying the of interrupt source files which i do not want. The modification added support for a term called "interrupts-extended" like this. Here the interrupt parent is specified in the tuples.

    #interrupt-cells = <2>;
    interrupts-extended = <&gpio3 21 1>, <&gpio7 13 2>; /* voltage/reset irq */

I have not found any means or example of how to use the interrupt-map property to achieve simple gpio interrupt mapping so i'm at loss there.

If i was only using a single GPIO interrupt parent the proper way to do this would be like this.

interrupt-parent = <&gpio1>;
interrupts = <9 2>, <8,1>;

but that only allows declaring one interrupt parent with multiple interrupts specified in "interrupts" and they must all belong to the parent specified. I'm using 2 interrupt parents, gpio7 and gpio3.

What is the proper way to implement multiple interrupts with different interrupt parents in a single device node in the device tree ?

Was it helpful?

Solution

I don't know if this works for gpio interrupt parents, but for other types of interrupt controllers, you use the 'interrupt-map' property, and specify the list of interrupts using phandles to each of the separate controllers. Here is an example I saw where the driver needed 3 interrupts, 2 from the 'intc' controller and 1 from the 'spmi' controller:

interrupts = <0 1 2>;
interrupt-map = <0 &intc 0 134 0
                 1 &intc 0 140 0
                 2 &spmi 0 0x9 0 0>;
interrupt-names = "core_irq", "async_irq", "pmic_id_irq";
interrupt-map-mask = <0 0 0 0>;

In this example, the intc node had an #interrupt-cells value of <3> and the spmi node had an #interrupt-cells value of 4 (meaning that many arguments needed to be used with their respective phandles).

The interrupt-names field is optional, but allows you to request the irq by name instead of by number in the code (ie, use platform_get_irq_byname(), instead of platform_get_irq() )

To be honest, I'm a bit unsure what interrupt-map-mask is used for.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top