return 0;
}
+static void dwc3_stop_active_transfer(struct dwc3 *dwc, u32 epnum, bool force);
+static int __dwc3_gadget_kick_transfer(struct dwc3_ep *dep, u16 cmd_param);
+static void stream_timeout_function(unsigned long arg)
+{
+ struct dwc3_ep *dep = (struct dwc3_ep *)arg;
+ struct dwc3 *dwc = dep->dwc;
+ unsigned long flags;
+
+ spin_lock_irqsave(&dwc->lock, flags);
+ dwc3_stop_active_transfer(dwc, dep->number, true);
+ __dwc3_gadget_kick_transfer(dep, 0);
+ spin_unlock_irqrestore(&dwc->lock, flags);
+}
+
static int dwc3_gadget_set_ep_config(struct dwc3 *dwc, struct dwc3_ep *dep,
const struct usb_endpoint_descriptor *desc,
const struct usb_ss_ep_comp_descriptor *comp_desc,
| DWC3_DEPCFG_STREAM_EVENT_EN
| DWC3_DEPCFG_XFER_COMPLETE_EN;
dep->stream_capable = true;
+ setup_timer(&dep->stream_timeout_timer,
+ stream_timeout_function, (unsigned long)dep);
}
if (!usb_endpoint_xfer_control(desc))
dwc3_trace(trace_dwc3_gadget, "Disabling %s", dep->name);
+ if (dep->stream_capable)
+ del_timer(&dep->stream_timeout_timer);
+
dwc3_remove_requests(dwc, dep);
/* make sure HW endpoint isn't stalled */
dep->flags |= DWC3_EP_BUSY;
if (starting) {
+ if (dep->stream_capable) {
+ dep->stream_timeout_timer.expires = jiffies +
+ msecs_to_jiffies(STREAM_TIMEOUT);
+ add_timer(&dep->stream_timeout_timer);
+ }
dep->resource_index = dwc3_gadget_ep_get_transfer_index(dep);
WARN_ON_ONCE(!dep->resource_index);
}
switch (event->status) {
case DEPEVT_STREAMEVT_FOUND:
+ del_timer(&dep->stream_timeout_timer);
dwc3_trace(trace_dwc3_gadget,
"Stream %d found and started",
event->parameters);