Sebastian Andrzej Siewior | 97238b3 | 2013-07-05 14:51:33 +0200 | [diff] [blame] | 1 | #include <linux/platform_device.h> |
| 2 | #include <linux/pm_runtime.h> |
| 3 | #include <linux/module.h> |
| 4 | #include <linux/of_platform.h> |
| 5 | |
| 6 | static int am335x_child_probe(struct platform_device *pdev) |
| 7 | { |
| 8 | int ret; |
| 9 | |
| 10 | pm_runtime_enable(&pdev->dev); |
| 11 | |
| 12 | ret = of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev); |
| 13 | if (ret) |
| 14 | goto err; |
| 15 | |
| 16 | return 0; |
| 17 | err: |
| 18 | pm_runtime_disable(&pdev->dev); |
| 19 | return ret; |
| 20 | } |
| 21 | |
Sebastian Andrzej Siewior | 97238b3 | 2013-07-05 14:51:33 +0200 | [diff] [blame] | 22 | static const struct of_device_id am335x_child_of_match[] = { |
| 23 | { .compatible = "ti,am33xx-usb" }, |
| 24 | { }, |
| 25 | }; |
| 26 | MODULE_DEVICE_TABLE(of, am335x_child_of_match); |
| 27 | |
| 28 | static struct platform_driver am335x_child_driver = { |
| 29 | .probe = am335x_child_probe, |
Sebastian Andrzej Siewior | 97238b3 | 2013-07-05 14:51:33 +0200 | [diff] [blame] | 30 | .driver = { |
| 31 | .name = "am335x-usb-childs", |
Sachin Kamat | e79c8a0 | 2013-09-30 09:44:43 +0530 | [diff] [blame] | 32 | .of_match_table = am335x_child_of_match, |
Sebastian Andrzej Siewior | 97238b3 | 2013-07-05 14:51:33 +0200 | [diff] [blame] | 33 | }, |
| 34 | }; |
| 35 | |
Ezequiel Garcia | 7adb5c8 | 2014-06-23 15:34:22 -0300 | [diff] [blame] | 36 | static int __init am335x_child_init(void) |
| 37 | { |
| 38 | return platform_driver_register(&am335x_child_driver); |
| 39 | } |
| 40 | module_init(am335x_child_init); |
| 41 | |
Sebastian Andrzej Siewior | 97238b3 | 2013-07-05 14:51:33 +0200 | [diff] [blame] | 42 | MODULE_DESCRIPTION("AM33xx child devices"); |
| 43 | MODULE_LICENSE("GPL v2"); |