opencomputeproject / oom

MIT License
66 stars 29 forks source link

Ability to bind driver in the device tree #13

Closed insekt closed 3 years ago

insekt commented 5 years ago

It's necessary to make some enhancement to the driver's code so the Linux kernel can bind devices with driver. According to this tutorial http://xillybus.com/tutorials/device-tree-zynq-3 here are changes that need to be done.

static struct of_device_id optoe_of_match[] = {
    { .compatible = "oom,optoe", },
    {}
};
MODULE_DEVICE_TABLE(of, optoe_of_match);

and add .of_match_table = optoe_of_match, property

static struct i2c_driver optoe_driver = {
    .driver = {
        .name = "optoe",
        .owner = THIS_MODULE,
        .of_match_table = optoe_of_match,
    },
    .probe = optoe_probe,
    .remove = optoe_remove,
    .id_table = optoe_ids,
};
insekt commented 5 years ago

This experiment is in progress, now working on device tree part to check this fix.

donboll commented 3 years ago

Device tree support is included in the August 12, 2021 drop, specifically in commit 3ef1e9f5. See the optoe.txt file for the device tree info specified in the manner of Linux kernel documentation.