summaryrefslogtreecommitdiffstats
path: root/drivers/usb/dwc3
diff options
context:
space:
mode:
authorFelipe Balbi <balbi@ti.com>2011-10-15 21:37:35 +0300
committerFelipe Balbi <balbi@ti.com>2011-12-12 11:48:15 +0200
commitf96a6ec1db1ac730b5a031f2c2f7fcc6b07459d8 (patch)
treeb46658f8343241909820f5bc915787003ebb917e /drivers/usb/dwc3
parentc4da177f1f5560dfaf2e057cbf85411cd65c5426 (diff)
downloadlinux-f96a6ec1db1ac730b5a031f2c2f7fcc6b07459d8.tar.bz2
usb: dwc3: ep0: SetAddress() won't be issued while Configured
I have talked to USB-IF about USB30CV issuing SetAddres() with a device on Configured state and they have agreed on changing USB30CV not to do so. Adding back the STALL reply in such case and while at that, also add a debugging message for an address which is too large. Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/dwc3')
-rw-r--r--drivers/usb/dwc3/ep0.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c
index 69a4e43ddf59..24b447e40bc7 100644
--- a/drivers/usb/dwc3/ep0.c
+++ b/drivers/usb/dwc3/ep0.c
@@ -422,8 +422,15 @@ static int dwc3_ep0_set_address(struct dwc3 *dwc, struct usb_ctrlrequest *ctrl)
u32 reg;
addr = le16_to_cpu(ctrl->wValue);
- if (addr > 127)
+ if (addr > 127) {
+ dev_dbg(dwc->dev, "invalid device address %d\n", addr);
return -EINVAL;
+ }
+
+ if (dwc->dev_state == DWC3_CONFIGURED_STATE) {
+ dev_dbg(dwc->dev, "trying to set address when configured\n");
+ return -EINVAL;
+ }
reg = dwc3_readl(dwc->regs, DWC3_DCFG);
reg &= ~(DWC3_DCFG_DEVADDR_MASK);