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()
723 cdnsp_find_new_dequeue_state(pdev, pep, preq->request.stream_id, in cdnsp_remove_request()
747 cdnsp_gadget_giveback(pep, cur_td->preq, status); in cdnsp_remove_request()
896 struct cdnsp_request *preq = td->preq; in cdnsp_td_cleanup() local
905 if (preq->request.actual > preq->request.length) { in cdnsp_td_cleanup()
906 preq->request.actual = 0; in cdnsp_td_cleanup()
912 preq->pep->stream_info.td_count--; in cdnsp_td_cleanup()
914 cdnsp_gadget_giveback(preq->pep, preq, *status); in cdnsp_td_cleanup()
1016 td->preq->request.actual = td->preq->request.length - remaining; in cdnsp_process_ctrl_td()
1021 td->preq->request.actual = td->preq->request.length; in cdnsp_process_ctrl_td()
1049 struct cdnsp_request *preq = td->preq; in cdnsp_process_isoc_td() local
1061 requested = preq->request.length; in cdnsp_process_isoc_td()
1066 preq->request.status = 0; in cdnsp_process_isoc_td()
1069 preq->request.status = 0; in cdnsp_process_isoc_td()
1074 preq->request.status = -EOVERFLOW; in cdnsp_process_isoc_td()
1081 preq->request.status = 0; in cdnsp_process_isoc_td()
1090 preq->request.status = -1; in cdnsp_process_isoc_td()
1101 td->preq->request.actual += td_length; in cdnsp_process_isoc_td()
1115 td->preq->request.status = -EXDEV; in cdnsp_skip_isoc_td()
1116 td->preq->request.actual = 0; in cdnsp_skip_isoc_td()
1145 requested = td->preq->request.length; in cdnsp_process_bulk_intr_td()
1153 td->preq->request.actual = remaining; in cdnsp_process_bulk_intr_td()
1167 td->preq->request.actual = ep_trb_len; in cdnsp_process_bulk_intr_td()
1338 desc = td->preq->pep->endpoint.desc; in cdnsp_handle_tx_event()
1674 struct cdnsp_request *preq, in cdnsp_prepare_transfer() argument
1680 ep_ring = cdnsp_get_transfer_ring(pdev, preq->pep, in cdnsp_prepare_transfer()
1681 preq->request.stream_id); in cdnsp_prepare_transfer()
1686 GET_EP_CTX_STATE(preq->pep->out_ctx), in cdnsp_prepare_transfer()
1691 INIT_LIST_HEAD(&preq->td.td_list); in cdnsp_prepare_transfer()
1692 preq->td.preq = preq; in cdnsp_prepare_transfer()
1695 list_add_tail(&preq->td.td_list, &ep_ring->td_list); in cdnsp_prepare_transfer()
1697 preq->pep->stream_info.td_count++; in cdnsp_prepare_transfer()
1699 preq->td.start_seg = ep_ring->enq_seg; in cdnsp_prepare_transfer()
1700 preq->td.first_trb = ep_ring->enqueue; in cdnsp_prepare_transfer()
1717 static unsigned int count_trbs_needed(struct cdnsp_request *preq) in count_trbs_needed() argument
1719 return cdnsp_count_trbs(preq->request.dma, preq->request.length); in count_trbs_needed()
1722 static unsigned int count_sg_trbs_needed(struct cdnsp_request *preq) in count_sg_trbs_needed() argument
1727 full_len = preq->request.length; in count_sg_trbs_needed()
1729 for_each_sg(preq->request.sg, sg, preq->request.num_sgs, i) { in count_sg_trbs_needed()
1741 static void cdnsp_check_trb_math(struct cdnsp_request *preq, int running_total) in cdnsp_check_trb_math() argument
1743 if (running_total != preq->request.length) in cdnsp_check_trb_math()
1744 dev_err(preq->pep->pdev->dev, in cdnsp_check_trb_math()
1747 preq->pep->name, running_total, in cdnsp_check_trb_math()
1748 preq->request.length, preq->request.actual); in cdnsp_check_trb_math()
1772 struct cdnsp_request *preq, in cdnsp_td_remainder() argument
1787 maxp = usb_endpoint_maxp(preq->pep->endpoint.desc); in cdnsp_td_remainder()
1795 struct cdnsp_request *preq, u32 enqd_len, in cdnsp_align_td() argument
1803 max_pkt = usb_endpoint_maxp(preq->pep->endpoint.desc); in cdnsp_align_td()
1813 trace_cdnsp_bounce_align_td_split(preq, *trb_buff_len, in cdnsp_align_td()
1825 if (new_buff_len > (preq->request.length - enqd_len)) in cdnsp_align_td()
1826 new_buff_len = (preq->request.length - enqd_len); in cdnsp_align_td()
1829 if (preq->direction) { in cdnsp_align_td()
1830 sg_pcopy_to_buffer(preq->request.sg, in cdnsp_align_td()
1831 preq->request.num_mapped_sgs, in cdnsp_align_td()
1851 trace_cdnsp_bounce_map(preq, new_buff_len, enqd_len, seg->bounce_dma, in cdnsp_align_td()
1861 int cdnsp_queue_bulk_tx(struct cdnsp_device *pdev, struct cdnsp_request *preq) in cdnsp_queue_bulk_tx() argument
1878 ring = cdnsp_request_to_transfer_ring(pdev, preq); in cdnsp_queue_bulk_tx()
1882 full_len = preq->request.length; in cdnsp_queue_bulk_tx()
1884 if (preq->request.num_sgs) { in cdnsp_queue_bulk_tx()
1885 num_sgs = preq->request.num_sgs; in cdnsp_queue_bulk_tx()
1886 sg = preq->request.sg; in cdnsp_queue_bulk_tx()
1889 num_trbs = count_sg_trbs_needed(preq); in cdnsp_queue_bulk_tx()
1891 num_trbs = count_trbs_needed(preq); in cdnsp_queue_bulk_tx()
1892 addr = (u64)preq->request.dma; in cdnsp_queue_bulk_tx()
1896 pep = preq->pep; in cdnsp_queue_bulk_tx()
1899 if (preq->request.zero && preq->request.length && in cdnsp_queue_bulk_tx()
1905 ret = cdnsp_prepare_transfer(pdev, preq, num_trbs); in cdnsp_queue_bulk_tx()
1962 if (cdnsp_align_td(pdev, preq, enqd_len, in cdnsp_queue_bulk_tx()
1967 preq->td.bounce_seg = ring->enq_seg; in cdnsp_queue_bulk_tx()
1981 preq->td.last_trb = ring->enqueue; in cdnsp_queue_bulk_tx()
1986 if (!preq->direction) in cdnsp_queue_bulk_tx()
1991 full_len, preq, in cdnsp_queue_bulk_tx()
2032 cdnsp_check_trb_math(preq, enqd_len); in cdnsp_queue_bulk_tx()
2033 ret = cdnsp_giveback_first_trb(pdev, pep, preq->request.stream_id, in cdnsp_queue_bulk_tx()
2037 preq->td.drbl = 1; in cdnsp_queue_bulk_tx()
2042 int cdnsp_queue_ctrl_tx(struct cdnsp_device *pdev, struct cdnsp_request *preq) in cdnsp_queue_ctrl_tx() argument
2045 struct cdnsp_ep *pep = preq->pep; in cdnsp_queue_ctrl_tx()
2051 ep_ring = cdnsp_request_to_transfer_ring(pdev, preq); in cdnsp_queue_ctrl_tx()
2060 if (preq->request.zero && preq->request.length && in cdnsp_queue_ctrl_tx()
2061 (preq->request.length % maxp == 0)) { in cdnsp_queue_ctrl_tx()
2066 ret = cdnsp_prepare_transfer(pdev, preq, num_trbs); in cdnsp_queue_ctrl_tx()
2071 if (preq->request.length > 0) { in cdnsp_queue_ctrl_tx()
2082 length_field = TRB_LEN(preq->request.length) | in cdnsp_queue_ctrl_tx()
2086 lower_32_bits(preq->request.dma), in cdnsp_queue_ctrl_tx()
2087 upper_32_bits(preq->request.dma), length_field, in cdnsp_queue_ctrl_tx()
2099 lower_32_bits(preq->request.dma), in cdnsp_queue_ctrl_tx()
2100 upper_32_bits(preq->request.dma), 0, in cdnsp_queue_ctrl_tx()
2110 preq->td.last_trb = ep_ring->enqueue; in cdnsp_queue_ctrl_tx()
2113 if (preq->request.length == 0) in cdnsp_queue_ctrl_tx()
2118 if (preq->request.length > 0 && pdev->ep0_expect_in) in cdnsp_queue_ctrl_tx()
2132 cdnsp_ring_ep_doorbell(pdev, pep, preq->request.stream_id); in cdnsp_queue_ctrl_tx()
2168 struct cdnsp_request *preq, in cdnsp_get_burst_count() argument
2176 max_burst = preq->pep->endpoint.comp_desc->bMaxBurst; in cdnsp_get_burst_count()
2190 struct cdnsp_request *preq, in cdnsp_get_last_burst_packet_count() argument
2198 max_burst = preq->pep->endpoint.comp_desc->bMaxBurst; in cdnsp_get_last_burst_packet_count()
2218 struct cdnsp_request *preq) in cdnsp_queue_isoc_tx() argument
2235 ep_ring = preq->pep->ring; in cdnsp_queue_isoc_tx()
2237 td_len = preq->request.length; in cdnsp_queue_isoc_tx()
2239 if (preq->request.num_sgs) { in cdnsp_queue_isoc_tx()
2240 num_sgs = preq->request.num_sgs; in cdnsp_queue_isoc_tx()
2241 sg = preq->request.sg; in cdnsp_queue_isoc_tx()
2244 trbs_per_td = count_sg_trbs_needed(preq); in cdnsp_queue_isoc_tx()
2246 addr = (u64)preq->request.dma; in cdnsp_queue_isoc_tx()
2248 trbs_per_td = count_trbs_needed(preq); in cdnsp_queue_isoc_tx()
2251 ret = cdnsp_prepare_transfer(pdev, preq, trbs_per_td); in cdnsp_queue_isoc_tx()
2260 max_pkt = usb_endpoint_maxp(preq->pep->endpoint.desc); in cdnsp_queue_isoc_tx()
2267 burst_count = cdnsp_get_burst_count(pdev, preq, total_pkt_count); in cdnsp_queue_isoc_tx()
2268 last_burst_pkt = cdnsp_get_last_burst_packet_count(pdev, preq, in cdnsp_queue_isoc_tx()
2294 trb_buff_len, td_len, preq, in cdnsp_queue_isoc_tx()
2309 if (usb_endpoint_dir_out(preq->pep->endpoint.desc)) in cdnsp_queue_isoc_tx()
2318 preq->td.last_trb = ep_ring->enqueue; in cdnsp_queue_isoc_tx()
2353 cdnsp_giveback_first_trb(pdev, preq->pep, preq->request.stream_id, in cdnsp_queue_isoc_tx()
2360 list_del_init(&preq->td.td_list); in cdnsp_queue_isoc_tx()
2370 preq->td.last_trb = ep_ring->enqueue; in cdnsp_queue_isoc_tx()
2372 cdnsp_td_to_noop(pdev, ep_ring, &preq->td, true); in cdnsp_queue_isoc_tx()
2375 ep_ring->enqueue = preq->td.first_trb; in cdnsp_queue_isoc_tx()
2376 ep_ring->enq_seg = preq->td.start_seg; in cdnsp_queue_isoc_tx()