usb: dwc3: Support option to disable USB2 LPM
authorThinh Nguyen <thinh.nguyen@synopsys.com>
Thu, 8 Nov 2018 02:10:42 +0000 (18:10 -0800)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Mon, 26 Nov 2018 07:06:31 +0000 (09:06 +0200)
Support the option to disable USB2 LPM. Set xhci "usb2-lpm-disable"
property via "snps,usb2-lpm-disable" property.

Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
drivers/usb/dwc3/core.c
drivers/usb/dwc3/core.h
drivers/usb/dwc3/host.c

index 077f60baa12d58cfd1ca0497a2292b022fe053c8..0807353f3b07625db95e1966e1dbf98718e88310 100644 (file)
@@ -1248,6 +1248,8 @@ static void dwc3_get_properties(struct dwc3 *dwc)
                                &hird_threshold);
        dwc->usb3_lpm_capable = device_property_read_bool(dev,
                                "snps,usb3_lpm_capable");
+       dwc->usb2_lpm_disable = device_property_read_bool(dev,
+                               "snps,usb2-lpm-disable");
        device_property_read_u8(dev, "snps,rx-thr-num-pkt-prd",
                                &rx_thr_num_pkt_prd);
        device_property_read_u8(dev, "snps,rx-max-burst-prd",
index 7b17bb6a353cae153ca53b901191f16f60409629..6a77cd0a0b01a3099a15657d072fefcaf9455799 100644 (file)
@@ -982,6 +982,7 @@ struct dwc3_scratchpad_array {
  * @setup_packet_pending: true when there's a Setup Packet in FIFO. Workaround
  * @three_stage_setup: set if we perform a three phase setup
  * @usb3_lpm_capable: set if hadrware supports Link Power Management
+ * @usb2_lpm_disable: set to disable usb2 lpm
  * @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
@@ -1159,6 +1160,7 @@ struct dwc3 {
        unsigned                setup_packet_pending:1;
        unsigned                three_stage_setup:1;
        unsigned                usb3_lpm_capable:1;
+       unsigned                usb2_lpm_disable:1;
 
        unsigned                disable_scramble_quirk:1;
        unsigned                u2exit_lfps_quirk:1;
index 1a3878a3be78f9b539ecb4c752945fa1abb6cb7f..f55947294f7cbbb23e4e619247ab279f3be3a851 100644 (file)
@@ -46,7 +46,7 @@ out:
 
 int dwc3_host_init(struct dwc3 *dwc)
 {
-       struct property_entry   props[3];
+       struct property_entry   props[4];
        struct platform_device  *xhci;
        int                     ret, irq;
        struct resource         *res;
@@ -93,6 +93,9 @@ int dwc3_host_init(struct dwc3 *dwc)
        if (dwc->usb3_lpm_capable)
                props[prop_idx++].name = "usb3-lpm-capable";
 
+       if (dwc->usb2_lpm_disable)
+               props[prop_idx++].name = "usb2-lpm-disable";
+
        /**
         * WORKAROUND: dwc3 revisions <=3.00a have a limitation
         * where Port Disable command doesn't work.