Search code examples
linux-kernellinux-device-driveru-bootdevice-tree

Kernel module probe function is never called


I try to load a sample device tree driver, but the probe function is never called.

The entry in dts file looks like this

dummy1 {
    compatible = "ti,dummy";
    reg = <0x9f200000 0x1000>,
        <0x9f201000 0x8>;
};

And the relevant driver code is:

#define DRV_NAME  "dummy"
static const struct of_device_id dummy_of_match[] = {
{
.compatible = "ti,dummy",
}, {
},
};

static struct platform_driver dummy_driver = {
.driver = {
.name = DRV_NAME,
.of_match_table = dummy_of_match,
},
.probe   = dummy_probe,
.remove   = dummy_remove,
};
MODULE_DEVICE_TABLE(of, dummy_of_match);
module_platform_driver(dummy_driver);

I have recompiled the dtb file (dtdiff shows it contains my device) and have copied it to target, but nothing happens when I insmod the driver. I also can't find it in /sys/firmware/devicetree/


Solution

  • Trying to solve the issue, I even removed the dtb file...and magically the kernel continued to boot as if nothing happened. I thought dtb could be baked into zImage which is possible with some additional tweaking, but that wasn't the case.

    Solution: Finally, I found out that the uboot was also checking the ./boot directory on the emmc card first! Removing the dtb from there immediately made the file on the NFS 'visible'.

    P.S.: If you run into similar issues try to read the outputs carefully. I began to to understand the issue when I saw the .dtb load error when I removed it on NFS, but after that a message appeared that it was successfully loaded to the memory.