]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
usb: dwc3: Set default mode for dwc_usb31
authorThinh Nguyen <Thinh.Nguyen@synopsys.com>
Thu, 26 Jul 2018 20:52:11 +0000 (13:52 -0700)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Mon, 30 Jul 2018 07:39:17 +0000 (10:39 +0300)
dwc_usb31 does not support OTG mode. If the controller supports DRD but
the dr_mode is not specified or set to OTG, then set the mode to
peripheral.

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

index 21e4931d0cc036ed04c617e76ff2141061bd92ed..64ba664d467c295b856dd14c10b0b60c650afdf9 100644 (file)
@@ -78,6 +78,14 @@ static int dwc3_get_dr_mode(struct dwc3 *dwc)
                        mode = USB_DR_MODE_HOST;
                else if (IS_ENABLED(CONFIG_USB_DWC3_GADGET))
                        mode = USB_DR_MODE_PERIPHERAL;
+
+               /*
+                * dwc_usb31 does not support OTG mode. If the controller
+                * supports DRD but the dr_mode is not specified or set to OTG,
+                * then set the mode to peripheral.
+                */
+               if (mode == USB_DR_MODE_OTG && dwc3_is_usb31(dwc))
+                       mode = USB_DR_MODE_PERIPHERAL;
        }
 
        if (mode != dwc->dr_mode) {