dwc3: make LPM configurable in DT
authorRobert Baldyga <r.baldyga@samsung.com>
Mon, 9 Mar 2015 09:29:01 +0000 (10:29 +0100)
committerMarek Szyprowski <m.szyprowski@samsung.com>
Mon, 13 Apr 2015 10:44:39 +0000 (12:44 +0200)
LPM capability is hardware property, so now it's moved to DT.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Documentation/devicetree/bindings/usb/dwc3.txt
drivers/usb/dwc3/Kconfig
drivers/usb/dwc3/core.c
drivers/usb/dwc3/core.h
drivers/usb/dwc3/host.c
drivers/usb/dwc3/platform_data.h

index cd7f0454e13a9227ad512228e9c12bc76e2c7c07..5cc364309edbaa7fd1972172b8817a103739e8f5 100644 (file)
@@ -14,6 +14,7 @@ Optional properties:
  - phys: from the *Generic PHY* bindings
  - phy-names: from the *Generic PHY* bindings
  - tx-fifo-resize: determines if the FIFO *has* to be reallocated.
+ - snps,usb3_lpm_capable: determines if platform is USB3 LPM capable
  - snps,disable_scramble_quirk: true when SW should disable data scrambling.
        Only really useful for FPGA builds.
  - snps,has-lpm-erratum: true when DWC3 was configured with LPM Erratum enabled
index edbf9c85af7eddebc20c0cc76c2aea508d95d07b..827c4f80379f38d7ecfadfd60bb1f16e72c34fa4 100644 (file)
@@ -104,11 +104,4 @@ config USB_DWC3_DEBUG
        help
          Say Y here to enable debugging messages on DWC3 Driver.
 
-config DWC3_HOST_USB3_LPM_ENABLE
-       bool "Enable USB3 LPM Capability"
-       depends on USB_DWC3_HOST=y || USB_DWC3_DUAL_ROLE=y
-       default n
-       help
-         Select this when you want to enable USB3 LPM with dwc3 xhci host.
-
 endif
index 05b18ee5ffa5baf3f3aef9e78ceaf74f0a88be92..81b092ba5b85922c9431b5a9fc830093c11950fd 100644 (file)
@@ -808,6 +808,8 @@ static int dwc3_probe(struct platform_device *pdev)
                                "snps,is-utmi-l1-suspend");
                of_property_read_u8(node, "snps,hird-threshold",
                                &hird_threshold);
+               dwc->usb3_lpm_capable = of_property_read_bool(node,
+                               "snps,usb3_lpm_capable");
 
                dwc->needs_fifo_resize = of_property_read_bool(node,
                                "tx-fifo-resize");
@@ -848,6 +850,7 @@ static int dwc3_probe(struct platform_device *pdev)
                        hird_threshold = pdata->hird_threshold;
 
                dwc->needs_fifo_resize = pdata->tx_fifo_resize;
+               dwc->usb3_lpm_capable = pdata->usb3_lpm_capable;
                dwc->dr_mode = pdata->dr_mode;
 
                dwc->disable_scramble_quirk = pdata->disable_scramble_quirk;
index d201910b892f9f9d068cdb1dab74551c3904b11c..fdab715a063119d6e696a8f66ea26d4a1613e983 100644 (file)
@@ -689,6 +689,7 @@ struct dwc3_scratchpad_array {
  * @setup_packet_pending: true when there's a Setup Packet in FIFO. Workaround
  * @start_config_issued: true when StartConfig command has been issued
  * @three_stage_setup: set if we perform a three phase setup
+ * @usb3_lpm_capable: set if hadrware supports Link Power Management
  * @disable_scramble_quirk: set if we enable the disable scramble quirk
  * @u2exit_lfps_quirk: set if we enable u2exit lfps quirk
  * @u2ss_inp3_quirk: set if we enable P3 OK for U2/SS Inactive quirk
@@ -812,6 +813,7 @@ struct dwc3 {
        unsigned                setup_packet_pending:1;
        unsigned                start_config_issued:1;
        unsigned                three_stage_setup:1;
+       unsigned                usb3_lpm_capable:1;
 
        unsigned                disable_scramble_quirk:1;
        unsigned                u2exit_lfps_quirk:1;
index 12bfd3c5405e48c6225cfc7489fb747e1698d663..c679f63783aec8c1a0fe4e43bef80546a55abf44 100644 (file)
@@ -49,9 +49,7 @@ int dwc3_host_init(struct dwc3 *dwc)
 
        memset(&pdata, 0, sizeof(pdata));
 
-#ifdef CONFIG_DWC3_HOST_USB3_LPM_ENABLE
-       pdata.usb3_lpm_capable = 1;
-#endif
+       pdata.usb3_lpm_capable = dwc->usb3_lpm_capable;
 
        ret = platform_device_add_data(xhci, &pdata, sizeof(pdata));
        if (ret) {
index a3a3b6d5668cf47d9555e470500ca3cb0d25bbe7..a2bd464be828785975383a2f66a3b2cba39bf0ab 100644 (file)
@@ -24,6 +24,7 @@ struct dwc3_platform_data {
        enum usb_device_speed maximum_speed;
        enum usb_dr_mode dr_mode;
        bool tx_fifo_resize;
+       bool usb3_lpm_capable;
 
        unsigned is_utmi_l1_suspend:1;
        u8 hird_threshold;