Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 265044
b: refs/heads/master
c: 2646021
h: refs/heads/master
v: v3
  • Loading branch information
Felipe Balbi authored and Greg Kroah-Hartman committed Oct 4, 2011
1 parent 932736f commit 9026179
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 23 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5b253d88cc6c65a23cefc457a5a4ef139913c5fc
refs/heads/master: 2646021e1d5235c6c2143d27405fb057e5560d2b
31 changes: 9 additions & 22 deletions trunk/drivers/usb/dwc3/ep0.c
Original file line number Diff line number Diff line change
Expand Up @@ -421,37 +421,24 @@ static int dwc3_ep0_handle_feature(struct dwc3 *dwc,

static int dwc3_ep0_set_address(struct dwc3 *dwc, struct usb_ctrlrequest *ctrl)
{
int ret = 0;
u32 addr;
u32 reg;

addr = le16_to_cpu(ctrl->wValue);
if (addr > 127)
return -EINVAL;

switch (dwc->dev_state) {
case DWC3_DEFAULT_STATE:
case DWC3_ADDRESS_STATE:
/*
* Not sure if we should program DevAddr now or later
*/
reg = dwc3_readl(dwc->regs, DWC3_DCFG);
reg &= ~(DWC3_DCFG_DEVADDR_MASK);
reg |= DWC3_DCFG_DEVADDR(addr);
dwc3_writel(dwc->regs, DWC3_DCFG, reg);

if (addr)
dwc->dev_state = DWC3_ADDRESS_STATE;
else
dwc->dev_state = DWC3_DEFAULT_STATE;
break;
reg = dwc3_readl(dwc->regs, DWC3_DCFG);
reg &= ~(DWC3_DCFG_DEVADDR_MASK);
reg |= DWC3_DCFG_DEVADDR(addr);
dwc3_writel(dwc->regs, DWC3_DCFG, reg);

case DWC3_CONFIGURED_STATE:
ret = -EINVAL;
break;
}
if (addr)
dwc->dev_state = DWC3_ADDRESS_STATE;
else
dwc->dev_state = DWC3_DEFAULT_STATE;

return ret;
return 0;
}

static int dwc3_ep0_delegate_req(struct dwc3 *dwc, struct usb_ctrlrequest *ctrl)
Expand Down

0 comments on commit 9026179

Please sign in to comment.