Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

xhci: Platform: Set xhci lpm support quirk based on platform data

If an xhci platform supports USB3 LPM capability then enable
XHCI_LPM_SUPPORT quirk flag.

Signed-off-by: Pratyush Anand <pratyush.anand@st.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Pratyush Anand and committed by
Greg Kroah-Hartman
20f6fdd0 94ef3d50

+35 -1
+2 -1
Documentation/devicetree/bindings/usb/usb-xhci.txt
··· 9 9 register set for the device. 10 10 - interrupts: one XHCI interrupt should be described here. 11 11 12 - Optional property: 12 + Optional properties: 13 13 - clocks: reference to a clock 14 + - usb3-lpm-capable: determines if platform is USB3 LPM capable 14 15 15 16 Example: 16 17 usb@f0931000 {
+6
drivers/usb/host/xhci-plat.c
··· 17 17 #include <linux/of.h> 18 18 #include <linux/platform_device.h> 19 19 #include <linux/slab.h> 20 + #include <linux/usb/xhci_pdriver.h> 20 21 21 22 #include "xhci.h" 22 23 #include "xhci-mvebu.h" ··· 98 97 99 98 static int xhci_plat_probe(struct platform_device *pdev) 100 99 { 100 + struct device_node *node = pdev->dev.of_node; 101 + struct usb_xhci_pdata *pdata = dev_get_platdata(&pdev->dev); 101 102 const struct hc_driver *driver; 102 103 struct xhci_hcd *xhci; 103 104 struct resource *res; ··· 188 185 goto dealloc_usb2_hcd; 189 186 } 190 187 188 + if ((node && of_property_read_bool(node, "usb3-lpm-capable")) || 189 + (pdata && pdata->usb3_lpm_capable)) 190 + xhci->quirks |= XHCI_LPM_SUPPORT; 191 191 /* 192 192 * Set the xHCI pointer before xhci_plat_setup() (aka hcd_driver.reset) 193 193 * is called by usb_add_hcd().
+27
include/linux/usb/xhci_pdriver.h
··· 1 + /* 2 + * This program is free software; you can redistribute it and/or modify 3 + * it under the terms of the GNU General Public License version 2 as 4 + * published by the Free Software Foundation. 5 + * 6 + * This program is distributed in the hope that it will be useful, but 7 + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 8 + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 9 + * for more details. 10 + * 11 + */ 12 + 13 + #ifndef __USB_CORE_XHCI_PDRIVER_H 14 + #define __USB_CORE_XHCI_PDRIVER_H 15 + 16 + /** 17 + * struct usb_xhci_pdata - platform_data for generic xhci platform driver 18 + * 19 + * @usb3_lpm_capable: determines if this xhci platform supports USB3 20 + * LPM capability 21 + * 22 + */ 23 + struct usb_xhci_pdata { 24 + unsigned usb3_lpm_capable:1; 25 + }; 26 + 27 + #endif /* __USB_CORE_XHCI_PDRIVER_H */