summaryrefslogtreecommitdiffstats
path: root/drivers/usb/dwc3
diff options
context:
space:
mode:
authorThinh Nguyen <Thinh.Nguyen@synopsys.com>2018-03-16 23:35:57 +0100
committerFelipe Balbi <felipe.balbi@linux.intel.com>2018-03-22 09:49:03 +0100
commit2f3090c6a8f24d92ea569b099c5bdb5679dcf08a (patch)
treeaab75bfe05c3e940ebbbafec042dbb7b90dce337 /drivers/usb/dwc3
parentusb: dwc3: Dump LSP and BMU debug info (diff)
downloadlinux-2f3090c6a8f24d92ea569b099c5bdb5679dcf08a.tar.xz
linux-2f3090c6a8f24d92ea569b099c5bdb5679dcf08a.zip
usb: dwc3: Check controller type before setting speed
DWC_usb3 speed can only be set up to SuperSpeed. Limit the setting to SuperSpeed only should the value be higher. Otherwise, the controller will read an invalid speed value and set the device to an incorrect speed. Signed-off-by: Thinh Nguyen <thinhn@synopsys.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Diffstat (limited to 'drivers/usb/dwc3')
-rw-r--r--drivers/usb/dwc3/gadget.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 19cf9c0eef12..550ee952c0d1 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -2044,7 +2044,10 @@ static void dwc3_gadget_set_speed(struct usb_gadget *g,
reg |= DWC3_DCFG_SUPERSPEED;
break;
case USB_SPEED_SUPER_PLUS:
- reg |= DWC3_DCFG_SUPERSPEED_PLUS;
+ if (dwc3_is_usb31(dwc))
+ reg |= DWC3_DCFG_SUPERSPEED_PLUS;
+ else
+ reg |= DWC3_DCFG_SUPERSPEED;
break;
default:
dev_err(dwc->dev, "invalid speed (%d)\n", speed);