只能实例化1个泛型uio设备

时间:2015-02-17 01:24:49

标签: linux-kernel zynq

我尝试使用uio_pdrv_genirq驱动程序向用户空间公开中断。但是,我只能在设备中实例化1个设备,所有后续设备都无法通过探测。 该系统是zynq-7000,内核版本是3.9.0-xilinx。

该设备:

/ {
...
amba@0 {
    ...

    gic: intc@f8f01000 {
        interrupt-controller;
        compatible = "arm,cortex-a9-gic";
        #interrupt-cells = <3>;
        reg = <0xf8f01000 0x1000>,
              <0xf8f00100 0x0100>;
    };

    interrupt_91@0x43C90000 {
        compatible = "generic-uio";
        reg = < 0x43C90000 0x1000 >;
        interrupts = < 0 59 1 >; //add 32 to get the interrupt number
        interrupt-parent = <&gic>;
    } ;

    interrupter_90@0x43CA0000 {
        compatible = "generic-uio";
        reg = < 0x43CA0000 0x1000 >;
        interrupts = < 0 58 1 >; //add 32 to get the interrupt number
        interrupt-parent = <&gic>;
    } ;
    ...
};

dmesg输出:

dmesg | grep uio
uio_pdrv_genirq 43ca0000.interrupter_90: unable to register uio device
uio_pdrv_genirq: probe of 43ca0000.interrupter_90 failed with error 1

kernel config:

CONFIG_UIO=y
# CONFIG_UIO_CIF is not set
CONFIG_UIO_PDRV_GENIRQ=y
# CONFIG_UIO_DMEM_GENIRQ is not set
# CONFIG_UIO_AEC is not set
# CONFIG_UIO_SERCOS3 is not set
# CONFIG_UIO_PCI_GENERIC is not set
# CONFIG_UIO_NETX is not set

我确定我之前在Zedboard上工作,我不知道这里可能出现什么问题。

1 个答案:

答案 0 :(得分:4)

好吧,这在我使用的内核源代码中是一个问题。

行:

if (ret)
    goto err_get_minor;

在drivers / uio / uio.c和行中:

if (ret) {
    dev_err(&pdev->dev, "unable to register uio device\n");
    goto bad1;
}
必须同时更改drivers / uio / uio_pdrv_genirq.c中的

,以便if语句读取if (ret < 0)

原因是uio_get_minor函数(其返回值ret,它们正在使用)返回指定的次要编号。这是0,1,2,......等。很明显第一个设备(次要id = 0)注册正常,但第二个设备(次要id = 1)失败。这解释了错误消息&#34;失败,错误1&#34;这是次要的身份,而不是我最初假设的EPERM。

我使用的存储库是https://github.com/Trenz-Electronic/linux-te-3.9以供将来参考。

编辑:实际上,主线内核存在同样的问题,我会发布一个补丁。

相关问题