Lines Matching refs:preq

340 				       struct cdnsp_request *preq)  in cdnsp_request_to_transfer_ring()  argument
342 return cdnsp_get_transfer_ring(pdev, preq->pep, in cdnsp_request_to_transfer_ring()
343 preq->request.stream_id); in cdnsp_request_to_transfer_ring()
602 struct cdnsp_request *preq; in cdnsp_unmap_td_bounce_buffer() local
608 preq = td->preq; in cdnsp_unmap_td_bounce_buffer()
610 trace_cdnsp_bounce_unmap(td->preq, seg->bounce_len, seg->bounce_offs, in cdnsp_unmap_td_bounce_buffer()
613 if (!preq->direction) { in cdnsp_unmap_td_bounce_buffer()
623 len = sg_pcopy_from_buffer(preq->request.sg, preq->request.num_sgs, in cdnsp_unmap_td_bounce_buffer()
691 struct cdnsp_request *preq, in cdnsp_remove_request() argument
705 trace_cdnsp_remove_request_td(preq); in cdnsp_remove_request()
707 cur_td = &preq->td; in cdnsp_remove_request()
708 ep_ring = cdnsp_request_to_transfer_ring(pdev, preq); in cdnsp_remove_request()
715 hw_deq = cdnsp_get_hw_deq(pdev, pep->idx, preq->request.stream_id); in cdnsp_remove_request()
722 cdnsp_find_new_dequeue_state(pdev, pep, preq->request.stream_id, in cdnsp_remove_request()
745 cdnsp_gadget_giveback(pep, cur_td->preq, status); in cdnsp_remove_request()
894 struct cdnsp_request *preq = td->preq; in cdnsp_td_cleanup() local
903 if (preq->request.actual > preq->request.length) { in cdnsp_td_cleanup()
904 preq->request.actual = 0; in cdnsp_td_cleanup()
910 preq->pep->stream_info.td_count--; in cdnsp_td_cleanup()
912 cdnsp_gadget_giveback(preq->pep, preq, *status); in cdnsp_td_cleanup()
1014 td->preq->request.actual = td->preq->request.length - remaining; in cdnsp_process_ctrl_td()
1019 td->preq->request.actual = td->preq->request.length; in cdnsp_process_ctrl_td()
1047 struct cdnsp_request *preq = td->preq; in cdnsp_process_isoc_td() local
1059 requested = preq->request.length; in cdnsp_process_isoc_td()
1064 preq->request.status = 0; in cdnsp_process_isoc_td()
1067 preq->request.status = 0; in cdnsp_process_isoc_td()
1072 preq->request.status = -EOVERFLOW; in cdnsp_process_isoc_td()
1079 preq->request.status = 0; in cdnsp_process_isoc_td()
1088 preq->request.status = -1; in cdnsp_process_isoc_td()
1099 td->preq->request.actual += td_length; in cdnsp_process_isoc_td()
1113 td->preq->request.status = -EXDEV; in cdnsp_skip_isoc_td()
1114 td->preq->request.actual = 0; in cdnsp_skip_isoc_td()
1143 requested = td->preq->request.length; in cdnsp_process_bulk_intr_td()
1151 td->preq->request.actual = remaining; in cdnsp_process_bulk_intr_td()
1165 td->preq->request.actual = ep_trb_len; in cdnsp_process_bulk_intr_td()
1336 desc = td->preq->pep->endpoint.desc; in cdnsp_handle_tx_event()
1669 struct cdnsp_request *preq, in cdnsp_prepare_transfer() argument
1675 ep_ring = cdnsp_get_transfer_ring(pdev, preq->pep, in cdnsp_prepare_transfer()
1676 preq->request.stream_id); in cdnsp_prepare_transfer()
1681 GET_EP_CTX_STATE(preq->pep->out_ctx), in cdnsp_prepare_transfer()
1686 INIT_LIST_HEAD(&preq->td.td_list); in cdnsp_prepare_transfer()
1687 preq->td.preq = preq; in cdnsp_prepare_transfer()
1690 list_add_tail(&preq->td.td_list, &ep_ring->td_list); in cdnsp_prepare_transfer()
1692 preq->pep->stream_info.td_count++; in cdnsp_prepare_transfer()
1694 preq->td.start_seg = ep_ring->enq_seg; in cdnsp_prepare_transfer()
1695 preq->td.first_trb = ep_ring->enqueue; in cdnsp_prepare_transfer()
1712 static unsigned int count_trbs_needed(struct cdnsp_request *preq) in count_trbs_needed() argument
1714 return cdnsp_count_trbs(preq->request.dma, preq->request.length); in count_trbs_needed()
1717 static unsigned int count_sg_trbs_needed(struct cdnsp_request *preq) in count_sg_trbs_needed() argument
1722 full_len = preq->request.length; in count_sg_trbs_needed()
1724 for_each_sg(preq->request.sg, sg, preq->request.num_sgs, i) { in count_sg_trbs_needed()
1736 static void cdnsp_check_trb_math(struct cdnsp_request *preq, int running_total) in cdnsp_check_trb_math() argument
1738 if (running_total != preq->request.length) in cdnsp_check_trb_math()
1739 dev_err(preq->pep->pdev->dev, in cdnsp_check_trb_math()
1742 preq->pep->name, running_total, in cdnsp_check_trb_math()
1743 preq->request.length, preq->request.actual); in cdnsp_check_trb_math()
1767 struct cdnsp_request *preq, in cdnsp_td_remainder() argument
1782 maxp = usb_endpoint_maxp(preq->pep->endpoint.desc); in cdnsp_td_remainder()
1790 struct cdnsp_request *preq, u32 enqd_len, in cdnsp_align_td() argument
1798 max_pkt = usb_endpoint_maxp(preq->pep->endpoint.desc); in cdnsp_align_td()
1808 trace_cdnsp_bounce_align_td_split(preq, *trb_buff_len, in cdnsp_align_td()
1820 if (new_buff_len > (preq->request.length - enqd_len)) in cdnsp_align_td()
1821 new_buff_len = (preq->request.length - enqd_len); in cdnsp_align_td()
1824 if (preq->direction) { in cdnsp_align_td()
1825 sg_pcopy_to_buffer(preq->request.sg, in cdnsp_align_td()
1826 preq->request.num_mapped_sgs, in cdnsp_align_td()
1846 trace_cdnsp_bounce_map(preq, new_buff_len, enqd_len, seg->bounce_dma, in cdnsp_align_td()
1856 int cdnsp_queue_bulk_tx(struct cdnsp_device *pdev, struct cdnsp_request *preq) in cdnsp_queue_bulk_tx() argument
1873 ring = cdnsp_request_to_transfer_ring(pdev, preq); in cdnsp_queue_bulk_tx()
1877 full_len = preq->request.length; in cdnsp_queue_bulk_tx()
1879 if (preq->request.num_sgs) { in cdnsp_queue_bulk_tx()
1880 num_sgs = preq->request.num_sgs; in cdnsp_queue_bulk_tx()
1881 sg = preq->request.sg; in cdnsp_queue_bulk_tx()
1884 num_trbs = count_sg_trbs_needed(preq); in cdnsp_queue_bulk_tx()
1886 num_trbs = count_trbs_needed(preq); in cdnsp_queue_bulk_tx()
1887 addr = (u64)preq->request.dma; in cdnsp_queue_bulk_tx()
1891 pep = preq->pep; in cdnsp_queue_bulk_tx()
1894 if (preq->request.zero && preq->request.length && in cdnsp_queue_bulk_tx()
1900 ret = cdnsp_prepare_transfer(pdev, preq, num_trbs); in cdnsp_queue_bulk_tx()
1940 if (cdnsp_align_td(pdev, preq, enqd_len, in cdnsp_queue_bulk_tx()
1945 preq->td.bounce_seg = ring->enq_seg; in cdnsp_queue_bulk_tx()
1959 preq->td.last_trb = ring->enqueue; in cdnsp_queue_bulk_tx()
1964 if (!preq->direction) in cdnsp_queue_bulk_tx()
1969 full_len, preq, in cdnsp_queue_bulk_tx()
1999 cdnsp_check_trb_math(preq, enqd_len); in cdnsp_queue_bulk_tx()
2000 ret = cdnsp_giveback_first_trb(pdev, pep, preq->request.stream_id, in cdnsp_queue_bulk_tx()
2004 preq->td.drbl = 1; in cdnsp_queue_bulk_tx()
2009 int cdnsp_queue_ctrl_tx(struct cdnsp_device *pdev, struct cdnsp_request *preq) in cdnsp_queue_ctrl_tx() argument
2012 struct cdnsp_ep *pep = preq->pep; in cdnsp_queue_ctrl_tx()
2018 ep_ring = cdnsp_request_to_transfer_ring(pdev, preq); in cdnsp_queue_ctrl_tx()
2027 if (preq->request.zero && preq->request.length && in cdnsp_queue_ctrl_tx()
2028 (preq->request.length % maxp == 0)) { in cdnsp_queue_ctrl_tx()
2033 ret = cdnsp_prepare_transfer(pdev, preq, num_trbs); in cdnsp_queue_ctrl_tx()
2038 if (preq->request.length > 0) { in cdnsp_queue_ctrl_tx()
2049 length_field = TRB_LEN(preq->request.length) | in cdnsp_queue_ctrl_tx()
2053 lower_32_bits(preq->request.dma), in cdnsp_queue_ctrl_tx()
2054 upper_32_bits(preq->request.dma), length_field, in cdnsp_queue_ctrl_tx()
2066 lower_32_bits(preq->request.dma), in cdnsp_queue_ctrl_tx()
2067 upper_32_bits(preq->request.dma), 0, in cdnsp_queue_ctrl_tx()
2077 preq->td.last_trb = ep_ring->enqueue; in cdnsp_queue_ctrl_tx()
2080 if (preq->request.length == 0) in cdnsp_queue_ctrl_tx()
2085 if (preq->request.length > 0 && pdev->ep0_expect_in) in cdnsp_queue_ctrl_tx()
2099 cdnsp_ring_ep_doorbell(pdev, pep, preq->request.stream_id); in cdnsp_queue_ctrl_tx()
2148 struct cdnsp_request *preq, in cdnsp_get_burst_count() argument
2156 max_burst = preq->pep->endpoint.comp_desc->bMaxBurst; in cdnsp_get_burst_count()
2170 struct cdnsp_request *preq, in cdnsp_get_last_burst_packet_count() argument
2178 max_burst = preq->pep->endpoint.comp_desc->bMaxBurst; in cdnsp_get_last_burst_packet_count()
2198 struct cdnsp_request *preq) in cdnsp_queue_isoc_tx() argument
2215 ep_ring = preq->pep->ring; in cdnsp_queue_isoc_tx()
2217 td_len = preq->request.length; in cdnsp_queue_isoc_tx()
2219 if (preq->request.num_sgs) { in cdnsp_queue_isoc_tx()
2220 num_sgs = preq->request.num_sgs; in cdnsp_queue_isoc_tx()
2221 sg = preq->request.sg; in cdnsp_queue_isoc_tx()
2224 trbs_per_td = count_sg_trbs_needed(preq); in cdnsp_queue_isoc_tx()
2226 addr = (u64)preq->request.dma; in cdnsp_queue_isoc_tx()
2228 trbs_per_td = count_trbs_needed(preq); in cdnsp_queue_isoc_tx()
2231 ret = cdnsp_prepare_transfer(pdev, preq, trbs_per_td); in cdnsp_queue_isoc_tx()
2240 max_pkt = usb_endpoint_maxp(preq->pep->endpoint.desc); in cdnsp_queue_isoc_tx()
2247 burst_count = cdnsp_get_burst_count(pdev, preq, total_pkt_count); in cdnsp_queue_isoc_tx()
2248 last_burst_pkt = cdnsp_get_last_burst_packet_count(pdev, preq, in cdnsp_queue_isoc_tx()
2274 trb_buff_len, td_len, preq, in cdnsp_queue_isoc_tx()
2289 if (usb_endpoint_dir_out(preq->pep->endpoint.desc)) in cdnsp_queue_isoc_tx()
2298 preq->td.last_trb = ep_ring->enqueue; in cdnsp_queue_isoc_tx()
2333 cdnsp_giveback_first_trb(pdev, preq->pep, preq->request.stream_id, in cdnsp_queue_isoc_tx()
2340 list_del_init(&preq->td.td_list); in cdnsp_queue_isoc_tx()
2350 preq->td.last_trb = ep_ring->enqueue; in cdnsp_queue_isoc_tx()
2352 cdnsp_td_to_noop(pdev, ep_ring, &preq->td, true); in cdnsp_queue_isoc_tx()
2355 ep_ring->enqueue = preq->td.first_trb; in cdnsp_queue_isoc_tx()
2356 ep_ring->enq_seg = preq->td.start_seg; in cdnsp_queue_isoc_tx()