Lines Matching full:request
32 static inline void map_dma_buffer(struct musb_request *request, in map_dma_buffer() argument
38 request->map_state = UN_MAPPED; in map_dma_buffer()
43 /* Check if DMA engine can handle this request. in map_dma_buffer()
44 * DMA code must reject the USB request explicitly. in map_dma_buffer()
45 * Default behaviour is to map the request. in map_dma_buffer()
49 musb_ep->packet_sz, request->request.buf, in map_dma_buffer()
50 request->request.length); in map_dma_buffer()
54 if (request->request.dma == DMA_ADDR_INVALID) { in map_dma_buffer()
60 request->request.buf, in map_dma_buffer()
61 request->request.length, in map_dma_buffer()
62 request->tx in map_dma_buffer()
69 request->request.dma = dma_addr; in map_dma_buffer()
70 request->map_state = MUSB_MAPPED; in map_dma_buffer()
73 request->request.dma, in map_dma_buffer()
74 request->request.length, in map_dma_buffer()
75 request->tx in map_dma_buffer()
78 request->map_state = PRE_MAPPED; in map_dma_buffer()
83 static inline void unmap_dma_buffer(struct musb_request *request, in unmap_dma_buffer() argument
86 struct musb_ep *musb_ep = request->ep; in unmap_dma_buffer()
88 if (!is_buffer_mapped(request) || !musb_ep->dma) in unmap_dma_buffer()
91 if (request->request.dma == DMA_ADDR_INVALID) { in unmap_dma_buffer()
96 if (request->map_state == MUSB_MAPPED) { in unmap_dma_buffer()
98 request->request.dma, in unmap_dma_buffer()
99 request->request.length, in unmap_dma_buffer()
100 request->tx in unmap_dma_buffer()
103 request->request.dma = DMA_ADDR_INVALID; in unmap_dma_buffer()
106 request->request.dma, in unmap_dma_buffer()
107 request->request.length, in unmap_dma_buffer()
108 request->tx in unmap_dma_buffer()
112 request->map_state = UN_MAPPED; in unmap_dma_buffer()
116 * Immediately complete a request.
118 * @param request the request to complete
119 * @param status the status to complete the request with
124 struct usb_request *request, in musb_g_giveback() argument
133 req = to_musb_request(request); in musb_g_giveback()
136 if (req->request.status == -EINPROGRESS) in musb_g_giveback()
137 req->request.status = status; in musb_g_giveback()
143 if (!dma_mapping_error(&musb->g.dev, request->dma)) in musb_g_giveback()
147 usb_gadget_giveback_request(&req->ep->end_point, &req->request); in musb_g_giveback()
195 musb_g_giveback(ep, &req->request, status); in nuke()
218 * the IRQ routine or from ep.queue() to kickstart a request on an
228 struct usb_request *request; in txstate() local
236 musb_dbg(musb, "ep:%s disabled - ignore request", in txstate()
250 request = &req->request; in txstate()
252 (int)(request->length - request->actual)); in txstate()
276 request_size = min_t(size_t, request->length - request->actual, in txstate()
279 use_dma = (request->dma != DMA_ADDR_INVALID && request_size); in txstate()
292 request->dma + request->actual, request_size); in txstate()
360 request->dma + request->actual, in txstate()
372 request->zero, in txstate()
373 request->dma + request->actual, in txstate()
386 (u8 *) (request->buf + request->actual)); in txstate()
387 request->actual += fifo_count; in txstate()
396 request->actual, request->length, in txstate()
410 struct usb_request *request; in musb_g_tx() local
418 request = &req->request; in musb_g_tx()
442 epnum, request); in musb_g_tx()
465 request->actual += musb_ep->dma->actual_len; in musb_g_tx()
467 epnum, csr, musb_ep->dma->actual_len, request); in musb_g_tx()
474 if ((request->zero && request->length) in musb_g_tx()
475 && (request->length % musb_ep->packet_sz == 0) in musb_g_tx()
476 && (request->actual == request->length)) { in musb_g_tx()
487 request->zero = 0; in musb_g_tx()
490 if (request->actual == request->length) { in musb_g_tx()
491 musb_g_giveback(musb_ep, request, 0); in musb_g_tx()
521 struct usb_request *request = &req->request; in rxstate() local
539 musb_dbg(musb, "ep:%s disabled - ignore request", in rxstate()
567 !request->short_not_ok, in rxstate()
568 request->dma + request->actual, in rxstate()
569 request->length - request->actual)) { in rxstate()
592 if (request->short_not_ok && fifo_count == musb_ep->packet_sz) in rxstate()
597 if (request->actual < request->length) { in rxstate()
615 * in advance. For mass storage class, request->length = what the host in rxstate()
617 * request->length is routinely more than what the host sends. For in rxstate()
648 request->length - in rxstate()
649 request->actual, in rxstate()
659 transfer_size = min(request->length - request->actual, in rxstate()
668 request->dma in rxstate()
669 + request->actual, in rxstate()
677 (request->actual < request->length)) { in rxstate()
689 else if (request->short_not_ok) in rxstate()
691 request->length - in rxstate()
692 request->actual, in rxstate()
696 request->length - in rxstate()
697 request->actual, in rxstate()
718 request->dma in rxstate()
719 + request->actual, in rxstate()
725 len = request->length - request->actual; in rxstate()
736 u32 dma_addr = request->dma + request->actual; in rxstate()
764 request->length - request->actual, in rxstate()
767 (request->buf + request->actual)); in rxstate()
768 request->actual += fifo_count; in rxstate()
782 if (request->actual == request->length || in rxstate()
784 musb_g_giveback(musb_ep, request, 0); in rxstate()
788 * Data ready for a request; called from IRQ
794 struct usb_request *request; in musb_g_rx() local
813 request = &req->request; in musb_g_rx()
819 csr, dma ? " (dma)" : "", request); in musb_g_rx()
833 musb_dbg(musb, "%s iso overrun on %p", musb_ep->name, request); in musb_g_rx()
834 if (request->status == -EINPROGRESS) in musb_g_rx()
835 request->status = -EOVERFLOW; in musb_g_rx()
856 request->actual += musb_ep->dma->actual_len; in musb_g_rx()
870 if ((request->actual < request->length) in musb_g_rx()
883 musb_g_giveback(musb_ep, request, 0); in musb_g_rx()
902 /* Analyze request */ in musb_g_rx()
1127 * Allocate a request for an endpoint.
1133 struct musb_request *request = NULL; in musb_alloc_request() local
1135 request = kzalloc(sizeof *request, gfp_flags); in musb_alloc_request()
1136 if (!request) in musb_alloc_request()
1139 request->request.dma = DMA_ADDR_INVALID; in musb_alloc_request()
1140 request->epnum = musb_ep->current_epnum; in musb_alloc_request()
1141 request->ep = musb_ep; in musb_alloc_request()
1143 trace_musb_req_alloc(request); in musb_alloc_request()
1144 return &request->request; in musb_alloc_request()
1148 * Free a request
1153 struct musb_request *request = to_musb_request(req); in musb_free_request() local
1155 trace_musb_req_free(request); in musb_free_request()
1156 kfree(request); in musb_free_request()
1194 struct musb_request *request; in musb_gadget_queue() local
1207 request = to_musb_request(req); in musb_gadget_queue()
1208 request->musb = musb; in musb_gadget_queue()
1210 if (request->ep != musb_ep) in musb_gadget_queue()
1224 trace_musb_req_enq(request); in musb_gadget_queue()
1226 /* request is mine now... */ in musb_gadget_queue()
1227 request->request.actual = 0; in musb_gadget_queue()
1228 request->request.status = -EINPROGRESS; in musb_gadget_queue()
1229 request->epnum = musb_ep->current_epnum; in musb_gadget_queue()
1230 request->tx = musb_ep->is_in; in musb_gadget_queue()
1232 map_dma_buffer(request, musb, musb_ep); in musb_gadget_queue()
1241 unmap_dma_buffer(request, musb); in musb_gadget_queue()
1245 /* add request to the list */ in musb_gadget_queue()
1246 list_add_tail(&request->list, &musb_ep->req_list); in musb_gadget_queue()
1249 if (!musb_ep->busy && &request->list == musb_ep->req_list.next) { in musb_gadget_queue()
1252 request); in musb_gadget_queue()
1256 list_del(&request->list); in musb_gadget_queue()
1268 static int musb_gadget_dequeue(struct usb_ep *ep, struct usb_request *request) in musb_gadget_dequeue() argument
1271 struct musb_request *req = to_musb_request(request); in musb_gadget_dequeue()
1277 if (!ep || !request || req->ep != musb_ep) in musb_gadget_dequeue()
1289 dev_err(musb->controller, "request %p not queued to %s\n", in musb_gadget_dequeue()
1290 request, ep->name); in musb_gadget_dequeue()
1295 /* if the hardware doesn't have the request, easy ... */ in musb_gadget_dequeue()
1297 musb_g_giveback(musb_ep, request, -ECONNRESET); in musb_gadget_dequeue()
1309 musb_g_giveback(musb_ep, request, -ECONNRESET); in musb_gadget_dequeue()
1314 musb_g_giveback(musb_ep, request, -ECONNRESET); in musb_gadget_dequeue()
1337 struct musb_request *request; in musb_gadget_set_halt() local
1353 request = next_request(musb_ep); in musb_gadget_set_halt()
1355 if (request) { in musb_gadget_set_halt()
1356 musb_dbg(musb, "request in progress, cannot halt %s", in musb_gadget_set_halt()
1400 /* maybe start the first request in the queue */ in musb_gadget_set_halt()
1401 if (!musb_ep->busy && !value && request) { in musb_gadget_set_halt()
1402 musb_dbg(musb, "restarting the request"); in musb_gadget_set_halt()
1403 musb_ep_restart(musb, request); in musb_gadget_set_halt()