]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
usb: dwc3: Set default mode for DWC_usb3 v3.30a and higher
authorThinh Nguyen <thinh.nguyen@synopsys.com>
Sat, 3 Nov 2018 01:41:42 +0000 (18:41 -0700)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Mon, 26 Nov 2018 07:06:32 +0000 (09:06 +0200)
DWC_usb31 and DWC_usb3 v3.30a and higher do 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
drivers/usb/dwc3/core.h

index 6acadd647dc3bce2cba7113cd01ead2aab7e4979..8f6d9c6f016e78fe302c901cece31169c7c070ad 100644 (file)
@@ -80,11 +80,12 @@ static int dwc3_get_dr_mode(struct dwc3 *dwc)
                        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.
+                * DWC_usb31 and DWC_usb3 v3.30a and higher do 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))
+               if (mode == USB_DR_MODE_OTG &&
+                   dwc->revision >= DWC3_REVISION_330A)
                        mode = USB_DR_MODE_PERIPHERAL;
        }
 
index 6a77cd0a0b01a3099a15657d072fefcaf9455799..eec4b9735fb79acdf68ea4cfe17d14ba36d2bcf7 100644 (file)
@@ -1107,6 +1107,7 @@ struct dwc3 {
 #define DWC3_REVISION_290A     0x5533290a
 #define DWC3_REVISION_300A     0x5533300a
 #define DWC3_REVISION_310A     0x5533310a
+#define DWC3_REVISION_330A     0x5533330a
 
 /*
  * NOTICE: we're using bit 31 as a "is usb 3.1" flag. This is really