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);
34 static void dwc3_ep0_prepare_one_trb(struct dwc3_ep *dep, in dwc3_ep0_prepare_one_trb() argument
40 dwc = dep->dwc; in dwc3_ep0_prepare_one_trb()
41 trb = &dwc->ep0_trb[dep->trb_enqueue]; in dwc3_ep0_prepare_one_trb()
44 dep->trb_enqueue++; in dwc3_ep0_prepare_one_trb()
60 trace_dwc3_prepare_trb(dep, trb); in dwc3_ep0_prepare_one_trb()
63 static int dwc3_ep0_start_trans(struct dwc3_ep *dep) in dwc3_ep0_start_trans() argument
69 if (dep->flags & DWC3_EP_TRANSFER_STARTED) in dwc3_ep0_start_trans()
72 dwc = dep->dwc; in dwc3_ep0_start_trans()
78 ret = dwc3_send_gadget_ep_cmd(dep, DWC3_DEPCMD_STARTTRANSFER, &params); in dwc3_ep0_start_trans()
87 static int __dwc3_gadget_ep0_queue(struct dwc3_ep *dep, in __dwc3_gadget_ep0_queue() argument
90 struct dwc3 *dwc = dep->dwc; in __dwc3_gadget_ep0_queue()
94 req->epnum = dep->number; in __dwc3_gadget_ep0_queue()
96 list_add_tail(&req->list, &dep->pending_list); in __dwc3_gadget_ep0_queue()
107 if (dep->flags & DWC3_EP_PENDING_REQUEST) { in __dwc3_gadget_ep0_queue()
110 direction = !!(dep->flags & DWC3_EP0_DIR_IN); in __dwc3_gadget_ep0_queue()
119 dep->flags &= ~(DWC3_EP_PENDING_REQUEST | in __dwc3_gadget_ep0_queue()
182 dep->flags &= ~DWC3_EP0_DIR_IN; in __dwc3_gadget_ep0_queue()
192 struct dwc3_ep *dep = to_dwc3_ep(ep); in dwc3_gadget_ep0_queue() local
193 struct dwc3 *dwc = dep->dwc; in dwc3_gadget_ep0_queue()
200 if (!dep->endpoint.desc || !dwc->pullups_connected) { in dwc3_gadget_ep0_queue()
202 dep->name); in dwc3_gadget_ep0_queue()
208 if (!list_empty(&dep->pending_list)) { in dwc3_gadget_ep0_queue()
213 ret = __dwc3_gadget_ep0_queue(dep, req); in dwc3_gadget_ep0_queue()
223 struct dwc3_ep *dep; in dwc3_ep0_stall_and_restart() local
226 dep = dwc->eps[1]; in dwc3_ep0_stall_and_restart()
227 dep->flags = DWC3_EP_ENABLED; in dwc3_ep0_stall_and_restart()
230 dep = dwc->eps[0]; in dwc3_ep0_stall_and_restart()
231 __dwc3_gadget_ep_set_halt(dep, 1, false); in dwc3_ep0_stall_and_restart()
232 dep->flags = DWC3_EP_ENABLED; in dwc3_ep0_stall_and_restart()
235 if (!list_empty(&dep->pending_list)) { in dwc3_ep0_stall_and_restart()
238 req = next_request(&dep->pending_list); in dwc3_ep0_stall_and_restart()
239 dwc3_gadget_giveback(dep, req, -ECONNRESET); in dwc3_ep0_stall_and_restart()
248 struct dwc3_ep *dep = to_dwc3_ep(ep); in __dwc3_gadget_ep0_set_halt() local
249 struct dwc3 *dwc = dep->dwc; in __dwc3_gadget_ep0_set_halt()
258 struct dwc3_ep *dep = to_dwc3_ep(ep); in dwc3_gadget_ep0_set_halt() local
259 struct dwc3 *dwc = dep->dwc; in dwc3_gadget_ep0_set_halt()
272 struct dwc3_ep *dep; in dwc3_ep0_out_start() local
277 dep = dwc->eps[0]; in dwc3_ep0_out_start()
278 dwc3_ep0_prepare_one_trb(dep, dwc->ep0_trb_addr, 8, in dwc3_ep0_out_start()
280 ret = dwc3_ep0_start_trans(dep); in dwc3_ep0_out_start()
286 struct dwc3_ep *dep; in dwc3_wIndex_to_dep() local
294 dep = dwc->eps[epnum]; in dwc3_wIndex_to_dep()
295 if (dep->flags & DWC3_EP_ENABLED) in dwc3_wIndex_to_dep()
296 return dep; in dwc3_wIndex_to_dep()
310 struct dwc3_ep *dep; in dwc3_ep0_handle_status() local
349 dep = dwc3_wIndex_to_dep(dwc, ctrl->wIndex); in dwc3_ep0_handle_status()
350 if (!dep) in dwc3_ep0_handle_status()
353 if (dep->flags & DWC3_EP_STALL) in dwc3_ep0_handle_status()
363 dep = dwc->eps[0]; in dwc3_ep0_handle_status()
364 dwc->ep0_usb_req.dep = dep; in dwc3_ep0_handle_status()
369 return __dwc3_gadget_ep0_queue(dep, &dwc->ep0_usb_req); in dwc3_ep0_handle_status()
509 struct dwc3_ep *dep; in dwc3_ep0_handle_endpoint() local
517 dep = dwc3_wIndex_to_dep(dwc, ctrl->wIndex); in dwc3_ep0_handle_endpoint()
518 if (!dep) in dwc3_ep0_handle_endpoint()
521 if (set == 0 && (dep->flags & DWC3_EP_WEDGE)) in dwc3_ep0_handle_endpoint()
524 ret = __dwc3_gadget_ep_set_halt(dep, set, true); in dwc3_ep0_handle_endpoint()
529 if (!set && (dep->flags & DWC3_EP_END_TRANSFER_PENDING)) in dwc3_ep0_handle_endpoint()
660 struct dwc3_ep *dep = to_dwc3_ep(ep); in dwc3_ep0_set_sel_cmpl() local
661 struct dwc3 *dwc = dep->dwc; in dwc3_ep0_set_sel_cmpl()
704 struct dwc3_ep *dep; in dwc3_ep0_set_sel() local
727 dep = dwc->eps[0]; in dwc3_ep0_set_sel()
728 dwc->ep0_usb_req.dep = dep; in dwc3_ep0_set_sel()
729 dwc->ep0_usb_req.request.length = dep->endpoint.maxpacket; in dwc3_ep0_set_sel()
733 return __dwc3_gadget_ep0_queue(dep, &dwc->ep0_usb_req); in dwc3_ep0_set_sel()
886 struct dwc3_ep *dep; in dwc3_ep0_complete_status() local
890 dep = dwc->eps[0]; in dwc3_ep0_complete_status()
893 trace_dwc3_complete_trb(dep, trb); in dwc3_ep0_complete_status()
895 if (!list_empty(&dep->pending_list)) { in dwc3_ep0_complete_status()
896 r = next_request(&dep->pending_list); in dwc3_ep0_complete_status()
898 dwc3_gadget_giveback(dep, r, 0); in dwc3_ep0_complete_status()
924 struct dwc3_ep *dep = dwc->eps[event->endpoint_number]; in dwc3_ep0_xfer_complete() local
926 dep->flags &= ~DWC3_EP_TRANSFER_STARTED; in dwc3_ep0_xfer_complete()
927 dep->resource_index = 0; in dwc3_ep0_xfer_complete()
948 struct dwc3_ep *dep, struct dwc3_request *req) in __dwc3_ep0_do_control_data() argument
953 req->direction = !!dep->number; in __dwc3_ep0_do_control_data()
957 trb_length = dep->endpoint.maxpacket; in __dwc3_ep0_do_control_data()
959 dwc3_ep0_prepare_one_trb(dep, dwc->bounce_addr, trb_length, in __dwc3_ep0_do_control_data()
961 ret = dwc3_ep0_start_trans(dep); in __dwc3_ep0_do_control_data()
962 } else if (!IS_ALIGNED(req->request.length, dep->endpoint.maxpacket) in __dwc3_ep0_do_control_data()
963 && (dep->number == 0)) { in __dwc3_ep0_do_control_data()
968 &req->request, dep->number); in __dwc3_ep0_do_control_data()
972 maxpacket = dep->endpoint.maxpacket; in __dwc3_ep0_do_control_data()
977 dwc3_ep0_prepare_one_trb(dep, req->request.dma, in __dwc3_ep0_do_control_data()
982 req->trb = &dwc->ep0_trb[dep->trb_enqueue - 1]; in __dwc3_ep0_do_control_data()
985 dwc3_ep0_prepare_one_trb(dep, dwc->bounce_addr, in __dwc3_ep0_do_control_data()
989 ret = dwc3_ep0_start_trans(dep); in __dwc3_ep0_do_control_data()
990 } else if (IS_ALIGNED(req->request.length, dep->endpoint.maxpacket) && in __dwc3_ep0_do_control_data()
994 &req->request, dep->number); in __dwc3_ep0_do_control_data()
999 dwc3_ep0_prepare_one_trb(dep, req->request.dma, in __dwc3_ep0_do_control_data()
1004 req->trb = &dwc->ep0_trb[dep->trb_enqueue - 1]; in __dwc3_ep0_do_control_data()
1007 trb_length = dep->endpoint.maxpacket; in __dwc3_ep0_do_control_data()
1010 dwc3_ep0_prepare_one_trb(dep, dwc->bounce_addr, in __dwc3_ep0_do_control_data()
1013 ret = dwc3_ep0_start_trans(dep); in __dwc3_ep0_do_control_data()
1016 &req->request, dep->number); in __dwc3_ep0_do_control_data()
1020 dwc3_ep0_prepare_one_trb(dep, req->request.dma, in __dwc3_ep0_do_control_data()
1024 req->trb = &dwc->ep0_trb[dep->trb_enqueue]; in __dwc3_ep0_do_control_data()
1026 ret = dwc3_ep0_start_trans(dep); in __dwc3_ep0_do_control_data()
1032 static int dwc3_ep0_start_control_status(struct dwc3_ep *dep) in dwc3_ep0_start_control_status() argument
1034 struct dwc3 *dwc = dep->dwc; in dwc3_ep0_start_control_status()
1040 dwc3_ep0_prepare_one_trb(dep, dwc->ep0_trb_addr, 0, type, false); in dwc3_ep0_start_control_status()
1041 return dwc3_ep0_start_trans(dep); in dwc3_ep0_start_control_status()
1044 static void __dwc3_ep0_do_control_status(struct dwc3 *dwc, struct dwc3_ep *dep) in __dwc3_ep0_do_control_status() argument
1046 WARN_ON(dwc3_ep0_start_control_status(dep)); in __dwc3_ep0_do_control_status()
1052 struct dwc3_ep *dep = dwc->eps[event->endpoint_number]; in dwc3_ep0_do_control_status() local
1054 __dwc3_ep0_do_control_status(dwc, dep); in dwc3_ep0_do_control_status()
1069 static void dwc3_ep0_end_control_data(struct dwc3 *dwc, struct dwc3_ep *dep) in dwc3_ep0_end_control_data() argument
1075 if (!dep->resource_index) in dwc3_ep0_end_control_data()
1080 cmd |= DWC3_DEPCMD_PARAM(dep->resource_index); in dwc3_ep0_end_control_data()
1082 ret = dwc3_send_gadget_ep_cmd(dep, cmd, &params); in dwc3_ep0_end_control_data()
1084 dep->resource_index = 0; in dwc3_ep0_end_control_data()
1102 struct dwc3_ep *dep = dwc->eps[dwc->ep0_expect_in]; in dwc3_ep0_xfernotready() local
1105 dwc3_ep0_end_control_data(dwc, dep); in dwc3_ep0_xfernotready()
1119 struct dwc3_ep *dep = dwc->eps[0]; in dwc3_ep0_xfernotready() local
1127 if (!list_empty(&dep->pending_list)) { in dwc3_ep0_xfernotready()
1144 struct dwc3_ep *dep = dwc->eps[event->endpoint_number]; in dwc3_ep0_interrupt() local
1164 dep->flags &= ~DWC3_EP_END_TRANSFER_PENDING; in dwc3_ep0_interrupt()
1165 dep->flags &= ~DWC3_EP_TRANSFER_STARTED; in dwc3_ep0_interrupt()