/dts-v1/;/plugin/;
/ { compatible = "ti,beaglebone", "ti,beaglebone-black", "ti,beaglebone-green";
// identification part-number = "DRONEDRIVER"; version = "00A0";
fragment@1 { target-path="/"; __overlay__ { /* Add default settings for the LA core */ pru-dronedriver { compatible = "dronedriver,dronedriver"; pruss = <&pruss>; interrupt-parent = <&pruss_intc>; interrupts = <22>, <23>, <24>; interrupt-names = "from_dd_1", "to_dd", "from_dd_2"; }; }; };};
static struct dronedriver_private_data dronedriver_pdata = { .fw_names[0] = "am335x-pru0-fw", .fw_names[1] = "am335x-pru1-fw",};
static const struct of_device_id dronedriver_dt_ids[] = { { .compatible = "dronedriver,dronedriver", .data = &dronedriver_pdata, }, { /* sentinel */ },};
MODULE_DEVICE_TABLE(of, dronedriver_dt_ids);
static int dronedriver_probe(struct platform_device *pdev){ struct rproc *rproc; struct device_node *node = pdev->dev.of_node;
//if (!node) // return -ENODEV; /* No support for non-DT platforms */ printk(KERN_INFO "[1]\n");
match = of_match_device(dronedriver_dt_ids, &pdev->dev); if (!match) return -ENODEV; printk(KERN_INFO "[2]\n");
dddev = kzalloc(sizeof(*dddev), GFP_KERNEL); if (!dddev) { ret = -1; goto fail; } printk(KERN_INFO "[3]\n");
dddev->fw_data = match->data; dddev->miscdev.fops = &pru_dronedriver_fops; dddev->miscdev.minor = MISC_DYNAMIC_MINOR; dddev->miscdev.mode = S_IRUGO; dddev->miscdev.name = "dronedriver"; printk(KERN_INFO "[5]\n");
dddev->p_dev = &pdev->dev; dev_set_drvdata(dddev->p_dev, dddev); printk(KERN_INFO "[6]\n");
dev = &pdev->dev; rproc = pru_rproc_get(node,NULL); if(IS_ERR_OR_NULL(rproc)) { ret = PTR_ERR(rproc); if (ret != -EPROBE_DEFER) dev_err(dev, "Unable to get rproc handle.\n"); goto fail_free; }
printk(KERN_INFO "[OK] pruss handle\n"); printk(KERN_INFO "[OK] rproc:\nname = \n", rproc->name);
dddev->pruss = pruss_get(rproc);
if (IS_ERR(dddev->pruss)) { ret = PTR_ERR(dddev->pruss); if (ret != -EPROBE_DEFER) dev_err(dev, "Unable to get pruss handle.\n"); goto fail_free; } goto fail_free; printk(KERN_INFO "[OK] pruss handle\n");
...
}
static int dronedriver_remove(struct platform_device *pdev){ return 0;}
static struct platform_driver dronedriver_driver = { .driver = { .name = DRV_NAME, .owner = THIS_MODULE, .of_match_table = dronedriver_dt_ids, }, .probe = dronedriver_probe, .remove = dronedriver_remove,};
module_platform_driver(dronedriver_driver);