summaryrefslogtreecommitdiffstats
path: root/drivers/usb/dwc3/core.c
diff options
context:
space:
mode:
authorThinh Nguyen <Thinh.Nguyen@synopsys.com>2018-07-26 13:52:11 -0700
committerFelipe Balbi <felipe.balbi@linux.intel.com>2018-07-30 10:39:17 +0300
commita77004681148f5773c20370812ca7d14443fb091 (patch)
tree874050fa182af9f7df33d59c845863ed4750daa9 /drivers/usb/dwc3/core.c
parent39facfa01c9fc64f90233d1734882f0a0cafe36a (diff)
downloadblackbird-op-linux-a77004681148f5773c20370812ca7d14443fb091.tar.gz
blackbird-op-linux-a77004681148f5773c20370812ca7d14443fb091.zip
usb: dwc3: Set default mode for dwc_usb31
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>
Diffstat (limited to 'drivers/usb/dwc3/core.c')
-rw-r--r--drivers/usb/dwc3/core.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 21e4931d0cc0..64ba664d467c 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -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) {
OpenPOWER on IntegriCloud