summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Documentation/devicetree/bindings/usb/dwc3.txt1
-rw-r--r--drivers/usb/core/hcd.c10
-rw-r--r--drivers/usb/core/usb.c9
-rw-r--r--drivers/usb/host/xhci-plat.c4
-rw-r--r--drivers/usb/host/xhci.h2
-rw-r--r--include/linux/usb.h1
-rw-r--r--include/linux/usb/hcd.h2
7 files changed, 29 insertions, 0 deletions
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/core/hcd.c b/drivers/usb/core/hcd.c
index c31c753b6e28..72ee12782b6c 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -2264,6 +2264,16 @@ usb_hcd_get_xfer_ring_dma_addr(struct usb_device *udev,
return hcd->driver->get_xfer_ring_dma_addr(hcd, udev, ep);
}
+int usb_hcd_get_controller_id(struct usb_device *udev)
+{
+ struct usb_hcd *hcd = bus_to_hcd(udev->bus);
+
+ if (!HCD_RH_RUNNING(hcd))
+ return -EINVAL;
+
+ return hcd->driver->get_core_id(hcd);
+}
+
#ifdef CONFIG_PM
int hcd_bus_suspend(struct usb_device *rhdev, pm_message_t msg)
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index 062677f8e91d..e64fd6570a23 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -717,6 +717,15 @@ dma_addr_t usb_get_xfer_ring_dma_addr(struct usb_device *dev,
}
EXPORT_SYMBOL(usb_get_xfer_ring_dma_addr);
+int usb_get_controller_id(struct usb_device *dev)
+{
+ if (dev->state == USB_STATE_NOTATTACHED)
+ return -EINVAL;
+
+ return usb_hcd_get_controller_id(dev);
+}
+EXPORT_SYMBOL(usb_get_controller_id);
+
/*-------------------------------------------------------------------*/
/*
* __usb_get_extra_descriptor() finds a descriptor of specific type in the
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;
diff --git a/include/linux/usb.h b/include/linux/usb.h
index e8b2ed4ad851..f226476a2ea4 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -755,6 +755,7 @@ usb_get_sec_event_ring_dma_addr(struct usb_device *dev,
extern dma_addr_t usb_get_dcba_dma_addr(struct usb_device *dev);
extern dma_addr_t usb_get_xfer_ring_dma_addr(struct usb_device *dev,
struct usb_host_endpoint *ep);
+extern int usb_get_controller_id(struct usb_device *dev);
/* Sets up a group of bulk endpoints to support multiple stream IDs. */
extern int usb_alloc_streams(struct usb_interface *interface,
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
index dff7adbc60bb..f603b46ff48a 100644
--- a/include/linux/usb/hcd.h
+++ b/include/linux/usb/hcd.h
@@ -405,6 +405,7 @@ struct hc_driver {
struct usb_device *udev, struct usb_host_endpoint *ep);
dma_addr_t (*get_dcba_dma_addr)(struct usb_hcd *hcd,
struct usb_device *udev);
+ int (*get_core_id)(struct usb_hcd *hcd);
};
static inline int hcd_giveback_urb_in_bh(struct usb_hcd *hcd)
@@ -454,6 +455,7 @@ extern dma_addr_t usb_hcd_get_dcba_dma_addr(struct usb_device *udev);
extern dma_addr_t
usb_hcd_get_xfer_ring_dma_addr(struct usb_device *udev,
struct usb_host_endpoint *ep);
+extern int usb_hcd_get_controller_id(struct usb_device *udev);
extern struct usb_hcd *usb_create_hcd(const struct hc_driver *driver,
struct device *dev, const char *bus_name);