Commit c950686b authored by Matthias Kaehlcke's avatar Matthias Kaehlcke Committed by Greg Kroah-Hartman

usb: host: xhci-plat: Create platform device for onboard hubs in probe()

Call onboard_hub_create/destroy_pdevs() from  _probe()/_remove()
to create/destroy platform devices for onboard USB hubs that may
be connected to the root hub of the controller. These functions
are a NOP unless CONFIG_USB_ONBOARD_HUB=y/m.

Also add a field to struct xhci_hcd to keep track of the onboard hub
platform devices that are owned by the xHCI.
Signed-off-by: default avatarMatthias Kaehlcke <mka@chromium.org>
Link: https://lore.kernel.org/r/20210609150159.v12.4.I7a3a7d9d2126c34079b1cab87aa0b2ec3030f9b7@changeidSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 412981e0
...@@ -54,6 +54,7 @@ config USB_XHCI_PCI_RENESAS ...@@ -54,6 +54,7 @@ config USB_XHCI_PCI_RENESAS
config USB_XHCI_PLATFORM config USB_XHCI_PLATFORM
tristate "Generic xHCI driver for a platform device" tristate "Generic xHCI driver for a platform device"
select USB_XHCI_RCAR if ARCH_RENESAS select USB_XHCI_RCAR if ARCH_RENESAS
depends on USB_ONBOARD_HUB || !USB_ONBOARD_HUB
help help
Adds an xHCI host driver for a generic platform device, which Adds an xHCI host driver for a generic platform device, which
provides a memory space and an irq. provides a memory space and an irq.
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_device.h> #include <linux/of_device.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/usb/onboard_hub.h>
#include <linux/usb/phy.h> #include <linux/usb/phy.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/acpi.h> #include <linux/acpi.h>
...@@ -374,6 +375,9 @@ static int xhci_plat_probe(struct platform_device *pdev) ...@@ -374,6 +375,9 @@ static int xhci_plat_probe(struct platform_device *pdev)
*/ */
pm_runtime_forbid(&pdev->dev); pm_runtime_forbid(&pdev->dev);
INIT_LIST_HEAD(&xhci->onboard_hub_devs);
onboard_hub_create_pdevs(hcd->self.root_hub, &xhci->onboard_hub_devs);
return 0; return 0;
...@@ -420,6 +424,8 @@ static int xhci_plat_remove(struct platform_device *dev) ...@@ -420,6 +424,8 @@ static int xhci_plat_remove(struct platform_device *dev)
usb_remove_hcd(hcd); usb_remove_hcd(hcd);
usb_put_hcd(shared_hcd); usb_put_hcd(shared_hcd);
onboard_hub_destroy_pdevs(&xhci->onboard_hub_devs);
clk_disable_unprepare(clk); clk_disable_unprepare(clk);
clk_disable_unprepare(reg_clk); clk_disable_unprepare(reg_clk);
usb_put_hcd(hcd); usb_put_hcd(hcd);
......
...@@ -1920,6 +1920,8 @@ struct xhci_hcd { ...@@ -1920,6 +1920,8 @@ struct xhci_hcd {
struct dentry *debugfs_slots; struct dentry *debugfs_slots;
struct list_head regset_list; struct list_head regset_list;
struct list_head onboard_hub_devs;
void *dbc; void *dbc;
/* platform-specific data -- must come last */ /* platform-specific data -- must come last */
unsigned long priv[] __aligned(sizeof(s64)); unsigned long priv[] __aligned(sizeof(s64));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment