usb: dwc3: add dis_u3_autosuspend_quirk
[firefly-linux-kernel-4.4.55.git] / drivers / usb / dwc3 / core.c
index cc8f5abfac09a7e6c84c7aca0a62674d7fea24ed..db5f8e056d293c30cf73f5b20f3885e1b8ff7953 100644 (file)
@@ -689,6 +689,18 @@ static int dwc3_core_init(struct dwc3 *dwc)
                goto err4;
        }
 
+       switch (dwc->dr_mode) {
+       case USB_DR_MODE_PERIPHERAL:
+               dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_DEVICE);
+               break;
+       case USB_DR_MODE_HOST:
+               dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_HOST);
+               break;
+       default:
+               dev_dbg(dwc->dev, "Unsupported mode %d\n", dwc->dr_mode);
+               break;
+       }
+
        return 0;
 
 err4:
@@ -955,6 +967,8 @@ static int dwc3_probe(struct platform_device *pdev)
                                "snps,lfps_filter_quirk");
        dwc->rx_detect_poll_quirk = device_property_read_bool(dev,
                                "snps,rx_detect_poll_quirk");
+       dwc->dis_u3_autosuspend_quirk = device_property_read_bool(dev,
+                               "snps,dis-u3-autosuspend-quirk");
        dwc->dis_u3_susphy_quirk = device_property_read_bool(dev,
                                "snps,dis_u3_susphy_quirk");
        dwc->dis_u2_susphy_quirk = device_property_read_bool(dev,