usb: dwc3: drop EP0_STALL state
authorFelipe Balbi <balbi@ti.com>
Tue, 30 Aug 2011 12:48:08 +0000 (15:48 +0300)
committerFelipe Balbi <balbi@ti.com>
Fri, 9 Sep 2011 10:02:17 +0000 (13:02 +0300)
Whenever we issue a Set Stall command on EP0,
the state machine will be restarted and Stall
is cleared automatically, when core receives
the next SETUP packet.

There's no need to track that EP0_STALL state.

Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/dwc3/core.h
drivers/usb/dwc3/ep0.c
drivers/usb/dwc3/gadget.c

index 6c1ff7a58fcb52572ab3d33c93d981b3e31434c7..72388d8eda3241085ae4074989ec81087763bab1 100644 (file)
@@ -375,7 +375,6 @@ enum dwc3_ep0_state {
        EP0_SETUP_PHASE,
        EP0_DATA_PHASE,
        EP0_STATUS_PHASE,
-       EP0_STALL,
 };
 
 enum dwc3_link_state {
index 618a29e113230b517a0a09691f0d85221017385a..045c278274a528569e042cd3b44073ce5dc71b4f 100644 (file)
@@ -68,8 +68,6 @@ static const char *dwc3_ep0_state_string(enum dwc3_ep0_state state)
                return "Data Phase";
        case EP0_STATUS_PHASE:
                return "Status Phase";
-       case EP0_STALL:
-               return "Stall";
        default:
                return "UNKNOWN";
        }
index b5d95f8329f2b8b54df219a140c0a6dd81d81794..0c934a195deb86ec1915a92bfddd25c8fea5436d 100644 (file)
@@ -872,8 +872,14 @@ int __dwc3_gadget_ep_set_halt(struct dwc3_ep *dep, int value)
        memset(&params, 0x00, sizeof(params));
 
        if (value) {
-               if (dep->number == 0 || dep->number == 1)
-                       dwc->ep0state = EP0_STALL;
+               if (dep->number == 0 || dep->number == 1) {
+                       /*
+                        * Whenever EP0 is stalled, we will restart
+                        * the state machine, thus moving back to
+                        * Setup Phase
+                        */
+                       dwc->ep0state = EP0_SETUP_PHASE;
+               }
 
                ret = dwc3_send_gadget_ep_cmd(dwc, dep->number,
                        DWC3_DEPCMD_SETSTALL, &params);