Search code examples
linuxlinux-kernellinux-device-driverkernel-modulexilinx

IRQCHIP_DECLARE: init function is not being run


I am trying to use the Xilinx interrupt controller driver in an embedded ARM FPGA system I am developing. (https://github.com/torvalds/linux/blob/master/drivers/irqchip/irq-xilinx-intc.c)

At the end of this driver is the line:

IRQCHIP_DECLARE(xilinx_intc_xps, "xlnx,xps-intc-1.00.a", xilinx_intc_of_init);

I have added an entry in my device tree for the interrupt controller.

    xil_intc: xil_intc@41810000 {           
        compatible = "xlnx,xps-intc-1.00.a";                                    
        interrupt-parent = <&intc>;
        interrupts = <0x0 0x1e 0x04>;
        reg = <0x41810000 0x10000>;
        interrupt-controller;
        #interrupt-cells = <2>;
        xlnx,kind-of-intr = <0x0>;
        xlnx,num-intr-inputs = <0x1>;
    };

However, from what I can tell, the xilinx_intc_of_init function is never called during startup. I added a pr_info at the beginning of the function, but I never see it called.

The only message that seems to indicate an issue is:

[ 0.177772] irq: no irq domain found for /amba/xil_intc@41810000 !

I have successfully written and compiled other device drivers, added entries in the device tree, and had them load up and show in dmesg, but for some reason I can't get this one to work.

Any suggestions on debugging this?

For what it's worth, I'm compiling the driver into a kernel module, installing using modules_install and have added an entry to /etc/modules to load it on startup.

Edit: I am using a 4.6 kernel.


Solution

  • IRQCHIP_DECLARE(xilinx_intc_xps, "xlnx,xps-intc-1.00.a", xilinx_intc_of_init);
    

    The driver irq-xilinx-intc.c is using the above call to register with the irq subsystem.

    If irq driver uses IRQCHIP_DECLARE macro it will follow the below sequence to invoke the xilinx_intc_of_init() (callback function)

    start_kernel() –> init_IRQ() --> irqchip_init() --> of_irq_init() --> call-back function (xilinx_intc_of_init)
    

    If The Driver was registered using IRQCHIP_DECLARE it must be compiled into the kernel and the callback function will be invoked at kernel boot time.

    It doesn't work as kernel modules/overlay like other device drivers.