Lines Matching refs:dep

30 static void __dwc3_ep0_do_control_status(struct dwc3 *dwc, struct dwc3_ep *dep);
32 struct dwc3_ep *dep, struct dwc3_request *req);
55 struct dwc3_ep *dep; in dwc3_ep0_start_trans() local
59 dep = dwc->eps[epnum]; in dwc3_ep0_start_trans()
60 if (dep->flags & DWC3_EP_BUSY) { in dwc3_ep0_start_trans()
61 dev_vdbg(dwc->dev, "%s still busy", dep->name); in dwc3_ep0_start_trans()
65 trb = &dwc->ep0_trb[dep->free_slot]; in dwc3_ep0_start_trans()
68 dep->free_slot++; in dwc3_ep0_start_trans()
94 ret = dwc3_send_gadget_ep_cmd(dwc, dep->number, in dwc3_ep0_start_trans()
97 dev_dbg(dwc->dev, "%s STARTTRANSFER failed", dep->name); in dwc3_ep0_start_trans()
101 dep->flags |= DWC3_EP_BUSY; in dwc3_ep0_start_trans()
102 dep->resource_index = dwc3_gadget_ep_get_transfer_index(dwc, in dwc3_ep0_start_trans()
103 dep->number); in dwc3_ep0_start_trans()
110 static int __dwc3_gadget_ep0_queue(struct dwc3_ep *dep, in __dwc3_gadget_ep0_queue() argument
113 struct dwc3 *dwc = dep->dwc; in __dwc3_gadget_ep0_queue()
117 req->epnum = dep->number; in __dwc3_gadget_ep0_queue()
119 list_add_tail(&req->list, &dep->request_list); in __dwc3_gadget_ep0_queue()
130 if (dep->flags & DWC3_EP_PENDING_REQUEST) { in __dwc3_gadget_ep0_queue()
133 direction = !!(dep->flags & DWC3_EP0_DIR_IN); in __dwc3_gadget_ep0_queue()
142 dep->flags &= ~(DWC3_EP_PENDING_REQUEST | in __dwc3_gadget_ep0_queue()
207 dep->flags &= ~DWC3_EP0_DIR_IN; in __dwc3_gadget_ep0_queue()
217 struct dwc3_ep *dep = to_dwc3_ep(ep); in dwc3_gadget_ep0_queue() local
218 struct dwc3 *dwc = dep->dwc; in dwc3_gadget_ep0_queue()
225 if (!dep->endpoint.desc) { in dwc3_gadget_ep0_queue()
227 request, dep->name); in dwc3_gadget_ep0_queue()
233 if (!list_empty(&dep->request_list)) { in dwc3_gadget_ep0_queue()
239 request, dep->name, request->length, in dwc3_gadget_ep0_queue()
242 ret = __dwc3_gadget_ep0_queue(dep, req); in dwc3_gadget_ep0_queue()
252 struct dwc3_ep *dep; in dwc3_ep0_stall_and_restart() local
255 dep = dwc->eps[1]; in dwc3_ep0_stall_and_restart()
256 dep->flags = DWC3_EP_ENABLED; in dwc3_ep0_stall_and_restart()
259 dep = dwc->eps[0]; in dwc3_ep0_stall_and_restart()
260 __dwc3_gadget_ep_set_halt(dep, 1, false); in dwc3_ep0_stall_and_restart()
261 dep->flags = DWC3_EP_ENABLED; in dwc3_ep0_stall_and_restart()
264 if (!list_empty(&dep->request_list)) { in dwc3_ep0_stall_and_restart()
267 req = next_request(&dep->request_list); in dwc3_ep0_stall_and_restart()
268 dwc3_gadget_giveback(dep, req, -ECONNRESET); in dwc3_ep0_stall_and_restart()
277 struct dwc3_ep *dep = to_dwc3_ep(ep); in __dwc3_gadget_ep0_set_halt() local
278 struct dwc3 *dwc = dep->dwc; in __dwc3_gadget_ep0_set_halt()
308 struct dwc3_ep *dep; in dwc3_wIndex_to_dep() local
316 dep = dwc->eps[epnum]; in dwc3_wIndex_to_dep()
317 if (dep->flags & DWC3_EP_ENABLED) in dwc3_wIndex_to_dep()
318 return dep; in dwc3_wIndex_to_dep()
332 struct dwc3_ep *dep; in dwc3_ep0_handle_status() local
364 dep = dwc3_wIndex_to_dep(dwc, ctrl->wIndex); in dwc3_ep0_handle_status()
365 if (!dep) in dwc3_ep0_handle_status()
368 if (dep->flags & DWC3_EP_STALL) in dwc3_ep0_handle_status()
378 dep = dwc->eps[0]; in dwc3_ep0_handle_status()
379 dwc->ep0_usb_req.dep = dep; in dwc3_ep0_handle_status()
384 return __dwc3_gadget_ep0_queue(dep, &dwc->ep0_usb_req); in dwc3_ep0_handle_status()
390 struct dwc3_ep *dep; in dwc3_ep0_handle_feature() local
476 dep = dwc3_wIndex_to_dep(dwc, wIndex); in dwc3_ep0_handle_feature()
477 if (!dep) in dwc3_ep0_handle_feature()
479 if (set == 0 && (dep->flags & DWC3_EP_WEDGE)) in dwc3_ep0_handle_feature()
481 ret = __dwc3_gadget_ep_set_halt(dep, set, true); in dwc3_ep0_handle_feature()
596 struct dwc3_ep *dep = to_dwc3_ep(ep); in dwc3_ep0_set_sel_cmpl() local
597 struct dwc3 *dwc = dep->dwc; in dwc3_ep0_set_sel_cmpl()
640 struct dwc3_ep *dep; in dwc3_ep0_set_sel() local
663 dep = dwc->eps[0]; in dwc3_ep0_set_sel()
664 dwc->ep0_usb_req.dep = dep; in dwc3_ep0_set_sel()
665 dwc->ep0_usb_req.request.length = dep->endpoint.maxpacket; in dwc3_ep0_set_sel()
669 return __dwc3_gadget_ep0_queue(dep, &dwc->ep0_usb_req); in dwc3_ep0_set_sel()
870 struct dwc3_ep *dep; in dwc3_ep0_complete_status() local
874 dep = dwc->eps[0]; in dwc3_ep0_complete_status()
877 if (!list_empty(&dep->request_list)) { in dwc3_ep0_complete_status()
878 r = next_request(&dep->request_list); in dwc3_ep0_complete_status()
880 dwc3_gadget_giveback(dep, r, 0); in dwc3_ep0_complete_status()
906 struct dwc3_ep *dep = dwc->eps[event->endpoint_number]; in dwc3_ep0_xfer_complete() local
908 dep->flags &= ~DWC3_EP_BUSY; in dwc3_ep0_xfer_complete()
909 dep->resource_index = 0; in dwc3_ep0_xfer_complete()
933 struct dwc3_ep *dep, struct dwc3_request *req) in __dwc3_ep0_do_control_data() argument
937 req->direction = !!dep->number; in __dwc3_ep0_do_control_data()
940 ret = dwc3_ep0_start_trans(dwc, dep->number, in __dwc3_ep0_do_control_data()
943 } else if (!IS_ALIGNED(req->request.length, dep->endpoint.maxpacket) && in __dwc3_ep0_do_control_data()
944 (dep->number == 0)) { in __dwc3_ep0_do_control_data()
949 dep->number); in __dwc3_ep0_do_control_data()
955 maxpacket = dep->endpoint.maxpacket; in __dwc3_ep0_do_control_data()
959 ret = dwc3_ep0_start_trans(dwc, dep->number, in __dwc3_ep0_do_control_data()
975 ret = dwc3_ep0_start_trans(dwc, dep->number, in __dwc3_ep0_do_control_data()
980 dep->number); in __dwc3_ep0_do_control_data()
986 ret = dwc3_ep0_start_trans(dwc, dep->number, req->request.dma, in __dwc3_ep0_do_control_data()
994 static int dwc3_ep0_start_control_status(struct dwc3_ep *dep) in dwc3_ep0_start_control_status() argument
996 struct dwc3 *dwc = dep->dwc; in dwc3_ep0_start_control_status()
1002 return dwc3_ep0_start_trans(dwc, dep->number, in dwc3_ep0_start_control_status()
1006 static void __dwc3_ep0_do_control_status(struct dwc3 *dwc, struct dwc3_ep *dep) in __dwc3_ep0_do_control_status() argument
1014 WARN_ON(dwc3_ep0_start_control_status(dep)); in __dwc3_ep0_do_control_status()
1020 struct dwc3_ep *dep = dwc->eps[event->endpoint_number]; in dwc3_ep0_do_control_status() local
1022 __dwc3_ep0_do_control_status(dwc, dep); in dwc3_ep0_do_control_status()
1025 static void dwc3_ep0_end_control_data(struct dwc3 *dwc, struct dwc3_ep *dep) in dwc3_ep0_end_control_data() argument
1031 if (!dep->resource_index) in dwc3_ep0_end_control_data()
1036 cmd |= DWC3_DEPCMD_PARAM(dep->resource_index); in dwc3_ep0_end_control_data()
1038 ret = dwc3_send_gadget_ep_cmd(dwc, dep->number, cmd, &params); in dwc3_ep0_end_control_data()
1040 dep->resource_index = 0; in dwc3_ep0_end_control_data()
1062 struct dwc3_ep *dep = dwc->eps[dwc->ep0_expect_in]; in dwc3_ep0_xfernotready() local
1065 dwc3_ep0_end_control_data(dwc, dep); in dwc3_ep0_xfernotready()