musb_am335x.c 940 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #include <linux/platform_device.h>
  2. #include <linux/pm_runtime.h>
  3. #include <linux/module.h>
  4. #include <linux/of_platform.h>
  5. static int am335x_child_probe(struct platform_device *pdev)
  6. {
  7. int ret;
  8. pm_runtime_enable(&pdev->dev);
  9. ret = of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev);
  10. if (ret)
  11. goto err;
  12. return 0;
  13. err:
  14. pm_runtime_disable(&pdev->dev);
  15. return ret;
  16. }
  17. static const struct of_device_id am335x_child_of_match[] = {
  18. { .compatible = "ti,am33xx-usb" },
  19. { },
  20. };
  21. MODULE_DEVICE_TABLE(of, am335x_child_of_match);
  22. static struct platform_driver am335x_child_driver = {
  23. .probe = am335x_child_probe,
  24. .driver = {
  25. .name = "am335x-usb-childs",
  26. .of_match_table = am335x_child_of_match,
  27. },
  28. };
  29. static int __init am335x_child_init(void)
  30. {
  31. return platform_driver_register(&am335x_child_driver);
  32. }
  33. module_init(am335x_child_init);
  34. MODULE_DESCRIPTION("AM33xx child devices");
  35. MODULE_LICENSE("GPL v2");