We have a design that uses the ls1021a. There is an I2C gpio device (pca9554) connected to i2c bus 0. The IRQ from the device is connected to the CPU IRQ 2.
For the device tree description, I added:
compatible = "pca953x,pca9554";
reg = <0x3a>;
gpio-cells = <2>;
interrupt-parent = <&gic>;
interrupts = <GIC_SPI 165 IRQ_TYPE_LEVEL_LOW>;
From Linux, I see:
[ 0.051001] pca953x 0-003a: using no AI
[ 0.080652] genirq: Setting trigger mode 8 for irq 50 failed (gic_set_type+0x0/0xa0)
[ 0.080778] pca953x 0-003a: failed to request irq 50
[ 0.080811] pca953x: probe of 0-003a failed with error -22
Is the IRQ number correct in the error message? I though, I would have got a value of 197 (165+32).
Looking at the code for gic_set_type, with a value of 32 or above I would be limited to IRQ_TYPE_LEVEL_HIGH or IRQ_TYPE_EDGE_RISING. Does that mean the IRQ from the pca9554 must be passed in an invert gate?
SPIs interrupt only support low-to-high rising edge triggered and active high triggered.
You can check this in "linux/Documentation/devicetree/bindings/interrupt-controller/arm,gic.yaml"
bits[3:0] trigger type and level flags.
1 = low-to-high edge triggered
2 = high-to-low edge triggered (invalid for SPIs)
4 = active high level-sensitive
8 = active low level-sensitive (invalid for SPIs).
You can also find some description about it in ARM GIC document:
"SPIs...., You can configure whether each SPI is triggered on a rising edge or is active-HIGH level-sensitive."
For customers who design their boards only support active-low interrupt, they can configure the interrupt PIN to GPIO mode and active low is supported by GPIO interrupt.
Is the gpio interrupt number the same?
// As LS0121A RM description, the internal interrupt number is 197.
Is it connected the same way in the device tree?
// Yes, in the dts, the number should be 197-32=165.
Looking at the symbol for the LS1021A, IRQ2 pin can only be an IRQ. While IRQ3 can be GPIO1_23.
That may mean I cannot go in GPIO mode for this pin. This is confirmed by RCW setting that only applies to IRQ3:5