usb: dwc3: ep0: SetAddress() won't be issued while Configured
authorFelipe Balbi <balbi@ti.com>
Sat, 15 Oct 2011 18:37:35 +0000 (21:37 +0300)
committerFelipe Balbi <balbi@ti.com>
Mon, 12 Dec 2011 09:48:15 +0000 (11:48 +0200)
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>
drivers/usb/dwc3/ep0.c

index 69a4e43..24b447e 100644 (file)
@@ -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);