]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - drivers/usb/dwc3/gadget.c
usb: dwc3: Remove dev_err() on platform_get_irq() failure
[linux.git] / drivers / usb / dwc3 / gadget.c
index 173f5329d3d9ebed82b74b18f8cd789938b3630e..86dc1db788a9e5e02fa11b2564ed1c417f0b0d92 100644 (file)
@@ -2078,6 +2078,26 @@ static void dwc3_gadget_config_params(struct usb_gadget *g,
 {
        struct dwc3             *dwc = gadget_to_dwc(g);
 
+       params->besl_baseline = USB_DEFAULT_BESL_UNSPECIFIED;
+       params->besl_deep = USB_DEFAULT_BESL_UNSPECIFIED;
+
+       /* Recommended BESL */
+       if (!dwc->dis_enblslpm_quirk) {
+               /*
+                * If the recommended BESL baseline is 0 or if the BESL deep is
+                * less than 2, Microsoft's Windows 10 host usb stack will issue
+                * a usb reset immediately after it receives the extended BOS
+                * descriptor and the enumeration will fail. To maintain
+                * compatibility with the Windows' usb stack, let's set the
+                * recommended BESL baseline to 1 and clamp the BESL deep to be
+                * within 2 to 15.
+                */
+               params->besl_baseline = 1;
+               if (dwc->is_utmi_l1_suspend)
+                       params->besl_deep =
+                               clamp_t(u8, dwc->hird_threshold, 2, 15);
+       }
+
        /* U1 Device exit Latency */
        if (dwc->dis_u1_entry_quirk)
                params->bU1devExitLat = 0;
@@ -2868,7 +2888,8 @@ static void dwc3_gadget_conndone_interrupt(struct dwc3 *dwc)
                reg = dwc3_readl(dwc->regs, DWC3_DCTL);
                reg &= ~(DWC3_DCTL_HIRD_THRES_MASK | DWC3_DCTL_L1_HIBER_EN);
 
-               reg |= DWC3_DCTL_HIRD_THRES(dwc->hird_threshold);
+               reg |= DWC3_DCTL_HIRD_THRES(dwc->hird_threshold |
+                                           (dwc->is_utmi_l1_suspend << 4));
 
                /*
                 * When dwc3 revisions >= 2.40a, LPM Erratum is enabled and
@@ -3243,14 +3264,14 @@ static int dwc3_gadget_get_irq(struct dwc3 *dwc)
        struct platform_device *dwc3_pdev = to_platform_device(dwc->dev);
        int irq;
 
-       irq = platform_get_irq_byname(dwc3_pdev, "peripheral");
+       irq = platform_get_irq_byname_optional(dwc3_pdev, "peripheral");
        if (irq > 0)
                goto out;
 
        if (irq == -EPROBE_DEFER)
                goto out;
 
-       irq = platform_get_irq_byname(dwc3_pdev, "dwc_usb3");
+       irq = platform_get_irq_byname_optional(dwc3_pdev, "dwc_usb3");
        if (irq > 0)
                goto out;
 
@@ -3261,9 +3282,6 @@ static int dwc3_gadget_get_irq(struct dwc3 *dwc)
        if (irq > 0)
                goto out;
 
-       if (irq != -EPROBE_DEFER)
-               dev_err(dwc->dev, "missing peripheral IRQ\n");
-
        if (!irq)
                irq = -EINVAL;
 
@@ -3318,7 +3336,6 @@ int dwc3_gadget_init(struct dwc3 *dwc)
        dwc->gadget.speed               = USB_SPEED_UNKNOWN;
        dwc->gadget.sg_supported        = true;
        dwc->gadget.name                = "dwc3-gadget";
-       dwc->gadget.is_otg              = dwc->dr_mode == USB_DR_MODE_OTG;
        dwc->gadget.lpm_capable         = true;
 
        /*