summaryrefslogtreecommitdiffstats
path: root/drivers/usb/host
diff options
context:
space:
mode:
authorMathias Nyman <mathias.nyman@linux.intel.com>2018-05-21 09:39:54 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-05-24 12:03:08 -0400
commitffd4b4fc0b9a1526b64240676d309506b2d5eceb (patch)
tree37284cf5942cdcd852116aaef3d6da97bad299d4 /drivers/usb/host
parent9ea95ecc7ffd338a62972ddd6b0ac46bdc5e7d49 (diff)
xhci: Add helper to get xhci roothub from hcd
quick way to get the xhci roothub and thus all the ports belonging to a certain hcd Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/host')
-rw-r--r--drivers/usb/host/xhci-hub.c9
-rw-r--r--drivers/usb/host/xhci.h2
2 files changed, 11 insertions, 0 deletions
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
index 32cd52ca8318..b6fd26fa7faf 100644
--- a/drivers/usb/host/xhci-hub.c
+++ b/drivers/usb/host/xhci-hub.c
@@ -554,6 +554,15 @@ static int xhci_get_ports(struct usb_hcd *hcd, __le32 __iomem ***port_array)
554 return max_ports; 554 return max_ports;
555} 555}
556 556
557struct xhci_hub *xhci_get_rhub(struct usb_hcd *hcd)
558{
559 struct xhci_hcd *xhci = hcd_to_xhci(hcd);
560
561 if (hcd->speed >= HCD_USB3)
562 return &xhci->usb3_rhub;
563 return &xhci->usb2_rhub;
564}
565
557static __le32 __iomem *xhci_get_port_io_addr(struct usb_hcd *hcd, int index) 566static __le32 __iomem *xhci_get_port_io_addr(struct usb_hcd *hcd, int index)
558{ 567{
559 __le32 __iomem **port_array; 568 __le32 __iomem **port_array;
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index 38aa8a6777a8..cdf8e1adc06f 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -2110,6 +2110,8 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, u16 wIndex,
2110 char *buf, u16 wLength); 2110 char *buf, u16 wLength);
2111int xhci_hub_status_data(struct usb_hcd *hcd, char *buf); 2111int xhci_hub_status_data(struct usb_hcd *hcd, char *buf);
2112int xhci_find_raw_port_number(struct usb_hcd *hcd, int port1); 2112int xhci_find_raw_port_number(struct usb_hcd *hcd, int port1);
2113struct xhci_hub *xhci_get_rhub(struct usb_hcd *hcd);
2114
2113void xhci_hc_died(struct xhci_hcd *xhci); 2115void xhci_hc_died(struct xhci_hcd *xhci);
2114 2116
2115#ifdef CONFIG_PM 2117#ifdef CONFIG_PM