Linux device tree help (GPIO controller / interrupts)

I found out about linux device trees, and we tried to start porting some of our old code to use them. I have problems with the gpio node controller:

gpio1: gpio-controller@c00 { #gpio-cells = <2>; compatible = "cavium,octeon-3860-gpio"; reg = <0xc00 0x100>; gpio-controller; /* Interrupts are specified by two parts: * 1) GPIO pin number (0..15) * 2) Triggering (1 - edge rising * 2 - edge falling * 4 - level active high * 8 - level active low) */ interrupt-controller; interrupt-cells = <2>; interrupts = <0 24>, <1 25>, <2 26>, <3 27>; 

};

I'm trying to map specific IRQ messages to GPIO contacts, but it looks like it only ever displayed the first IRQ 24 identifier on gpio pin 0. I looked at the source code and it doesn't look like it will always interact with interrupts, although the device tree binding text file seems to hint that it will be (devicetree / bindings / gpio / cavium-octeon-gpio.txt). Does anyone know how I can display multiple hooks for different gpio contacts?

+8
source share
2 answers

The gpio handling is still not 100% the same between the platforms, so I will give you the gist and you may need to adapt to your platform (find a dts that uses the same or similar SoC). My platform Freescale imx.6 Here is its essence:

First: Leave gpio1 node alone. (It is probably configured correctly in the dtsi that you received from your provider).

Secondly: If you want, for example. gpio 1 15 - interrupt active high in node device you want to use gpio interrupt, add

 interrupt-parent = <&gpio1>; interrupts = <15 IRQ_TYPE_LEVEL_HIGH>; 

for example: from arch / arm / boot / dts / imx6qdl-gw52xx.dtsi

 touchscreen: egalax_ts@04 { compatible = "eeti,egalax_ts"; reg = <0x04>; interrupt-parent = <&gpio7>; interrupts = <12 2>; wakeup-gpios = <&gpio7 12 GPIO_ACTIVE_LOW>; }; 
+5
source

I am not familiar with your car, but if you look here:

https://elinux.org/Device_Tree_Usage#How_Interrupts_Work

you will see that the interrupt specifiers are for the interrupt controller of the node in which they are defined (that is, the parent interrupt controller), and not for the node itself.

Since you don’t even show where and if you actually enable the interrupt (contact, trigger), I suppose you didn’t know that.

So what does the gpio1 interrupt controller node look like?

Does he really expect to receive multiple interrupts from the same source in the form (pin, irq)?

For example, in am335x, all interrupts on gpio1 are mapped to a specific index on the OMAP35 INTC controller, which means that only 1 interrupt is defined on the gpio1 node, signaling INTC whether the interrupt on gpio1 has occurred.

+1
source

All Articles