Lines Matching refs:priv_ep

76 static int cdns3_ep_run_transfer(struct cdns3_endpoint *priv_ep,
79 static int cdns3_ep_run_stream_transfer(struct cdns3_endpoint *priv_ep,
116 struct cdns3_endpoint *priv_ep) in cdns3_get_dma_pos() argument
120 dma_index = readl(&priv_dev->regs->ep_traddr) - priv_ep->trb_pool_dma; in cdns3_get_dma_pos()
187 dma_addr_t cdns3_trb_virt_to_dma(struct cdns3_endpoint *priv_ep, in cdns3_trb_virt_to_dma() argument
190 u32 offset = (char *)trb - (char *)priv_ep->trb_pool; in cdns3_trb_virt_to_dma()
192 return priv_ep->trb_pool_dma + offset; in cdns3_trb_virt_to_dma()
195 static void cdns3_free_trb_pool(struct cdns3_endpoint *priv_ep) in cdns3_free_trb_pool() argument
197 struct cdns3_device *priv_dev = priv_ep->cdns3_dev; in cdns3_free_trb_pool()
199 if (priv_ep->trb_pool) { in cdns3_free_trb_pool()
201 priv_ep->trb_pool, priv_ep->trb_pool_dma); in cdns3_free_trb_pool()
202 priv_ep->trb_pool = NULL; in cdns3_free_trb_pool()
212 int cdns3_allocate_trb_pool(struct cdns3_endpoint *priv_ep) in cdns3_allocate_trb_pool() argument
214 struct cdns3_device *priv_dev = priv_ep->cdns3_dev; in cdns3_allocate_trb_pool()
219 if (priv_ep->trb_pool && priv_ep->alloc_ring_size < ring_size) in cdns3_allocate_trb_pool()
220 cdns3_free_trb_pool(priv_ep); in cdns3_allocate_trb_pool()
222 if (!priv_ep->trb_pool) { in cdns3_allocate_trb_pool()
223 priv_ep->trb_pool = dma_pool_alloc(priv_dev->eps_dma_pool, in cdns3_allocate_trb_pool()
225 &priv_ep->trb_pool_dma); in cdns3_allocate_trb_pool()
227 if (!priv_ep->trb_pool) in cdns3_allocate_trb_pool()
230 priv_ep->alloc_ring_size = ring_size; in cdns3_allocate_trb_pool()
233 memset(priv_ep->trb_pool, 0, ring_size); in cdns3_allocate_trb_pool()
235 priv_ep->num_trbs = num_trbs; in cdns3_allocate_trb_pool()
237 if (!priv_ep->num) in cdns3_allocate_trb_pool()
241 link_trb = (priv_ep->trb_pool + (priv_ep->num_trbs - 1)); in cdns3_allocate_trb_pool()
243 if (priv_ep->use_streams) { in cdns3_allocate_trb_pool()
250 link_trb->buffer = cpu_to_le32(TRB_BUFFER(priv_ep->trb_pool_dma)); in cdns3_allocate_trb_pool()
262 static void cdns3_ep_stall_flush(struct cdns3_endpoint *priv_ep) in cdns3_ep_stall_flush() argument
264 struct cdns3_device *priv_dev = priv_ep->cdns3_dev; in cdns3_ep_stall_flush()
267 trace_cdns3_halt(priv_ep, 1, 1); in cdns3_ep_stall_flush()
275 priv_ep->flags |= EP_STALLED; in cdns3_ep_stall_flush()
276 priv_ep->flags &= ~EP_STALL_PENDING; in cdns3_ep_stall_flush()
325 static void cdns3_ep_inc_enq(struct cdns3_endpoint *priv_ep) in cdns3_ep_inc_enq() argument
327 priv_ep->free_trbs--; in cdns3_ep_inc_enq()
328 cdns3_ep_inc_trb(&priv_ep->enqueue, &priv_ep->pcs, priv_ep->num_trbs); in cdns3_ep_inc_enq()
335 static void cdns3_ep_inc_deq(struct cdns3_endpoint *priv_ep) in cdns3_ep_inc_deq() argument
337 priv_ep->free_trbs++; in cdns3_ep_inc_deq()
338 cdns3_ep_inc_trb(&priv_ep->dequeue, &priv_ep->ccs, priv_ep->num_trbs); in cdns3_ep_inc_deq()
385 struct cdns3_endpoint *priv_ep) in cdns3_start_all_request() argument
389 u8 pending_empty = list_empty(&priv_ep->pending_req_list); in cdns3_start_all_request()
399 request = cdns3_next_request(&priv_ep->pending_req_list); in cdns3_start_all_request()
402 (priv_ep->flags & EP_TDLCHK_EN) || in cdns3_start_all_request()
403 priv_ep->use_streams) { in cdns3_start_all_request()
409 while (!list_empty(&priv_ep->deferred_req_list)) { in cdns3_start_all_request()
410 request = cdns3_next_request(&priv_ep->deferred_req_list); in cdns3_start_all_request()
412 if (!priv_ep->use_streams) { in cdns3_start_all_request()
413 ret = cdns3_ep_run_transfer(priv_ep, request); in cdns3_start_all_request()
415 priv_ep->stream_sg_idx = 0; in cdns3_start_all_request()
416 ret = cdns3_ep_run_stream_transfer(priv_ep, request); in cdns3_start_all_request()
421 list_move_tail(&request->list, &priv_ep->pending_req_list); in cdns3_start_all_request()
422 if (request->stream_id != 0 || (priv_ep->flags & EP_TDLCHK_EN)) in cdns3_start_all_request()
426 priv_ep->flags &= ~EP_RING_FULL; in cdns3_start_all_request()
436 #define cdns3_wa2_enable_detection(priv_dev, priv_ep, reg) do { \ argument
437 if (!priv_ep->dir && priv_ep->type != USB_ENDPOINT_XFER_ISOC) { \
438 priv_ep->flags |= EP_QUIRK_EXTRA_BUF_DET; \
478 static void cdns3_wa2_descmiss_copy_data(struct cdns3_endpoint *priv_ep, in cdns3_wa2_descmiss_copy_data() argument
484 while (!list_empty(&priv_ep->wa2_descmiss_req_list)) { in cdns3_wa2_descmiss_copy_data()
488 cdns3_next_priv_request(&priv_ep->wa2_descmiss_req_list); in cdns3_wa2_descmiss_copy_data()
500 cdns3_gadget_ep_free_request(&priv_ep->endpoint, descmiss_req); in cdns3_wa2_descmiss_copy_data()
501 --priv_ep->wa2_counter; in cdns3_wa2_descmiss_copy_data()
509 struct cdns3_endpoint *priv_ep, in cdns3_wa2_gadget_giveback() argument
512 if (priv_ep->flags & EP_QUIRK_EXTRA_BUF_EN && in cdns3_wa2_gadget_giveback()
516 req = cdns3_next_request(&priv_ep->deferred_req_list); in cdns3_wa2_gadget_giveback()
518 priv_ep->descmis_req = NULL; in cdns3_wa2_gadget_giveback()
525 priv_ep->dir); in cdns3_wa2_gadget_giveback()
527 cdns3_wa2_descmiss_copy_data(priv_ep, req); in cdns3_wa2_gadget_giveback()
528 if (!(priv_ep->flags & EP_QUIRK_END_TRANSFER) && in cdns3_wa2_gadget_giveback()
533 usb_endpoint_dir_in(priv_ep->endpoint.desc)); in cdns3_wa2_gadget_giveback()
541 cdns3_start_all_request(priv_dev, priv_ep); in cdns3_wa2_gadget_giveback()
549 struct cdns3_endpoint *priv_ep, in cdns3_wa2_gadget_ep_queue() argument
559 if (priv_ep->flags & EP_QUIRK_EXTRA_BUF_DET) { in cdns3_wa2_gadget_ep_queue()
562 cdns3_select_ep(priv_dev, priv_ep->num | priv_ep->dir); in cdns3_wa2_gadget_ep_queue()
563 priv_ep->flags &= ~EP_QUIRK_EXTRA_BUF_DET; in cdns3_wa2_gadget_ep_queue()
566 trace_cdns3_wa2(priv_ep, "workaround disabled\n"); in cdns3_wa2_gadget_ep_queue()
570 if (priv_ep->flags & EP_QUIRK_EXTRA_BUF_EN) { in cdns3_wa2_gadget_ep_queue()
571 u8 pending_empty = list_empty(&priv_ep->pending_req_list); in cdns3_wa2_gadget_ep_queue()
572 u8 descmiss_empty = list_empty(&priv_ep->wa2_descmiss_req_list); in cdns3_wa2_gadget_ep_queue()
581 cdns3_wa2_descmiss_copy_data(priv_ep, in cdns3_wa2_gadget_ep_queue()
584 trace_cdns3_wa2(priv_ep, "get internal stored data"); in cdns3_wa2_gadget_ep_queue()
587 &priv_ep->pending_req_list); in cdns3_wa2_gadget_ep_queue()
588 cdns3_gadget_giveback(priv_ep, priv_req, in cdns3_wa2_gadget_ep_queue()
604 trace_cdns3_wa2(priv_ep, "wait for pending transfer\n"); in cdns3_wa2_gadget_ep_queue()
610 &priv_ep->wa2_descmiss_req_list); in cdns3_wa2_gadget_ep_queue()
616 static void cdns3_wa2_remove_old_request(struct cdns3_endpoint *priv_ep) in cdns3_wa2_remove_old_request() argument
620 while (!list_empty(&priv_ep->wa2_descmiss_req_list)) { in cdns3_wa2_remove_old_request()
623 priv_req = cdns3_next_priv_request(&priv_ep->wa2_descmiss_req_list); in cdns3_wa2_remove_old_request()
626 trace_cdns3_wa2(priv_ep, "removes eldest request"); in cdns3_wa2_remove_old_request()
630 cdns3_gadget_ep_free_request(&priv_ep->endpoint, in cdns3_wa2_remove_old_request()
632 --priv_ep->wa2_counter; in cdns3_wa2_remove_old_request()
646 static void cdns3_wa2_descmissing_packet(struct cdns3_endpoint *priv_ep) in cdns3_wa2_descmissing_packet() argument
650 u8 pending_empty = list_empty(&priv_ep->pending_req_list); in cdns3_wa2_descmissing_packet()
654 trace_cdns3_wa2(priv_ep, "Ignoring Descriptor missing IRQ\n"); in cdns3_wa2_descmissing_packet()
658 if (priv_ep->flags & EP_QUIRK_EXTRA_BUF_DET) { in cdns3_wa2_descmissing_packet()
659 priv_ep->flags &= ~EP_QUIRK_EXTRA_BUF_DET; in cdns3_wa2_descmissing_packet()
660 priv_ep->flags |= EP_QUIRK_EXTRA_BUF_EN; in cdns3_wa2_descmissing_packet()
663 trace_cdns3_wa2(priv_ep, "Description Missing detected\n"); in cdns3_wa2_descmissing_packet()
665 if (priv_ep->wa2_counter >= CDNS3_WA2_NUM_BUFFERS) { in cdns3_wa2_descmissing_packet()
666 trace_cdns3_wa2(priv_ep, "WA2 overflow\n"); in cdns3_wa2_descmissing_packet()
667 cdns3_wa2_remove_old_request(priv_ep); in cdns3_wa2_descmissing_packet()
670 request = cdns3_gadget_ep_alloc_request(&priv_ep->endpoint, in cdns3_wa2_descmissing_packet()
684 if (priv_ep->descmis_req) in cdns3_wa2_descmissing_packet()
685 priv_ep->descmis_req->flags |= REQUEST_INTERNAL_CH; in cdns3_wa2_descmissing_packet()
689 priv_ep->wa2_counter++; in cdns3_wa2_descmissing_packet()
692 cdns3_gadget_ep_free_request(&priv_ep->endpoint, request); in cdns3_wa2_descmissing_packet()
697 priv_ep->descmis_req = priv_req; in cdns3_wa2_descmissing_packet()
699 __cdns3_gadget_ep_queue(&priv_ep->endpoint, in cdns3_wa2_descmissing_packet()
700 &priv_ep->descmis_req->request, in cdns3_wa2_descmissing_packet()
706 dev_err(priv_ep->cdns3_dev->dev, in cdns3_wa2_descmissing_packet()
792 void cdns3_gadget_giveback(struct cdns3_endpoint *priv_ep, in cdns3_gadget_giveback() argument
796 struct cdns3_device *priv_dev = priv_ep->cdns3_dev; in cdns3_gadget_giveback()
806 priv_ep->dir); in cdns3_gadget_giveback()
809 priv_ep->dir == USB_DIR_OUT && !request->status) { in cdns3_gadget_giveback()
825 request = cdns3_wa2_gadget_giveback(priv_dev, priv_ep, in cdns3_gadget_giveback()
837 usb_gadget_giveback_request(&priv_ep->endpoint, in cdns3_gadget_giveback()
843 cdns3_gadget_ep_free_request(&priv_ep->endpoint, request); in cdns3_gadget_giveback()
846 static void cdns3_wa1_restore_cycle_bit(struct cdns3_endpoint *priv_ep) in cdns3_wa1_restore_cycle_bit() argument
849 if (priv_ep->wa1_set) { in cdns3_wa1_restore_cycle_bit()
850 trace_cdns3_wa1(priv_ep, "restore cycle bit"); in cdns3_wa1_restore_cycle_bit()
852 priv_ep->wa1_set = 0; in cdns3_wa1_restore_cycle_bit()
853 priv_ep->wa1_trb_index = 0xFFFF; in cdns3_wa1_restore_cycle_bit()
854 if (priv_ep->wa1_cycle_bit) { in cdns3_wa1_restore_cycle_bit()
855 priv_ep->wa1_trb->control = in cdns3_wa1_restore_cycle_bit()
856 priv_ep->wa1_trb->control | cpu_to_le32(0x1); in cdns3_wa1_restore_cycle_bit()
858 priv_ep->wa1_trb->control = in cdns3_wa1_restore_cycle_bit()
859 priv_ep->wa1_trb->control & cpu_to_le32(~0x1); in cdns3_wa1_restore_cycle_bit()
895 struct cdns3_endpoint *priv_ep = priv_req->priv_ep; in cdns3_prepare_aligned_request_buf() local
896 struct cdns3_device *priv_dev = priv_ep->cdns3_dev; in cdns3_prepare_aligned_request_buf()
911 buf->dir = usb_endpoint_dir_in(priv_ep->endpoint.desc) ? in cdns3_prepare_aligned_request_buf()
938 if (priv_ep->dir == USB_DIR_IN) { in cdns3_prepare_aligned_request_buf()
956 static int cdns3_wa1_update_guard(struct cdns3_endpoint *priv_ep, in cdns3_wa1_update_guard() argument
959 struct cdns3_device *priv_dev = priv_ep->cdns3_dev; in cdns3_wa1_update_guard()
961 if (!priv_ep->wa1_set) { in cdns3_wa1_update_guard()
967 priv_ep->wa1_cycle_bit = priv_ep->pcs ? TRB_CYCLE : 0; in cdns3_wa1_update_guard()
968 priv_ep->wa1_set = 1; in cdns3_wa1_update_guard()
969 priv_ep->wa1_trb = trb; in cdns3_wa1_update_guard()
970 priv_ep->wa1_trb_index = priv_ep->enqueue; in cdns3_wa1_update_guard()
971 trace_cdns3_wa1(priv_ep, "set guard"); in cdns3_wa1_update_guard()
979 struct cdns3_endpoint *priv_ep) in cdns3_wa1_tray_restore_cycle_bit() argument
985 dma_index = cdns3_get_dma_pos(priv_dev, priv_ep); in cdns3_wa1_tray_restore_cycle_bit()
987 if (!doorbell || dma_index != priv_ep->wa1_trb_index) in cdns3_wa1_tray_restore_cycle_bit()
988 cdns3_wa1_restore_cycle_bit(priv_ep); in cdns3_wa1_tray_restore_cycle_bit()
991 static int cdns3_ep_run_stream_transfer(struct cdns3_endpoint *priv_ep, in cdns3_ep_run_stream_transfer() argument
994 struct cdns3_device *priv_dev = priv_ep->cdns3_dev; in cdns3_ep_run_stream_transfer()
1002 unsigned int sg_idx = priv_ep->stream_sg_idx; in cdns3_ep_run_stream_transfer()
1005 address = priv_ep->endpoint.desc->bEndpointAddress; in cdns3_ep_run_stream_transfer()
1007 priv_ep->flags |= EP_PENDING_REQUEST; in cdns3_ep_run_stream_transfer()
1016 trb = priv_ep->trb_pool + priv_ep->enqueue; in cdns3_ep_run_stream_transfer()
1017 priv_req->start_trb = priv_ep->enqueue; in cdns3_ep_run_stream_transfer()
1021 cdns3_select_ep(priv_ep->cdns3_dev, address); in cdns3_ep_run_stream_transfer()
1034 tdl = DIV_ROUND_UP(length, priv_ep->endpoint.maxpacket); in cdns3_ep_run_stream_transfer()
1051 trace_cdns3_prepare_trb(priv_ep, priv_req->trb); in cdns3_ep_run_stream_transfer()
1060 writel(EP_TRADDR_TRADDR(priv_ep->trb_pool_dma), in cdns3_ep_run_stream_transfer()
1063 if (!(priv_ep->flags & EP_STALLED)) { in cdns3_ep_run_stream_transfer()
1064 trace_cdns3_ring(priv_ep); in cdns3_ep_run_stream_transfer()
1068 priv_ep->prime_flag = false; in cdns3_ep_run_stream_transfer()
1081 priv_ep->last_stream_id = priv_req->request.stream_id; in cdns3_ep_run_stream_transfer()
1086 trace_cdns3_doorbell_epx(priv_ep->name, in cdns3_ep_run_stream_transfer()
1096 static void cdns3_rearm_drdy_if_needed(struct cdns3_endpoint *priv_ep) in cdns3_rearm_drdy_if_needed() argument
1098 struct cdns3_device *priv_dev = priv_ep->cdns3_dev; in cdns3_rearm_drdy_if_needed()
1116 static int cdns3_ep_run_transfer(struct cdns3_endpoint *priv_ep, in cdns3_ep_run_transfer() argument
1119 struct cdns3_device *priv_dev = priv_ep->cdns3_dev; in cdns3_ep_run_transfer()
1140 if (priv_ep->type == USB_ENDPOINT_XFER_ISOC) in cdns3_ep_run_transfer()
1141 num_trb = priv_ep->interval * num_trb_req; in cdns3_ep_run_transfer()
1146 address = priv_ep->endpoint.desc->bEndpointAddress; in cdns3_ep_run_transfer()
1148 priv_ep->flags |= EP_PENDING_REQUEST; in cdns3_ep_run_transfer()
1156 trb = priv_ep->trb_pool + priv_ep->enqueue; in cdns3_ep_run_transfer()
1157 priv_req->start_trb = priv_ep->enqueue; in cdns3_ep_run_transfer()
1160 cdns3_select_ep(priv_ep->cdns3_dev, address); in cdns3_ep_run_transfer()
1163 if ((priv_ep->enqueue + num_trb) >= (priv_ep->num_trbs - 1)) { in cdns3_ep_run_transfer()
1168 dma_index = cdns3_get_dma_pos(priv_dev, priv_ep); in cdns3_ep_run_transfer()
1171 if (doorbell && dma_index == priv_ep->num_trbs - 1) { in cdns3_ep_run_transfer()
1172 priv_ep->flags |= EP_DEFERRED_DRDY; in cdns3_ep_run_transfer()
1177 link_trb = priv_ep->trb_pool + (priv_ep->num_trbs - 1); in cdns3_ep_run_transfer()
1186 if (priv_ep->type == USB_ENDPOINT_XFER_ISOC || in cdns3_ep_run_transfer()
1190 link_trb->control = cpu_to_le32(((priv_ep->pcs) ? TRB_CYCLE : 0) | in cdns3_ep_run_transfer()
1193 if (priv_ep->type == USB_ENDPOINT_XFER_ISOC) { in cdns3_ep_run_transfer()
1198 while (priv_ep->enqueue) { in cdns3_ep_run_transfer()
1200 trace_cdns3_prepare_trb(priv_ep, trb); in cdns3_ep_run_transfer()
1202 cdns3_ep_inc_enq(priv_ep); in cdns3_ep_run_transfer()
1203 trb = priv_ep->trb_pool + priv_ep->enqueue; in cdns3_ep_run_transfer()
1209 if (num_trb > priv_ep->free_trbs) { in cdns3_ep_run_transfer()
1210 priv_ep->flags |= EP_RING_FULL; in cdns3_ep_run_transfer()
1215 togle_pcs = cdns3_wa1_update_guard(priv_ep, trb); in cdns3_ep_run_transfer()
1218 control = priv_ep->pcs ? 0 : TRB_CYCLE; in cdns3_ep_run_transfer()
1224 priv_ep->endpoint.maxpacket); in cdns3_ep_run_transfer()
1247 if (priv_ep->flags & EP_TDLCHK_EN) in cdns3_ep_run_transfer()
1249 priv_ep->endpoint.maxpacket); in cdns3_ep_run_transfer()
1251 trb_burst = priv_ep->trb_burst_size; in cdns3_ep_run_transfer()
1275 if (priv_ep->type == USB_ENDPOINT_XFER_ISOC && priv_dev->dev_ver <= DEV_VER_V2) in cdns3_ep_run_transfer()
1282 pcs = priv_ep->pcs ? TRB_CYCLE : 0; in cdns3_ep_run_transfer()
1291 if (priv_ep->type == USB_ENDPOINT_XFER_ISOC && !priv_ep->dir) { in cdns3_ep_run_transfer()
1315 priv_req->end_trb = priv_ep->enqueue; in cdns3_ep_run_transfer()
1316 cdns3_ep_inc_enq(priv_ep); in cdns3_ep_run_transfer()
1317 trb = priv_ep->trb_pool + priv_ep->enqueue; in cdns3_ep_run_transfer()
1330 (priv_ep->flags & EP_TDLCHK_EN)) { in cdns3_ep_run_transfer()
1336 priv_ep->pending_tdl = total_tdl - EP_CMD_TDL_MAX; in cdns3_ep_run_transfer()
1356 cdns3_wa1_tray_restore_cycle_bit(priv_dev, priv_ep); in cdns3_ep_run_transfer()
1362 trace_cdns3_prepare_trb(priv_ep, trb + i); in cdns3_ep_run_transfer()
1364 trb = priv_ep->trb_pool; in cdns3_ep_run_transfer()
1372 trace_cdns3_prepare_trb(priv_ep, priv_req->trb); in cdns3_ep_run_transfer()
1385 if (priv_ep->flags & EP_UPDATE_EP_TRBADDR) { in cdns3_ep_run_transfer()
1391 if (priv_ep->type == USB_ENDPOINT_XFER_ISOC && !priv_ep->dir && in cdns3_ep_run_transfer()
1392 !(priv_ep->flags & EP_QUIRK_ISO_OUT_EN)) { in cdns3_ep_run_transfer()
1393 priv_ep->flags |= EP_QUIRK_ISO_OUT_EN; in cdns3_ep_run_transfer()
1398 writel(EP_TRADDR_TRADDR(priv_ep->trb_pool_dma + in cdns3_ep_run_transfer()
1402 priv_ep->flags &= ~EP_UPDATE_EP_TRBADDR; in cdns3_ep_run_transfer()
1405 if (!priv_ep->wa1_set && !(priv_ep->flags & EP_STALLED)) { in cdns3_ep_run_transfer()
1406 trace_cdns3_ring(priv_ep); in cdns3_ep_run_transfer()
1410 cdns3_rearm_drdy_if_needed(priv_ep); in cdns3_ep_run_transfer()
1411 trace_cdns3_doorbell_epx(priv_ep->name, in cdns3_ep_run_transfer()
1423 struct cdns3_endpoint *priv_ep; in cdns3_set_hw_configuration() local
1438 priv_ep = ep_to_cdns3_ep(ep); in cdns3_set_hw_configuration()
1439 cdns3_start_all_request(priv_dev, priv_ep); in cdns3_set_hw_configuration()
1485 static bool cdns3_trb_handled(struct cdns3_endpoint *priv_ep, in cdns3_trb_handled() argument
1488 struct cdns3_device *priv_dev = priv_ep->cdns3_dev; in cdns3_trb_handled()
1494 current_index = cdns3_get_dma_pos(priv_dev, priv_ep); in cdns3_trb_handled()
1499 if (priv_ep->dequeue > priv_req->end_trb) in cdns3_trb_handled()
1502 if (priv_ep->dequeue < priv_req->start_trb) in cdns3_trb_handled()
1507 (priv_ep->dequeue > priv_req->end_trb) && in cdns3_trb_handled()
1508 (priv_ep->dequeue < priv_req->start_trb)) in cdns3_trb_handled()
1512 (priv_ep->dequeue != priv_req->end_trb)) in cdns3_trb_handled()
1515 trb = &priv_ep->trb_pool[priv_ep->dequeue]; in cdns3_trb_handled()
1517 if ((le32_to_cpu(trb->control) & TRB_CYCLE) != priv_ep->ccs) in cdns3_trb_handled()
1520 if (doorbell == 1 && current_index == priv_ep->dequeue) in cdns3_trb_handled()
1524 if (TRBS_PER_SEGMENT == 2 && priv_ep->type != USB_ENDPOINT_XFER_ISOC) { in cdns3_trb_handled()
1529 if (priv_ep->enqueue == priv_ep->dequeue && in cdns3_trb_handled()
1530 priv_ep->free_trbs == 0) { in cdns3_trb_handled()
1532 } else if (priv_ep->dequeue < current_index) { in cdns3_trb_handled()
1533 if ((current_index == (priv_ep->num_trbs - 1)) && in cdns3_trb_handled()
1534 !priv_ep->dequeue) in cdns3_trb_handled()
1538 } else if (priv_ep->dequeue > current_index) { in cdns3_trb_handled()
1549 struct cdns3_endpoint *priv_ep) in cdns3_transfer_completed() argument
1557 while (!list_empty(&priv_ep->pending_req_list)) { in cdns3_transfer_completed()
1558 request = cdns3_next_request(&priv_ep->pending_req_list); in cdns3_transfer_completed()
1561 trb = priv_ep->trb_pool + priv_ep->dequeue; in cdns3_transfer_completed()
1567 if (priv_ep->dequeue == cdns3_get_dma_pos(priv_dev, priv_ep) && in cdns3_transfer_completed()
1568 priv_ep->type == USB_ENDPOINT_XFER_ISOC) in cdns3_transfer_completed()
1571 trace_cdns3_complete_trb(priv_ep, trb); in cdns3_transfer_completed()
1572 cdns3_ep_inc_deq(priv_ep); in cdns3_transfer_completed()
1573 trb = priv_ep->trb_pool + priv_ep->dequeue; in cdns3_transfer_completed()
1580 cdns3_select_ep(priv_dev, priv_ep->endpoint.address); in cdns3_transfer_completed()
1582 while (cdns3_trb_handled(priv_ep, priv_req)) { in cdns3_transfer_completed()
1587 trb = priv_ep->trb_pool + priv_ep->dequeue; in cdns3_transfer_completed()
1588 trace_cdns3_complete_trb(priv_ep, trb); in cdns3_transfer_completed()
1599 cdns3_ep_inc_deq(priv_ep); in cdns3_transfer_completed()
1604 if (priv_ep->type == USB_ENDPOINT_XFER_ISOC && priv_ep->dir) in cdns3_transfer_completed()
1605 request->actual /= priv_ep->interval; in cdns3_transfer_completed()
1607 cdns3_gadget_giveback(priv_ep, priv_req, 0); in cdns3_transfer_completed()
1614 if (priv_ep->type != USB_ENDPOINT_XFER_ISOC && in cdns3_transfer_completed()
1621 cdns3_select_ep(priv_dev, priv_ep->endpoint.address); in cdns3_transfer_completed()
1623 trb = priv_ep->trb_pool; in cdns3_transfer_completed()
1624 trace_cdns3_complete_trb(priv_ep, trb); in cdns3_transfer_completed()
1634 (request->num_sgs == (priv_ep->stream_sg_idx + 1))) { in cdns3_transfer_completed()
1635 priv_ep->stream_sg_idx = 0; in cdns3_transfer_completed()
1636 cdns3_gadget_giveback(priv_ep, priv_req, 0); in cdns3_transfer_completed()
1638 priv_ep->stream_sg_idx++; in cdns3_transfer_completed()
1639 cdns3_ep_run_stream_transfer(priv_ep, request); in cdns3_transfer_completed()
1644 priv_ep->flags &= ~EP_PENDING_REQUEST; in cdns3_transfer_completed()
1647 if (!(priv_ep->flags & EP_STALLED) && in cdns3_transfer_completed()
1648 !(priv_ep->flags & EP_STALL_PENDING)) in cdns3_transfer_completed()
1649 cdns3_start_all_request(priv_dev, priv_ep); in cdns3_transfer_completed()
1652 void cdns3_rearm_transfer(struct cdns3_endpoint *priv_ep, u8 rearm) in cdns3_rearm_transfer() argument
1654 struct cdns3_device *priv_dev = priv_ep->cdns3_dev; in cdns3_rearm_transfer()
1656 cdns3_wa1_restore_cycle_bit(priv_ep); in cdns3_rearm_transfer()
1659 trace_cdns3_ring(priv_ep); in cdns3_rearm_transfer()
1667 trace_cdns3_doorbell_epx(priv_ep->name, in cdns3_rearm_transfer()
1672 static void cdns3_reprogram_tdl(struct cdns3_endpoint *priv_ep) in cdns3_reprogram_tdl() argument
1674 u16 tdl = priv_ep->pending_tdl; in cdns3_reprogram_tdl()
1675 struct cdns3_device *priv_dev = priv_ep->cdns3_dev; in cdns3_reprogram_tdl()
1679 priv_ep->pending_tdl -= EP_CMD_TDL_MAX; in cdns3_reprogram_tdl()
1681 priv_ep->pending_tdl = 0; in cdns3_reprogram_tdl()
1693 static int cdns3_check_ep_interrupt_proceed(struct cdns3_endpoint *priv_ep) in cdns3_check_ep_interrupt_proceed() argument
1695 struct cdns3_device *priv_dev = priv_ep->cdns3_dev; in cdns3_check_ep_interrupt_proceed()
1701 cdns3_select_ep(priv_dev, priv_ep->endpoint.address); in cdns3_check_ep_interrupt_proceed()
1703 trace_cdns3_epx_irq(priv_dev, priv_ep); in cdns3_check_ep_interrupt_proceed()
1708 if ((ep_sts_reg & EP_STS_PRIME) && priv_ep->use_streams) { in cdns3_check_ep_interrupt_proceed()
1723 EP_CMD_ERDY_SID(priv_ep->last_stream_id), in cdns3_check_ep_interrupt_proceed()
1727 priv_ep->prime_flag = true; in cdns3_check_ep_interrupt_proceed()
1729 pending_request = cdns3_next_request(&priv_ep->pending_req_list); in cdns3_check_ep_interrupt_proceed()
1730 deferred_request = cdns3_next_request(&priv_ep->deferred_req_list); in cdns3_check_ep_interrupt_proceed()
1733 cdns3_start_all_request(priv_dev, priv_ep); in cdns3_check_ep_interrupt_proceed()
1739 if (priv_ep->flags & EP_STALL_PENDING && in cdns3_check_ep_interrupt_proceed()
1742 cdns3_ep_stall_flush(priv_ep); in cdns3_check_ep_interrupt_proceed()
1752 if (priv_ep->type == USB_ENDPOINT_XFER_ISOC && in cdns3_check_ep_interrupt_proceed()
1753 !priv_ep->wa1_set) { in cdns3_check_ep_interrupt_proceed()
1754 if (!priv_ep->dir) { in cdns3_check_ep_interrupt_proceed()
1759 priv_ep->flags &= ~EP_QUIRK_ISO_OUT_EN; in cdns3_check_ep_interrupt_proceed()
1760 priv_ep->flags |= EP_UPDATE_EP_TRBADDR; in cdns3_check_ep_interrupt_proceed()
1762 cdns3_transfer_completed(priv_dev, priv_ep); in cdns3_check_ep_interrupt_proceed()
1763 } else if (!(priv_ep->flags & EP_STALLED) && in cdns3_check_ep_interrupt_proceed()
1764 !(priv_ep->flags & EP_STALL_PENDING)) { in cdns3_check_ep_interrupt_proceed()
1765 if (priv_ep->flags & EP_DEFERRED_DRDY) { in cdns3_check_ep_interrupt_proceed()
1766 priv_ep->flags &= ~EP_DEFERRED_DRDY; in cdns3_check_ep_interrupt_proceed()
1767 cdns3_start_all_request(priv_dev, priv_ep); in cdns3_check_ep_interrupt_proceed()
1769 cdns3_rearm_transfer(priv_ep, in cdns3_check_ep_interrupt_proceed()
1770 priv_ep->wa1_set); in cdns3_check_ep_interrupt_proceed()
1777 if (priv_ep->flags & EP_QUIRK_EXTRA_BUF_EN) { in cdns3_check_ep_interrupt_proceed()
1779 priv_ep->flags |= EP_QUIRK_END_TRANSFER; in cdns3_check_ep_interrupt_proceed()
1781 priv_ep->flags &= ~EP_QUIRK_END_TRANSFER; in cdns3_check_ep_interrupt_proceed()
1784 if (!priv_ep->use_streams) { in cdns3_check_ep_interrupt_proceed()
1787 cdns3_transfer_completed(priv_dev, priv_ep); in cdns3_check_ep_interrupt_proceed()
1788 } else if ((priv_ep->flags & EP_TDLCHK_EN) & in cdns3_check_ep_interrupt_proceed()
1789 priv_ep->pending_tdl) { in cdns3_check_ep_interrupt_proceed()
1791 cdns3_reprogram_tdl(priv_ep); in cdns3_check_ep_interrupt_proceed()
1793 } else if (priv_ep->dir == USB_DIR_OUT) { in cdns3_check_ep_interrupt_proceed()
1794 priv_ep->ep_sts_pending |= ep_sts_reg; in cdns3_check_ep_interrupt_proceed()
1796 cdns3_transfer_completed(priv_dev, priv_ep); in cdns3_check_ep_interrupt_proceed()
1804 if (priv_ep->dir == USB_DIR_OUT && (ep_sts_reg & EP_STS_MD_EXIT) && in cdns3_check_ep_interrupt_proceed()
1805 (priv_ep->ep_sts_pending & EP_STS_IOT) && priv_ep->use_streams) { in cdns3_check_ep_interrupt_proceed()
1806 priv_ep->ep_sts_pending = 0; in cdns3_check_ep_interrupt_proceed()
1807 cdns3_transfer_completed(priv_dev, priv_ep); in cdns3_check_ep_interrupt_proceed()
1817 !(priv_ep->flags & EP_STALLED)) in cdns3_check_ep_interrupt_proceed()
1818 cdns3_wa2_descmissing_packet(priv_ep); in cdns3_check_ep_interrupt_proceed()
2059 struct cdns3_endpoint *priv_ep) in cdns3_configure_dmult() argument
2070 if (priv_dev->dev_ver >= DEV_VER_V3 && priv_ep) { in cdns3_configure_dmult()
2073 if (priv_ep->dir) in cdns3_configure_dmult()
2074 mask = BIT(priv_ep->num + 16); in cdns3_configure_dmult()
2076 mask = BIT(priv_ep->num); in cdns3_configure_dmult()
2078 if (priv_ep->type != USB_ENDPOINT_XFER_ISOC && !priv_ep->dir) { in cdns3_configure_dmult()
2085 if (priv_ep->type == USB_ENDPOINT_XFER_ISOC && !priv_ep->dir) in cdns3_configure_dmult()
2097 int cdns3_ep_config(struct cdns3_endpoint *priv_ep, bool enable) in cdns3_ep_config() argument
2099 bool is_iso_ep = (priv_ep->type == USB_ENDPOINT_XFER_ISOC); in cdns3_ep_config()
2100 struct cdns3_device *priv_dev = priv_ep->cdns3_dev; in cdns3_ep_config()
2101 u32 bEndpointAddress = priv_ep->num | priv_ep->dir; in cdns3_ep_config()
2102 u32 max_packet_size = priv_ep->wMaxPacketSize; in cdns3_ep_config()
2103 u8 maxburst = priv_ep->bMaxBurst; in cdns3_ep_config()
2110 cdns3_configure_dmult(priv_dev, priv_ep); in cdns3_ep_config()
2112 switch (priv_ep->type) { in cdns3_ep_config()
2116 if (priv_dev->dev_ver >= DEV_VER_V2 && !priv_ep->dir) in cdns3_ep_config()
2122 if (priv_dev->dev_ver >= DEV_VER_V2 && !priv_ep->dir) in cdns3_ep_config()
2127 buffering = (priv_ep->bMaxBurst + 1) * (priv_ep->mult + 1) - 1; in cdns3_ep_config()
2138 if (priv_ep->type != USB_ENDPOINT_XFER_ISOC) { in cdns3_ep_config()
2149 priv_ep->trb_burst_size = 128; in cdns3_ep_config()
2151 priv_ep->trb_burst_size = 64; in cdns3_ep_config()
2153 priv_ep->trb_burst_size = 16; in cdns3_ep_config()
2166 priv_ep->trb_burst_size = 16; in cdns3_ep_config()
2174 !!priv_ep->dir); in cdns3_ep_config()
2184 if (priv_ep->use_streams && priv_dev->gadget.speed >= USB_SPEED_SUPER) { in cdns3_ep_config()
2186 u32 mask = BIT(priv_ep->num + (priv_ep->dir ? 16 : 0)); in cdns3_ep_config()
2201 EP_CFG_MULT(priv_ep->mult) | /* must match EP setting */ in cdns3_ep_config()
2207 priv_ep->flags |= EP_CONFIGURED; in cdns3_ep_config()
2210 priv_ep->name, ep_cfg); in cdns3_ep_config()
2217 struct cdns3_endpoint *priv_ep) in cdns3_ep_dir_is_correct() argument
2219 return (priv_ep->endpoint.caps.dir_in && usb_endpoint_dir_in(desc)) || in cdns3_ep_dir_is_correct()
2220 (priv_ep->endpoint.caps.dir_out && usb_endpoint_dir_out(desc)); in cdns3_ep_dir_is_correct()
2228 struct cdns3_endpoint *priv_ep; in cdns3_find_available_ep() local
2240 priv_ep = ep_to_cdns3_ep(ep); in cdns3_find_available_ep()
2241 if (cdns3_ep_dir_is_correct(desc, priv_ep)) { in cdns3_find_available_ep()
2242 if (!(priv_ep->flags & EP_CLAIMED)) { in cdns3_find_available_ep()
2243 priv_ep->num = num; in cdns3_find_available_ep()
2244 return priv_ep; in cdns3_find_available_ep()
2274 struct cdns3_endpoint *priv_ep; in cdns3_gadget_match_ep() local
2277 priv_ep = cdns3_find_available_ep(priv_dev, desc); in cdns3_gadget_match_ep()
2278 if (IS_ERR(priv_ep)) { in cdns3_gadget_match_ep()
2283 dev_dbg(priv_dev->dev, "match endpoint: %s\n", priv_ep->name); in cdns3_gadget_match_ep()
2286 priv_ep->endpoint.desc = desc; in cdns3_gadget_match_ep()
2287 priv_ep->dir = usb_endpoint_dir_in(desc) ? USB_DIR_IN : USB_DIR_OUT; in cdns3_gadget_match_ep()
2288 priv_ep->type = usb_endpoint_type(desc); in cdns3_gadget_match_ep()
2289 priv_ep->flags |= EP_CLAIMED; in cdns3_gadget_match_ep()
2290 priv_ep->interval = desc->bInterval ? BIT(desc->bInterval - 1) : 0; in cdns3_gadget_match_ep()
2291 priv_ep->wMaxPacketSize = usb_endpoint_maxp(desc); in cdns3_gadget_match_ep()
2292 priv_ep->mult = USB_EP_MAXP_MULT(priv_ep->wMaxPacketSize); in cdns3_gadget_match_ep()
2293 priv_ep->wMaxPacketSize &= USB_ENDPOINT_MAXP_MASK; in cdns3_gadget_match_ep()
2294 if (priv_ep->type == USB_ENDPOINT_XFER_ISOC && comp_desc) { in cdns3_gadget_match_ep()
2295 priv_ep->mult = USB_SS_MULT(comp_desc->bmAttributes) - 1; in cdns3_gadget_match_ep()
2296 priv_ep->bMaxBurst = comp_desc->bMaxBurst; in cdns3_gadget_match_ep()
2300 return &priv_ep->endpoint; in cdns3_gadget_match_ep()
2313 struct cdns3_endpoint *priv_ep = ep_to_cdns3_ep(ep); in cdns3_gadget_ep_alloc_request() local
2320 priv_req->priv_ep = priv_ep; in cdns3_gadget_ep_alloc_request()
2353 struct cdns3_endpoint *priv_ep; in cdns3_gadget_ep_enable() local
2368 priv_ep = ep_to_cdns3_ep(ep); in cdns3_gadget_ep_enable()
2369 priv_dev = priv_ep->cdns3_dev; in cdns3_gadget_ep_enable()
2370 comp_desc = priv_ep->endpoint.comp_desc; in cdns3_gadget_ep_enable()
2382 if (dev_WARN_ONCE(priv_dev->dev, priv_ep->flags & EP_ENABLED, in cdns3_gadget_ep_enable()
2383 "%s is already enabled\n", priv_ep->name)) in cdns3_gadget_ep_enable()
2388 priv_ep->endpoint.desc = desc; in cdns3_gadget_ep_enable()
2389 priv_ep->type = usb_endpoint_type(desc); in cdns3_gadget_ep_enable()
2390 priv_ep->interval = desc->bInterval ? BIT(desc->bInterval - 1) : 0; in cdns3_gadget_ep_enable()
2392 if (priv_ep->interval > ISO_MAX_INTERVAL && in cdns3_gadget_ep_enable()
2393 priv_ep->type == USB_ENDPOINT_XFER_ISOC) { in cdns3_gadget_ep_enable()
2401 bEndpointAddress = priv_ep->num | priv_ep->dir; in cdns3_gadget_ep_enable()
2412 if (priv_ep->type == USB_ENDPOINT_XFER_ISOC && !priv_ep->dir) in cdns3_gadget_ep_enable()
2424 priv_ep->use_streams = true; in cdns3_gadget_ep_enable()
2425 ret = cdns3_ep_config(priv_ep, enable); in cdns3_gadget_ep_enable()
2429 ret = cdns3_ep_config(priv_ep, enable); in cdns3_gadget_ep_enable()
2435 ret = cdns3_allocate_trb_pool(priv_ep); in cdns3_gadget_ep_enable()
2439 bEndpointAddress = priv_ep->num | priv_ep->dir; in cdns3_gadget_ep_enable()
2442 trace_cdns3_gadget_ep_enable(priv_ep); in cdns3_gadget_ep_enable()
2451 cdns3_free_trb_pool(priv_ep); in cdns3_gadget_ep_enable()
2461 cdns3_wa2_enable_detection(priv_dev, priv_ep, reg); in cdns3_gadget_ep_enable()
2466 priv_ep->flags &= ~(EP_PENDING_REQUEST | EP_STALLED | EP_STALL_PENDING | in cdns3_gadget_ep_enable()
2468 priv_ep->flags |= EP_ENABLED | EP_UPDATE_EP_TRBADDR; in cdns3_gadget_ep_enable()
2469 priv_ep->wa1_set = 0; in cdns3_gadget_ep_enable()
2470 priv_ep->enqueue = 0; in cdns3_gadget_ep_enable()
2471 priv_ep->dequeue = 0; in cdns3_gadget_ep_enable()
2473 priv_ep->pcs = !!EP_STS_CCS(reg); in cdns3_gadget_ep_enable()
2474 priv_ep->ccs = !!EP_STS_CCS(reg); in cdns3_gadget_ep_enable()
2476 priv_ep->free_trbs = priv_ep->num_trbs - 1; in cdns3_gadget_ep_enable()
2491 struct cdns3_endpoint *priv_ep; in cdns3_gadget_ep_disable() local
2505 priv_ep = ep_to_cdns3_ep(ep); in cdns3_gadget_ep_disable()
2506 priv_dev = priv_ep->cdns3_dev; in cdns3_gadget_ep_disable()
2508 if (dev_WARN_ONCE(priv_dev->dev, !(priv_ep->flags & EP_ENABLED), in cdns3_gadget_ep_disable()
2509 "%s is already disabled\n", priv_ep->name)) in cdns3_gadget_ep_disable()
2514 trace_cdns3_gadget_ep_disable(priv_ep); in cdns3_gadget_ep_disable()
2536 priv_ep->name); in cdns3_gadget_ep_disable()
2538 while (!list_empty(&priv_ep->pending_req_list)) { in cdns3_gadget_ep_disable()
2539 request = cdns3_next_request(&priv_ep->pending_req_list); in cdns3_gadget_ep_disable()
2541 cdns3_gadget_giveback(priv_ep, to_cdns3_request(request), in cdns3_gadget_ep_disable()
2545 while (!list_empty(&priv_ep->wa2_descmiss_req_list)) { in cdns3_gadget_ep_disable()
2546 priv_req = cdns3_next_priv_request(&priv_ep->wa2_descmiss_req_list); in cdns3_gadget_ep_disable()
2550 cdns3_gadget_ep_free_request(&priv_ep->endpoint, in cdns3_gadget_ep_disable()
2552 --priv_ep->wa2_counter; in cdns3_gadget_ep_disable()
2555 while (!list_empty(&priv_ep->deferred_req_list)) { in cdns3_gadget_ep_disable()
2556 request = cdns3_next_request(&priv_ep->deferred_req_list); in cdns3_gadget_ep_disable()
2558 cdns3_gadget_giveback(priv_ep, to_cdns3_request(request), in cdns3_gadget_ep_disable()
2562 priv_ep->descmis_req = NULL; in cdns3_gadget_ep_disable()
2565 priv_ep->flags &= ~EP_ENABLED; in cdns3_gadget_ep_disable()
2566 priv_ep->use_streams = false; in cdns3_gadget_ep_disable()
2585 struct cdns3_endpoint *priv_ep = ep_to_cdns3_ep(ep); in __cdns3_gadget_ep_queue() local
2586 struct cdns3_device *priv_dev = priv_ep->cdns3_dev; in __cdns3_gadget_ep_queue()
2596 ret = cdns3_wa2_gadget_ep_queue(priv_dev, priv_ep, in __cdns3_gadget_ep_queue()
2614 list_add_tail(&request->list, &priv_ep->deferred_req_list); in __cdns3_gadget_ep_queue()
2625 !(priv_ep->flags & EP_STALLED) && in __cdns3_gadget_ep_queue()
2626 !(priv_ep->flags & EP_STALL_PENDING)) in __cdns3_gadget_ep_queue()
2627 cdns3_start_all_request(priv_dev, priv_ep); in __cdns3_gadget_ep_queue()
2629 if (priv_dev->hw_configured_flag && priv_ep->prime_flag) in __cdns3_gadget_ep_queue()
2630 cdns3_start_all_request(priv_dev, priv_ep); in __cdns3_gadget_ep_queue()
2640 struct cdns3_endpoint *priv_ep; in cdns3_gadget_ep_queue() local
2648 priv_ep = ep_to_cdns3_ep(ep); in cdns3_gadget_ep_queue()
2649 priv_dev = priv_ep->cdns3_dev; in cdns3_gadget_ep_queue()
2667 priv_ep->name); in cdns3_gadget_ep_queue()
2685 struct cdns3_endpoint *priv_ep = ep_to_cdns3_ep(ep); in cdns3_gadget_ep_dequeue() local
2698 priv_dev = priv_ep->cdns3_dev; in cdns3_gadget_ep_dequeue()
2708 list_for_each_entry_safe(req, req_temp, &priv_ep->pending_req_list, in cdns3_gadget_ep_dequeue()
2716 list_for_each_entry_safe(req, req_temp, &priv_ep->deferred_req_list, in cdns3_gadget_ep_dequeue()
2736 link_trb->buffer = cpu_to_le32(TRB_BUFFER(priv_ep->trb_pool_dma + in cdns3_gadget_ep_dequeue()
2741 if (priv_ep->wa1_trb == priv_req->trb) in cdns3_gadget_ep_dequeue()
2742 cdns3_wa1_restore_cycle_bit(priv_ep); in cdns3_gadget_ep_dequeue()
2745 cdns3_gadget_giveback(priv_ep, priv_req, -ECONNRESET); in cdns3_gadget_ep_dequeue()
2747 req = cdns3_next_request(&priv_ep->pending_req_list); in cdns3_gadget_ep_dequeue()
2749 cdns3_rearm_transfer(priv_ep, 1); in cdns3_gadget_ep_dequeue()
2761 void __cdns3_gadget_ep_set_halt(struct cdns3_endpoint *priv_ep) in __cdns3_gadget_ep_set_halt() argument
2763 struct cdns3_device *priv_dev = priv_ep->cdns3_dev; in __cdns3_gadget_ep_set_halt()
2765 trace_cdns3_halt(priv_ep, 1, 0); in __cdns3_gadget_ep_set_halt()
2767 if (!(priv_ep->flags & EP_STALLED)) { in __cdns3_gadget_ep_set_halt()
2771 cdns3_ep_stall_flush(priv_ep); in __cdns3_gadget_ep_set_halt()
2773 priv_ep->flags |= EP_STALL_PENDING; in __cdns3_gadget_ep_set_halt()
2782 int __cdns3_gadget_ep_clear_halt(struct cdns3_endpoint *priv_ep) in __cdns3_gadget_ep_clear_halt() argument
2784 struct cdns3_device *priv_dev = priv_ep->cdns3_dev; in __cdns3_gadget_ep_clear_halt()
2792 trace_cdns3_halt(priv_ep, 0, 0); in __cdns3_gadget_ep_clear_halt()
2794 request = cdns3_next_request(&priv_ep->pending_req_list); in __cdns3_gadget_ep_clear_halt()
2812 priv_ep->flags &= ~(EP_STALLED | EP_STALL_PENDING); in __cdns3_gadget_ep_clear_halt()
2818 cdns3_rearm_transfer(priv_ep, 1); in __cdns3_gadget_ep_clear_halt()
2821 cdns3_start_all_request(priv_dev, priv_ep); in __cdns3_gadget_ep_clear_halt()
2834 struct cdns3_endpoint *priv_ep = ep_to_cdns3_ep(ep); in cdns3_gadget_ep_set_halt() local
2835 struct cdns3_device *priv_dev = priv_ep->cdns3_dev; in cdns3_gadget_ep_set_halt()
2839 if (!(priv_ep->flags & EP_ENABLED)) in cdns3_gadget_ep_set_halt()
2847 priv_ep->flags &= ~EP_WEDGE; in cdns3_gadget_ep_set_halt()
2848 ret = __cdns3_gadget_ep_clear_halt(priv_ep); in cdns3_gadget_ep_set_halt()
2850 __cdns3_gadget_ep_set_halt(priv_ep); in cdns3_gadget_ep_set_halt()
3035 struct cdns3_endpoint *priv_ep; in cdns3_gadget_udc_stop() local
3047 priv_ep = ep_to_cdns3_ep(ep); in cdns3_gadget_udc_stop()
3048 bEndpointAddress = priv_ep->num | priv_ep->dir; in cdns3_gadget_udc_stop()
3054 priv_ep->flags &= ~EP_CLAIMED; in cdns3_gadget_udc_stop()
3078 struct cdns3_endpoint *priv_ep; in cdns3_gadget_check_config() local
3087 priv_ep = ep_to_cdns3_ep(ep); in cdns3_gadget_check_config()
3088 if (!(priv_ep->flags & EP_CLAIMED)) in cdns3_gadget_check_config()
3091 n = (priv_ep->mult + 1) * (priv_ep->bMaxBurst + 1); in cdns3_gadget_check_config()
3098 if (priv_ep->type == USB_ENDPOINT_XFER_ISOC) in cdns3_gadget_check_config()
3103 if (priv_ep->type == USB_ENDPOINT_XFER_ISOC) in cdns3_gadget_check_config()
3153 struct cdns3_endpoint *priv_ep; in cdns3_init_eps() local
3178 priv_ep = devm_kzalloc(priv_dev->dev, sizeof(*priv_ep), in cdns3_init_eps()
3180 if (!priv_ep) in cdns3_init_eps()
3184 priv_ep->cdns3_dev = priv_dev; in cdns3_init_eps()
3185 priv_dev->eps[i] = priv_ep; in cdns3_init_eps()
3186 priv_ep->num = ep_number; in cdns3_init_eps()
3187 priv_ep->dir = ep_dir ? USB_DIR_IN : USB_DIR_OUT; in cdns3_init_eps()
3190 ret = cdns3_init_ep0(priv_dev, priv_ep); in cdns3_init_eps()
3196 snprintf(priv_ep->name, sizeof(priv_ep->name), "ep%d%s", in cdns3_init_eps()
3198 priv_ep->endpoint.name = priv_ep->name; in cdns3_init_eps()
3200 usb_ep_set_maxpacket_limit(&priv_ep->endpoint, in cdns3_init_eps()
3202 priv_ep->endpoint.max_streams = CDNS3_EP_MAX_STREAMS; in cdns3_init_eps()
3203 priv_ep->endpoint.ops = &cdns3_gadget_ep_ops; in cdns3_init_eps()
3205 priv_ep->endpoint.caps.dir_in = 1; in cdns3_init_eps()
3207 priv_ep->endpoint.caps.dir_out = 1; in cdns3_init_eps()
3210 priv_ep->endpoint.caps.type_iso = 1; in cdns3_init_eps()
3212 priv_ep->endpoint.caps.type_bulk = 1; in cdns3_init_eps()
3213 priv_ep->endpoint.caps.type_int = 1; in cdns3_init_eps()
3215 list_add_tail(&priv_ep->endpoint.ep_list, in cdns3_init_eps()
3219 priv_ep->flags = 0; in cdns3_init_eps()
3222 priv_ep->name, in cdns3_init_eps()
3223 priv_ep->endpoint.caps.type_bulk ? "BULK, INT" : "", in cdns3_init_eps()
3224 priv_ep->endpoint.caps.type_iso ? "ISO" : ""); in cdns3_init_eps()
3226 INIT_LIST_HEAD(&priv_ep->pending_req_list); in cdns3_init_eps()
3227 INIT_LIST_HEAD(&priv_ep->deferred_req_list); in cdns3_init_eps()
3228 INIT_LIST_HEAD(&priv_ep->wa2_descmiss_req_list); in cdns3_init_eps()