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 || !dwc->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()
250 struct dwc3_ep *dep = to_dwc3_ep(ep); in __dwc3_gadget_ep0_set_halt() local
251 struct dwc3 *dwc = dep->dwc; in __dwc3_gadget_ep0_set_halt()
260 struct dwc3_ep *dep = to_dwc3_ep(ep); in dwc3_gadget_ep0_set_halt() local
261 struct dwc3 *dwc = dep->dwc; in dwc3_gadget_ep0_set_halt()
274 struct dwc3_ep *dep; in dwc3_ep0_out_start() local
280 dep = dwc->eps[0]; in dwc3_ep0_out_start()
281 dwc3_ep0_prepare_one_trb(dep, dwc->ep0_trb_addr, 8, in dwc3_ep0_out_start()
283 ret = dwc3_ep0_start_trans(dep); in dwc3_ep0_out_start()
305 struct dwc3_ep *dep; in dwc3_wIndex_to_dep() local
324 dep = dwc->eps[epnum]; in dwc3_wIndex_to_dep()
325 if (dep == NULL) in dwc3_wIndex_to_dep()
328 if (dep->flags & DWC3_EP_ENABLED) in dwc3_wIndex_to_dep()
329 return dep; in dwc3_wIndex_to_dep()
343 struct dwc3_ep *dep; in dwc3_ep0_handle_status() local
382 dep = dwc3_wIndex_to_dep(dwc, ctrl->wIndex); in dwc3_ep0_handle_status()
383 if (!dep) in dwc3_ep0_handle_status()
386 if (dep->flags & DWC3_EP_STALL) in dwc3_ep0_handle_status()
396 dep = dwc->eps[0]; in dwc3_ep0_handle_status()
397 dwc->ep0_usb_req.dep = dep; in dwc3_ep0_handle_status()
402 return __dwc3_gadget_ep0_queue(dep, &dwc->ep0_usb_req); in dwc3_ep0_handle_status()
542 struct dwc3_ep *dep; in dwc3_ep0_handle_endpoint() local
550 dep = dwc3_wIndex_to_dep(dwc, ctrl->wIndex); in dwc3_ep0_handle_endpoint()
551 if (!dep) in dwc3_ep0_handle_endpoint()
554 if (set == 0 && (dep->flags & DWC3_EP_WEDGE)) in dwc3_ep0_handle_endpoint()
557 ret = __dwc3_gadget_ep_set_halt(dep, set, true); in dwc3_ep0_handle_endpoint()
562 if (!set && (dep->flags & DWC3_EP_END_TRANSFER_PENDING)) in dwc3_ep0_handle_endpoint()
697 struct dwc3_ep *dep = to_dwc3_ep(ep); in dwc3_ep0_set_sel_cmpl() local
698 struct dwc3 *dwc = dep->dwc; in dwc3_ep0_set_sel_cmpl()
741 struct dwc3_ep *dep; in dwc3_ep0_set_sel() local
764 dep = dwc->eps[0]; in dwc3_ep0_set_sel()
765 dwc->ep0_usb_req.dep = dep; in dwc3_ep0_set_sel()
766 dwc->ep0_usb_req.request.length = dep->endpoint.maxpacket; in dwc3_ep0_set_sel()
770 return __dwc3_gadget_ep0_queue(dep, &dwc->ep0_usb_req); in dwc3_ep0_set_sel()
924 struct dwc3_ep *dep; in dwc3_ep0_complete_status() local
928 dep = dwc->eps[0]; in dwc3_ep0_complete_status()
931 trace_dwc3_complete_trb(dep, trb); in dwc3_ep0_complete_status()
933 if (!list_empty(&dep->pending_list)) { in dwc3_ep0_complete_status()
934 r = next_request(&dep->pending_list); in dwc3_ep0_complete_status()
936 dwc3_gadget_giveback(dep, r, 0); in dwc3_ep0_complete_status()
962 struct dwc3_ep *dep = dwc->eps[event->endpoint_number]; in dwc3_ep0_xfer_complete() local
964 dep->flags &= ~DWC3_EP_TRANSFER_STARTED; in dwc3_ep0_xfer_complete()
965 dep->resource_index = 0; in dwc3_ep0_xfer_complete()
986 struct dwc3_ep *dep, struct dwc3_request *req) in __dwc3_ep0_do_control_data() argument
991 req->direction = !!dep->number; in __dwc3_ep0_do_control_data()
995 trb_length = dep->endpoint.maxpacket; in __dwc3_ep0_do_control_data()
997 dwc3_ep0_prepare_one_trb(dep, dwc->bounce_addr, trb_length, in __dwc3_ep0_do_control_data()
999 ret = dwc3_ep0_start_trans(dep); in __dwc3_ep0_do_control_data()
1000 } else if (!IS_ALIGNED(req->request.length, dep->endpoint.maxpacket) in __dwc3_ep0_do_control_data()
1001 && (dep->number == 0)) { in __dwc3_ep0_do_control_data()
1006 &req->request, dep->number); in __dwc3_ep0_do_control_data()
1010 maxpacket = dep->endpoint.maxpacket; in __dwc3_ep0_do_control_data()
1015 dwc3_ep0_prepare_one_trb(dep, req->request.dma, in __dwc3_ep0_do_control_data()
1020 req->trb = &dwc->ep0_trb[dep->trb_enqueue - 1]; in __dwc3_ep0_do_control_data()
1023 dwc3_ep0_prepare_one_trb(dep, dwc->bounce_addr, in __dwc3_ep0_do_control_data()
1027 ret = dwc3_ep0_start_trans(dep); in __dwc3_ep0_do_control_data()
1028 } else if (IS_ALIGNED(req->request.length, dep->endpoint.maxpacket) && in __dwc3_ep0_do_control_data()
1032 &req->request, dep->number); in __dwc3_ep0_do_control_data()
1037 dwc3_ep0_prepare_one_trb(dep, req->request.dma, in __dwc3_ep0_do_control_data()
1042 req->trb = &dwc->ep0_trb[dep->trb_enqueue - 1]; in __dwc3_ep0_do_control_data()
1045 trb_length = dep->endpoint.maxpacket; in __dwc3_ep0_do_control_data()
1048 dwc3_ep0_prepare_one_trb(dep, dwc->bounce_addr, in __dwc3_ep0_do_control_data()
1051 ret = dwc3_ep0_start_trans(dep); in __dwc3_ep0_do_control_data()
1054 &req->request, dep->number); in __dwc3_ep0_do_control_data()
1058 dwc3_ep0_prepare_one_trb(dep, req->request.dma, in __dwc3_ep0_do_control_data()
1062 req->trb = &dwc->ep0_trb[dep->trb_enqueue]; in __dwc3_ep0_do_control_data()
1064 ret = dwc3_ep0_start_trans(dep); in __dwc3_ep0_do_control_data()
1070 static int dwc3_ep0_start_control_status(struct dwc3_ep *dep) in dwc3_ep0_start_control_status() argument
1072 struct dwc3 *dwc = dep->dwc; in dwc3_ep0_start_control_status()
1078 dwc3_ep0_prepare_one_trb(dep, dwc->ep0_trb_addr, 0, type, false); in dwc3_ep0_start_control_status()
1079 return dwc3_ep0_start_trans(dep); in dwc3_ep0_start_control_status()
1082 static void __dwc3_ep0_do_control_status(struct dwc3 *dwc, struct dwc3_ep *dep) in __dwc3_ep0_do_control_status() argument
1084 WARN_ON(dwc3_ep0_start_control_status(dep)); in __dwc3_ep0_do_control_status()
1090 struct dwc3_ep *dep = dwc->eps[event->endpoint_number]; in dwc3_ep0_do_control_status() local
1092 __dwc3_ep0_do_control_status(dwc, dep); in dwc3_ep0_do_control_status()
1109 void dwc3_ep0_end_control_data(struct dwc3 *dwc, struct dwc3_ep *dep) in dwc3_ep0_end_control_data() argument
1120 if (!dep->resource_index && dep->number) in dwc3_ep0_end_control_data()
1125 cmd |= DWC3_DEPCMD_PARAM(dep->resource_index); in dwc3_ep0_end_control_data()
1127 ret = dwc3_send_gadget_ep_cmd(dep, cmd, &params); in dwc3_ep0_end_control_data()
1129 dep->resource_index = 0; in dwc3_ep0_end_control_data()
1151 struct dwc3_ep *dep = dwc->eps[dwc->ep0_expect_in]; in dwc3_ep0_xfernotready() local
1154 dwc3_ep0_end_control_data(dwc, dep); in dwc3_ep0_xfernotready()
1173 struct dwc3_ep *dep = dwc->eps[0]; in dwc3_ep0_xfernotready() local
1181 if (!list_empty(&dep->pending_list)) { in dwc3_ep0_xfernotready()
1198 struct dwc3_ep *dep = dwc->eps[event->endpoint_number]; in dwc3_ep0_interrupt() local
1218 dep->flags &= ~DWC3_EP_END_TRANSFER_PENDING; in dwc3_ep0_interrupt()
1219 dep->flags &= ~DWC3_EP_TRANSFER_STARTED; in dwc3_ep0_interrupt()