aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorFelipe Balbi <balbi@ti.com>2011-09-30 03:58:36 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2011-10-04 13:25:50 -0400
commit2646021e1d5235c6c2143d27405fb057e5560d2b (patch)
treeec5d96210bd7f8f364d505aa02d97077f5025ad0 /drivers
parent5b253d88cc6c65a23cefc457a5a4ef139913c5fc (diff)
usb: dwc3: ep0: Make USB30CV happy with SetAddress
According to USB 3.0 Specification, a SetAddress() while device is in Configured State has an unspecified behavior (see Section 9.4.6). Still USB30CV wasn't happy with my Stall reply. To make that thing happy, just accept the SetAddress() always. No problems have been observed thus far. Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/dwc3/ep0.c31
1 files changed, 9 insertions, 22 deletions
diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c
index b66d96905728..e058961a547c 100644
--- a/drivers/usb/dwc3/ep0.c
+++ b/drivers/usb/dwc3/ep0.c
@@ -421,7 +421,6 @@ static int dwc3_ep0_handle_feature(struct dwc3 *dwc,
421 421
422static int dwc3_ep0_set_address(struct dwc3 *dwc, struct usb_ctrlrequest *ctrl) 422static int dwc3_ep0_set_address(struct dwc3 *dwc, struct usb_ctrlrequest *ctrl)
423{ 423{
424 int ret = 0;
425 u32 addr; 424 u32 addr;
426 u32 reg; 425 u32 reg;
427 426
@@ -429,29 +428,17 @@ static int dwc3_ep0_set_address(struct dwc3 *dwc, struct usb_ctrlrequest *ctrl)
429 if (addr > 127) 428 if (addr > 127)
430 return -EINVAL; 429 return -EINVAL;
431 430
432 switch (dwc->dev_state) { 431 reg = dwc3_readl(dwc->regs, DWC3_DCFG);
433 case DWC3_DEFAULT_STATE: 432 reg &= ~(DWC3_DCFG_DEVADDR_MASK);
434 case DWC3_ADDRESS_STATE: 433 reg |= DWC3_DCFG_DEVADDR(addr);
435 /* 434 dwc3_writel(dwc->regs, DWC3_DCFG, reg);
436 * Not sure if we should program DevAddr now or later
437 */
438 reg = dwc3_readl(dwc->regs, DWC3_DCFG);
439 reg &= ~(DWC3_DCFG_DEVADDR_MASK);
440 reg |= DWC3_DCFG_DEVADDR(addr);
441 dwc3_writel(dwc->regs, DWC3_DCFG, reg);
442
443 if (addr)
444 dwc->dev_state = DWC3_ADDRESS_STATE;
445 else
446 dwc->dev_state = DWC3_DEFAULT_STATE;
447 break;
448 435
449 case DWC3_CONFIGURED_STATE: 436 if (addr)
450 ret = -EINVAL; 437 dwc->dev_state = DWC3_ADDRESS_STATE;
451 break; 438 else
452 } 439 dwc->dev_state = DWC3_DEFAULT_STATE;
453 440
454 return ret; 441 return 0;
455} 442}
456 443
457static int dwc3_ep0_delegate_req(struct dwc3 *dwc, struct usb_ctrlrequest *ctrl) 444static int dwc3_ep0_delegate_req(struct dwc3 *dwc, struct usb_ctrlrequest *ctrl)