1

我为我的custom_hardware开发了一个工作驱动程序,它依赖于设备树。因为我的驱动程序可能会发展,所以我不希望我的驱动程序成为内核的一部分(当我说“成为内核的一部分”时,我的意思是在内核创建期间与内核一起编译)

这是我的dts的一瞥:

custom_hardware: custom_hardware@0x41006000 {
    compatible = "mfg,custom";
    reg = <0x41006000 0x1000>;
    #interrupt-cells = <0x1>;
    interrupt-controller;
};

existing_hardware: existing_hardward@41004000 {
    compatible = "mfg,existing";
    reg = <0x41004000 0x1000>;
    interrupt-parent = <&custom_hardware>;
    interrupts = <0>;
};

existing_hardware的驱动程序已经与内核一起编译(existing_hardware的驱动程序在内核创建期间已与内核一起编译)。

我想做的是将我的custom_hardware的驱动程序附加到 ramfs 并让内核在 existing_hardware 的驱动程序之前加载 custom_hardware的驱动程序

这很重要,因为existing_hardware的驱动程序从custom_hardware的驱动程序的irq_domain请求一个virq。为了获得irq_domain,必须首先加载custom_hardware的驱动程序。

请注意,existing_hardware的驱动程序在设备树的探测过程中被加载,这似乎发生在内核启动序列的早期阶段。

4

2 回答 2

2

这不是办法。模块/驱动程序加载的顺序无关紧要。您需要做的是-EPROBE_DEFER在现有硬件中获取 IRQ 失败时返回。然后它会在稍后再次被探测,希望在 custom_hardware 被探测之后。

此外,您可以应用该补丁以确保request_irq()由于域尚不存在而失败并-EPROBE_DEFER在这种情况下 返回https://lkml.org/lkml/2014/2/13/114

于 2014-03-25T09:03:16.207 回答
0

我有类似的问题(探测顺序错误),我发现的唯一简单解决方案是将模块按所需的探测顺序放入 Makefile。我在这里找到了解决方案:Linux 内置驱动程序加载顺序是什么?

于 2014-11-12T11:32:55.153 回答