xhci: Platform: Set xhci lpm support quirk based on platform data
authorPratyush Anand <pratyush.anand@st.com>
Fri, 4 Jul 2014 14:01:25 +0000 (17:01 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 9 Jul 2014 22:41:34 +0000 (15:41 -0700)
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>
Documentation/devicetree/bindings/usb/usb-xhci.txt
drivers/usb/host/xhci-plat.c
include/linux/usb/xhci_pdriver.h [new file with mode: 0644]

index 5a79377c6a96191f75ddfb30df2b523ecec72a55..86f67f0886bc4ea577e2847a9a97289ab077b62d 100644 (file)
@@ -9,8 +9,9 @@ Required properties:
     register set for the device.
   - interrupts: one XHCI interrupt should be described here.
 
-Optional property:
+Optional properties:
   - clocks: reference to a clock
+  - usb3-lpm-capable: determines if platform is USB3 LPM capable
 
 Example:
        usb@f0931000 {
index a4ccd0eb793e538bfd6b41923d77621cc826844c..b17459d3fcc8039e2d63065cca31acf958b5f179 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/slab.h>
+#include <linux/usb/xhci_pdriver.h>
 
 #include "xhci.h"
 #include "xhci-mvebu.h"
@@ -97,6 +98,8 @@ static const struct hc_driver xhci_plat_xhci_driver = {
 
 static int xhci_plat_probe(struct platform_device *pdev)
 {
+       struct device_node      *node = pdev->dev.of_node;
+       struct usb_xhci_pdata   *pdata = dev_get_platdata(&pdev->dev);
        const struct hc_driver  *driver;
        struct xhci_hcd         *xhci;
        struct resource         *res;
@@ -185,6 +188,9 @@ static int xhci_plat_probe(struct platform_device *pdev)
                goto dealloc_usb2_hcd;
        }
 
+       if ((node && of_property_read_bool(node, "usb3-lpm-capable")) ||
+                       (pdata && pdata->usb3_lpm_capable))
+               xhci->quirks |= XHCI_LPM_SUPPORT;
        /*
         * Set the xHCI pointer before xhci_plat_setup() (aka hcd_driver.reset)
         * is called by usb_add_hcd().
diff --git a/include/linux/usb/xhci_pdriver.h b/include/linux/usb/xhci_pdriver.h
new file mode 100644 (file)
index 0000000..376654b
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ *
+ */
+
+#ifndef __USB_CORE_XHCI_PDRIVER_H
+#define __USB_CORE_XHCI_PDRIVER_H
+
+/**
+ * struct usb_xhci_pdata - platform_data for generic xhci platform driver
+ *
+ * @usb3_lpm_capable:  determines if this xhci platform supports USB3
+ *                     LPM capability
+ *
+ */
+struct usb_xhci_pdata {
+       unsigned        usb3_lpm_capable:1;
+};
+
+#endif /* __USB_CORE_XHCI_PDRIVER_H */