I'm new to do Linux driver development. I encounter the problem of failing to get irq when I try to use driver mailbox-altera. On my platform DTS related to mailbox is as follows:
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)
...
}
How did I trace I fail to get irq--add logs as below:
My logs are:
#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.
which indicates that the memory region I get in driver exactly match the description of DTS, but platform_get_irq fails, because there is only one resource(which is type of IORESOURCE_MEM ) in the mailbox device. As DTS description, shouldn't I get the interrupts = <11> or <12> information in software when I trigger the driver? What should I do to get the irq ID I expected?
User contributions licensed under CC BY-SA 3.0