1 #include <linux/init.h>
2 #include <linux/platform_device.h>
3 #include <linux/pm_runtime.h>
4 #include <linux/module.h>
5 #include <linux/of_platform.h>
7 static int am335x_child_probe(struct platform_device
*pdev
)
11 pm_runtime_enable(&pdev
->dev
);
13 ret
= of_platform_populate(pdev
->dev
.of_node
, NULL
, NULL
, &pdev
->dev
);
19 pm_runtime_disable(&pdev
->dev
);
23 static int of_remove_populated_child(struct device
*dev
, void *d
)
25 struct platform_device
*pdev
= to_platform_device(dev
);
27 of_device_unregister(pdev
);
31 static int am335x_child_remove(struct platform_device
*pdev
)
33 device_for_each_child(&pdev
->dev
, NULL
, of_remove_populated_child
);
34 pm_runtime_disable(&pdev
->dev
);
38 static const struct of_device_id am335x_child_of_match
[] = {
39 { .compatible
= "ti,am33xx-usb" },
42 MODULE_DEVICE_TABLE(of
, am335x_child_of_match
);
44 static struct platform_driver am335x_child_driver
= {
45 .probe
= am335x_child_probe
,
46 .remove
= am335x_child_remove
,
48 .name
= "am335x-usb-childs",
49 .of_match_table
= of_match_ptr(am335x_child_of_match
),
53 module_platform_driver(am335x_child_driver
);
54 MODULE_DESCRIPTION("AM33xx child devices");
55 MODULE_LICENSE("GPL v2");