From 03a86f5cb1adaa2e30a70eefd7bc1ab9509eea46 Mon Sep 17 00:00:00 2001 From: Hemant Kumar Date: Fri, 18 Aug 2017 16:40:58 -0700 Subject: [PATCH] usb: host: Add support for usb core indexing Unique usb core id is used to differentiate between different usb controllers. Change-Id: Ibd886f704e7ecedfbf035b8e5adea2852ddf25bf Signed-off-by: Hemant Kumar --- Documentation/devicetree/bindings/usb/dwc3.txt | 1 + drivers/usb/host/xhci-plat.c | 4 ++++ drivers/usb/host/xhci.h | 2 ++ 3 files changed, 7 insertions(+) diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt b/Documentation/devicetree/bindings/usb/dwc3.txt index ddca4c39e2de..7328b2847e02 100644 --- a/Documentation/devicetree/bindings/usb/dwc3.txt +++ b/Documentation/devicetree/bindings/usb/dwc3.txt @@ -61,6 +61,7 @@ Optional properties: - snps,num-gsi-evt-buffs: If present, specifies number of GSI based hardware accelerated event buffers. 1 event buffer is needed per h/w accelerated endpoint. - xhci-imod-value: Interrupt moderation interval for host mode (in increments of 250nsec). + - usb-core-id: Differentiates between different controllers present on a device. This is usually a subnode to DWC3 glue to which it is connected. diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index c6998f086e12..be72953f9737 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -233,6 +233,10 @@ static int xhci_plat_probe(struct platform_device *pdev) hcd_to_bus(xhci->shared_hcd)->skip_resume = true; + if (device_property_read_u32(pdev->dev.parent, "usb-core-id", + &xhci->core_id)) + xhci->core_id = -EINVAL; + hcd->usb_phy = devm_usb_get_phy_by_phandle(&pdev->dev, "usb-phy", 0); if (IS_ERR(hcd->usb_phy)) { ret = PTR_ERR(hcd->usb_phy); diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index c665806983be..f583cefecee0 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h @@ -1519,6 +1519,8 @@ struct xhci_hcd { /* secondary interrupter */ struct xhci_intr_reg __iomem **sec_ir_set; + int core_id; + /* Cached register copies of read-only HC data */ __u32 hcs_params1; __u32 hcs_params2;