INTC

Allwinner SoCs have a bespoke interrupt controller. It was originally the only interrupt controller on the chip. On SoCs with a GIC (sun6i and newer), it sits between the NMI pin and a GIC input. It is responsible for controlling the NMI trigger type (high/low/rising/falling). On SoCs with an AR100, it serves as the interrupt controller for that CPU.

INTC
sun4i/sun5i SoCs (A10, A13) did not have a GIC, and used this hardware exclusively. See the A13 manual for a detailed register description.

Driver
This interrupt controller uses the drivers/irqchip/irq-sun4i.c driver in Linux.

NMI Controller
After Allwinner switched to using a GIC, but before they added a power management coprocessor, there was no need for a full INTC. SoCs like the A20 have a stripped-down version of the hardware, that only manages the trigger type for the NMI.

Driver
This interrupt controller uses the drivers/irqchip/irq-sunxi-nmi.c driver in Linux.

R_INTC
The R_INTC is the secondary interrupt controller in sun8i/sun50i SoCs that contain the AR100 coprocessor. It is closely related to the original sun4i INTC. While stripped down some, it is much closer to the original feature set than it is to the A20 NMI controller.

Hardware Architecture
See the A13 manual for register descriptions. Only the first register of each type is implemented, so a maximum of 32 IRQs are supported (but see below). The priority logic appears not to be implemented, as setting any bit in the RESP register stops the AR100 from receiving interrupt exceptions from all IRQs.

The image below shows how the various registers control the IRQ flow. Note that the NMI IRQ has a latch (separate from any rising/falling trigger) that must be ACKed before the signal to the GIC will be deasserted.



IRQ Mapping
The first IRQ is always the NMI. The order of the next 15 IRQs matches the order the corresponding inputs to the GIC. Then there is a region of uncertainty, containing at least the MSGBOX IRQ. The remainder of the IRQs are multiplexed from the same sources as the first hundred or so SPI IRQs.

The multiplexing of the individual IRQs in each "SPI IRQ" group is controlled by bits in registers 0xc0-0xcc, with one bit for each IRQ. There is no way (from R_INTC) to get the status of one of these multiplexed IRQs. If the CPU cluster is powered on, you can read the GICD ISPENDRs. Otherwise, you will have to check each IRQ source individually.

Driver
This interrupt controller currently uses the drivers/irqchip/irq-sunxi-nmi.c driver in Linux as well, but a new driver is needed to support preconfiguring the wakeup IRQs for the AR100.