Linux内核平台驱动程序:对多个设备的_probe()的修改

时间:2019-08-27 13:31:08

标签: linux kernel driver linux-device-driver soc

必须对Linux内核驱动程序进行哪些修改,以支持(相等于)SoC(在设备树中定义)上的多个设备(myipcore),而不是仅一个?

在我的应用程序中:只有一个进程将打开相应的/dev/myipcoreX文件!

设备树:

 amba: amba {
    compatible = "simple-bus";
    #address-cells = <2>;
    #size-cells = <2>;
    ranges;

    axi_myipcore1: myipcore@A0001000 {
        compatible = "xy,my-ip-core-1.00";
        status = "disabled";
        interrupt-parent = <&gic>;
        interrupts = <0 89 1>;
        reg = <0x0 0xA0001000 0x0 0x14>;
    };

    axi_myipcore2: myipcore@A0002000 {
        compatible = "xy,my-ip-core-1.00";
        status = "disabled";
        interrupt-parent = <&gic>;
        interrupts = <0 90 1>;
        reg = <0x0 0xA0002000 0x0 0x14>;
    };
    ....
 }

对于每个设备树条目,调用驱动程序的_probe()函数。如何动态获取alloc_chrdev_region()的下一个次要数字,以及如何仅执行一次class_create()

还是我必须修改设备树?

你知道,我在寻找中心主题。...

0 个答案:

没有答案