Lines Matching +full:usb +full:- +full:hub

1 // SPDX-License-Identifier: GPL-2.0-only
3 * API for creating and destroying USB onboard hub platform devices
15 #include <linux/usb.h>
16 #include <linux/usb/hcd.h>
17 #include <linux/usb/of.h>
18 #include <linux/usb/onboard_hub.h>
33 * onboard_hub_create_pdevs -- create platform devices for onboard USB hubs
34 * @parent_hub : parent hub to scan for connected onboard hubs
35 * @pdev_list : list of onboard hub platform devices owned by the parent hub
37 * Creates a platform device for each supported onboard hub that is connected to
38 * the given parent hub. The platform device is in charge of initializing the
39 * hub (enable regulators, take the hub out of reset, ...) and can optionally
40 * control whether the hub remains powered during system suspend or not.
43 * by the parent hub.
53 * platform device for each physical onboard hub, hence for root hubs the loop
54 * is only executed for the root hub of the primary HCD. Since the function
56 * connected to the root hub of the secondary HCD if needed.
59 * hub (the hub is a single physical device). To achieve this two measures are
61 * is called on behalf of the parent hub that is connected to the primary HCD
64 * created if the peer hub doesn't have one already.
69 struct usb_hcd *hcd = bus_to_hcd(parent_hub->bus); in onboard_hub_create_pdevs()
74 if (!parent_hub->dev.of_node) in onboard_hub_create_pdevs()
77 if (!parent_hub->parent && !usb_hcd_is_primary_hcd(hcd)) in onboard_hub_create_pdevs()
80 for (i = 1; i <= parent_hub->maxchild; i++) { in onboard_hub_create_pdevs()
88 npc = of_parse_phandle(np, "peer-hub", 0); in onboard_hub_create_pdevs()
99 put_device(&pdev->dev); in onboard_hub_create_pdevs()
104 pdev = of_platform_device_create(np, NULL, &parent_hub->dev); in onboard_hub_create_pdevs()
106 dev_err(&parent_hub->dev, in onboard_hub_create_pdevs()
107 "failed to create platform device for onboard hub '%pOF'\n", np); in onboard_hub_create_pdevs()
113 of_platform_device_destroy(&pdev->dev, NULL); in onboard_hub_create_pdevs()
117 pdle->pdev = pdev; in onboard_hub_create_pdevs()
118 list_add(&pdle->node, pdev_list); in onboard_hub_create_pdevs()
127 * onboard_hub_destroy_pdevs -- free resources of onboard hub platform devices
128 * @pdev_list : list of onboard hub platform devices
138 list_del(&pdle->node); in onboard_hub_destroy_pdevs()
139 of_platform_device_destroy(&pdle->pdev->dev, NULL); in onboard_hub_destroy_pdevs()