diff options
author | Paul Zimmerman <Paul.Zimmerman@synopsys.com> | 2011-09-30 03:58:42 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-10-04 13:25:52 -0400 |
commit | b23c843992b659d537514e6493d673284f5d6724 (patch) | |
tree | d5bec8c89888dd1d4b6ea58ec39211d92a1528e3 /drivers | |
parent | 49a25cc9a7effe2993e65229c2ea0be726919bcf (diff) |
usb: dwc3: gadget: fix DEPSTARTCFG for non-EP0 EPs
DEPSTARTCFG for non-EP0 EPs must only be sent once per config
[ balbi@ti.com : changed config_start to start_config_issued ]
Signed-off-by: Paul Zimmerman <paulz@synopsys.com>
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/core.h | 2 | ||||
-rw-r--r-- | drivers/usb/dwc3/ep0.c | 1 | ||||
-rw-r--r-- | drivers/usb/dwc3/gadget.c | 10 |
3 files changed, 12 insertions, 1 deletions
diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index 0231eba1f53d..502582ce1fc6 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h | |||
@@ -529,6 +529,7 @@ static inline void dwc3_trb_to_nat(struct dwc3_trb_hw *hw, struct dwc3_trb *nat) | |||
529 | * @ep0_status_pending: ep0 status response without a req is pending | 529 | * @ep0_status_pending: ep0 status response without a req is pending |
530 | * @ep0_bounced: true when we used bounce buffer | 530 | * @ep0_bounced: true when we used bounce buffer |
531 | * @ep0_expect_in: true when we expect a DATA IN transfer | 531 | * @ep0_expect_in: true when we expect a DATA IN transfer |
532 | * @start_config_issued: true when StartConfig command has been issued | ||
532 | * @ep0_next_event: hold the next expected event | 533 | * @ep0_next_event: hold the next expected event |
533 | * @ep0state: state of endpoint zero | 534 | * @ep0state: state of endpoint zero |
534 | * @link_state: link state | 535 | * @link_state: link state |
@@ -576,6 +577,7 @@ struct dwc3 { | |||
576 | unsigned ep0_status_pending:1; | 577 | unsigned ep0_status_pending:1; |
577 | unsigned ep0_bounced:1; | 578 | unsigned ep0_bounced:1; |
578 | unsigned ep0_expect_in:1; | 579 | unsigned ep0_expect_in:1; |
580 | unsigned start_config_issued:1; | ||
579 | 581 | ||
580 | enum dwc3_ep0_next ep0_next_event; | 582 | enum dwc3_ep0_next ep0_next_event; |
581 | enum dwc3_ep0_state ep0state; | 583 | enum dwc3_ep0_state ep0state; |
diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c index cc27c4ec498d..2def48ed30ea 100644 --- a/drivers/usb/dwc3/ep0.c +++ b/drivers/usb/dwc3/ep0.c | |||
@@ -455,6 +455,7 @@ static int dwc3_ep0_set_config(struct dwc3 *dwc, struct usb_ctrlrequest *ctrl) | |||
455 | u32 cfg; | 455 | u32 cfg; |
456 | int ret; | 456 | int ret; |
457 | 457 | ||
458 | dwc->start_config_issued = false; | ||
458 | cfg = le16_to_cpu(ctrl->wValue); | 459 | cfg = le16_to_cpu(ctrl->wValue); |
459 | 460 | ||
460 | switch (dwc->dev_state) { | 461 | switch (dwc->dev_state) { |
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index b2820aa9fa46..9c0174a8f46c 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c | |||
@@ -237,8 +237,12 @@ static int dwc3_gadget_start_config(struct dwc3 *dwc, struct dwc3_ep *dep) | |||
237 | if (dep->number != 1) { | 237 | if (dep->number != 1) { |
238 | cmd = DWC3_DEPCMD_DEPSTARTCFG; | 238 | cmd = DWC3_DEPCMD_DEPSTARTCFG; |
239 | /* XferRscIdx == 0 for ep0 and 2 for the remaining */ | 239 | /* XferRscIdx == 0 for ep0 and 2 for the remaining */ |
240 | if (dep->number > 1) | 240 | if (dep->number > 1) { |
241 | if (dwc->start_config_issued) | ||
242 | return 0; | ||
243 | dwc->start_config_issued = true; | ||
241 | cmd |= DWC3_DEPCMD_PARAM(2); | 244 | cmd |= DWC3_DEPCMD_PARAM(2); |
245 | } | ||
242 | 246 | ||
243 | return dwc3_send_gadget_ep_cmd(dwc, 0, cmd, ¶ms); | 247 | return dwc3_send_gadget_ep_cmd(dwc, 0, cmd, ¶ms); |
244 | } | 248 | } |
@@ -1161,6 +1165,8 @@ static int dwc3_gadget_start(struct usb_gadget *g, | |||
1161 | reg |= DWC3_DCFG_SUPERSPEED; | 1165 | reg |= DWC3_DCFG_SUPERSPEED; |
1162 | dwc3_writel(dwc->regs, DWC3_DCFG, reg); | 1166 | dwc3_writel(dwc->regs, DWC3_DCFG, reg); |
1163 | 1167 | ||
1168 | dwc->start_config_issued = false; | ||
1169 | |||
1164 | /* Start with SuperSpeed Default */ | 1170 | /* Start with SuperSpeed Default */ |
1165 | dwc3_gadget_ep0_desc.wMaxPacketSize = cpu_to_le16(512); | 1171 | dwc3_gadget_ep0_desc.wMaxPacketSize = cpu_to_le16(512); |
1166 | 1172 | ||
@@ -1592,6 +1598,7 @@ static void dwc3_gadget_disconnect_interrupt(struct dwc3 *dwc) | |||
1592 | 1598 | ||
1593 | dwc3_stop_active_transfers(dwc); | 1599 | dwc3_stop_active_transfers(dwc); |
1594 | dwc3_disconnect_gadget(dwc); | 1600 | dwc3_disconnect_gadget(dwc); |
1601 | dwc->start_config_issued = false; | ||
1595 | 1602 | ||
1596 | dwc->gadget.speed = USB_SPEED_UNKNOWN; | 1603 | dwc->gadget.speed = USB_SPEED_UNKNOWN; |
1597 | } | 1604 | } |
@@ -1643,6 +1650,7 @@ static void dwc3_gadget_reset_interrupt(struct dwc3 *dwc) | |||
1643 | 1650 | ||
1644 | dwc3_stop_active_transfers(dwc); | 1651 | dwc3_stop_active_transfers(dwc); |
1645 | dwc3_clear_stall_all_ep(dwc); | 1652 | dwc3_clear_stall_all_ep(dwc); |
1653 | dwc->start_config_issued = false; | ||
1646 | 1654 | ||
1647 | /* Reset device address to zero */ | 1655 | /* Reset device address to zero */ |
1648 | reg = dwc3_readl(dwc->regs, DWC3_DCFG); | 1656 | reg = dwc3_readl(dwc->regs, DWC3_DCFG); |