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