]> git.karo-electronics.de Git - linux-beck.git/commitdiff
usb: dwc3: gadget: fix DEPSTARTCFG for non-EP0 EPs
authorPaul Zimmerman <Paul.Zimmerman@synopsys.com>
Fri, 30 Sep 2011 07:58:42 +0000 (10:58 +0300)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 4 Oct 2011 17:25:52 +0000 (10:25 -0700)
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>
drivers/usb/dwc3/core.h
drivers/usb/dwc3/ep0.c
drivers/usb/dwc3/gadget.c

index 0231eba1f53df78c478d1055cda04ca1af0b9f48..502582ce1fc68603895f56ee7b5d5972b02dfeb5 100644 (file)
@@ -529,6 +529,7 @@ static inline void dwc3_trb_to_nat(struct dwc3_trb_hw *hw, struct dwc3_trb *nat)
  * @ep0_status_pending: ep0 status response without a req is pending
  * @ep0_bounced: true when we used bounce buffer
  * @ep0_expect_in: true when we expect a DATA IN transfer
+ * @start_config_issued: true when StartConfig command has been issued
  * @ep0_next_event: hold the next expected event
  * @ep0state: state of endpoint zero
  * @link_state: link state
@@ -576,6 +577,7 @@ struct dwc3 {
        unsigned                ep0_status_pending:1;
        unsigned                ep0_bounced:1;
        unsigned                ep0_expect_in:1;
+       unsigned                start_config_issued:1;
 
        enum dwc3_ep0_next      ep0_next_event;
        enum dwc3_ep0_state     ep0state;
index cc27c4ec498dd8132051dd1df6423dcbdf9596c3..2def48ed30eae597efcf0d1e4f2529589df35210 100644 (file)
@@ -455,6 +455,7 @@ static int dwc3_ep0_set_config(struct dwc3 *dwc, struct usb_ctrlrequest *ctrl)
        u32 cfg;
        int ret;
 
+       dwc->start_config_issued = false;
        cfg = le16_to_cpu(ctrl->wValue);
 
        switch (dwc->dev_state) {
index b2820aa9fa467c1c037ab3165c132283d0205e33..9c0174a8f46c16db0180903b331e45e45408442a 100644 (file)
@@ -237,8 +237,12 @@ static int dwc3_gadget_start_config(struct dwc3 *dwc, struct dwc3_ep *dep)
        if (dep->number != 1) {
                cmd = DWC3_DEPCMD_DEPSTARTCFG;
                /* XferRscIdx == 0 for ep0 and 2 for the remaining */
-               if (dep->number > 1)
+               if (dep->number > 1) {
+                       if (dwc->start_config_issued)
+                               return 0;
+                       dwc->start_config_issued = true;
                        cmd |= DWC3_DEPCMD_PARAM(2);
+               }
 
                return dwc3_send_gadget_ep_cmd(dwc, 0, cmd, &params);
        }
@@ -1161,6 +1165,8 @@ static int dwc3_gadget_start(struct usb_gadget *g,
        reg |= DWC3_DCFG_SUPERSPEED;
        dwc3_writel(dwc->regs, DWC3_DCFG, reg);
 
+       dwc->start_config_issued = false;
+
        /* Start with SuperSpeed Default */
        dwc3_gadget_ep0_desc.wMaxPacketSize = cpu_to_le16(512);
 
@@ -1592,6 +1598,7 @@ static void dwc3_gadget_disconnect_interrupt(struct dwc3 *dwc)
 
        dwc3_stop_active_transfers(dwc);
        dwc3_disconnect_gadget(dwc);
+       dwc->start_config_issued = false;
 
        dwc->gadget.speed = USB_SPEED_UNKNOWN;
 }
@@ -1643,6 +1650,7 @@ static void dwc3_gadget_reset_interrupt(struct dwc3 *dwc)
 
        dwc3_stop_active_transfers(dwc);
        dwc3_clear_stall_all_ep(dwc);
+       dwc->start_config_issued = false;
 
        /* Reset device address to zero */
        reg = dwc3_readl(dwc->regs, DWC3_DCFG);