为什么platform_get_irq无法在我的信箱-altera驱动程序中获得irq?

时间:2019-02-26 09:38:14

标签: linux-device-driver device-driver intel-fpga device-tree

我刚开始进行Linux驱动程序开发。 尝试使用驱动程序mailbox-altera时遇到无法获取irq的问题。 在我的平台上,与邮箱相关的DTS如下:

    hps_bridges: bridge@0xc0000000 {
        compatible = "altr,bridge-17.1", "simple-bus";
        reg = <0xc0000000 0x20000000>,
            <0xff200000 0x00200000>;
        reg-names = "axi_h2f", "axi_h2f_lw";
        #address-cells = <2>;
        #size-cells = <1>;
        ranges = <0x00000000 0x00020000 0xc0020000 0x00004000>,
            <0x00000001 0x00000030 0xff200030 0x00000010>,
            <0x00000001 0x00000020 0xff200020 0x00000010>,
            <0x00000001 0x00000000 0xff200000 0x00000020>,
            <0x00000001 0x00010000 0xff210000 0x00004000>;
        ...

        bci_avalon_mailbox_simple_master_hps: mailbox@0x100000030 {
            compatible = "altr,bci_avalon_mailbox_simple-17.0", "altr,mailbox-1.0";
            reg = <0x00000001 0x00000030 0x00000010>;
            interrupt-parent = <&nios2_gen2_master>;
            interrupts = <11>;
            #mbox-cells = <1>;  /* embeddedsw.dts.params.#mbox-cells type NUMBER */
            linux,mailbox-name = "bci_avalon_mailbox_simple_master_hps";
        }; //end mailbox@0x100000030 (bci_avalon_mailbox_simple_master_hps)

        bci_avalon_mailbox_simple_hps_master: mailbox@0x100000020 {
            compatible = "altr,bci_avalon_mailbox_simple-17.0", "altr,mailbox-1.0";
            reg = <0x00000001 0x00000020 0x00000010>;
            interrupt-parent = <&nios2_gen2_master>;
            interrupts = <12>;
            #mbox-cells = <1>;  /* embeddedsw.dts.params.#mbox-cells type NUMBER */
            linux,mailbox-name = "bci_avalon_mailbox_simple_hps_master";
        }; //end mailbox@0x100000020 (bci_avalon_mailbox_simple_hps_master)
    ...
    }

我如何跟踪无法获取irq的原因-添加如下日志: enter image description here

enter image description here

我的日志是:

#insmod mailbox-altera.ko
dev->num_resources=1.
resource[0] type=512.
start=0xff200030, size=16.
dev->num_resources=1.
resource[0] type=512.
platform_get_irq return -6.
dev->num_resources=1.
resource[0] type=512.
start=0xff200020, size=16.
dev->num_resources=1.
resource[0] type=512.
platform_get_irq return -6.

表示我进入驱动程序的内存区域与DTS的描述完全匹配,但是platform_get_irq失败,因为邮箱设备中只有一种资源(类型为IORESOURCE_MEM)。 作为DTS的描述,触发驱动程序时是否应该在软件中获取中断= <11>或<12>信息?我应该怎么做才能得到我想要的irq ID?

0 个答案:

没有答案