I am developing a simple platform driver with device tree, but it doesn't seem like the probe is being called.
From my understanding, in order for the probe to be called, you need to have matching compatible
values, and have the platform driver registered. What am I possibly missing?
struct of_device_id pcdev_dt_match[] ={ {.compatible = "pcdev-A1x"}, {.compatible = "pcdev-A2x"}};struct platform_driver platform_driver_struct ={ .probe = pcd_platform_driver_probe, .remove = pcd_platform_driver_remove, .id_table = pcdevs_ids, .driver = { .name = "pseudo-char-device", .of_match_table = pcdev_dt_match }};static int __init platform_driver_init(void){ int ret; /* Register platform driver */ platform_driver_register(&platform_driver_struct); pr_info("Platform driver is loaded...\n"); return 0;}
// dtsi file/ { pcd-dev1 { compatible = "pcdev-A1x"; org,size=<512>; org,device-serial-num="ABCX"; org,perm=<0x15>; }; pcd-dev2 { compatible = "pcdev-A2x"; org,size=<256>; org,device-serial-num="xBCX"; org,perm=<0x11>; };};
// linux/include/linux/of_device.hstatic inline int of_driver_match_device(struct device *dev, const struct device_driver *drv){ return of_match_device(drv->of_match_table, dev) != NULL;}// linux/drivers/of/device.cconst struct of_device_id *of_match_device(const struct of_device_id *matches, const struct device *dev){ if ((!matches) || (!dev->of_node)) return NULL; return of_match_node(matches, dev->of_node);}
Does dev->of_node
need to be initialized?