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()
454 if (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->buf + request->actual)); in rxstate()
765 request->actual += fifo_count; in rxstate()
779 if (request->actual == request->length || in rxstate()
781 musb_g_giveback(musb_ep, request, 0); in rxstate()
785 * Data ready for a request; called from IRQ
791 struct usb_request *request; in musb_g_rx() local
810 request = &req->request; in musb_g_rx()
816 csr, dma ? " (dma)" : "", request); in musb_g_rx()
830 musb_dbg(musb, "%s iso overrun on %p", musb_ep->name, request); in musb_g_rx()
831 if (request->status == -EINPROGRESS) in musb_g_rx()
832 request->status = -EOVERFLOW; in musb_g_rx()
853 request->actual += musb_ep->dma->actual_len; in musb_g_rx()
867 if ((request->actual < request->length) in musb_g_rx()
880 musb_g_giveback(musb_ep, request, 0); in musb_g_rx()
899 /* Analyze request */ in musb_g_rx()
1125 * Allocate a request for an endpoint.
1131 struct musb_request *request = NULL; in musb_alloc_request() local
1133 request = kzalloc(sizeof *request, gfp_flags); in musb_alloc_request()
1134 if (!request) in musb_alloc_request()
1137 request->request.dma = DMA_ADDR_INVALID; in musb_alloc_request()
1138 request->epnum = musb_ep->current_epnum; in musb_alloc_request()
1139 request->ep = musb_ep; in musb_alloc_request()
1141 trace_musb_req_alloc(request); in musb_alloc_request()
1142 return &request->request; in musb_alloc_request()
1146 * Free a request
1151 struct musb_request *request = to_musb_request(req); in musb_free_request() local
1153 trace_musb_req_free(request); in musb_free_request()
1154 kfree(request); in musb_free_request()
1192 struct musb_request *request; in musb_gadget_queue() local
1205 request = to_musb_request(req); in musb_gadget_queue()
1206 request->musb = musb; in musb_gadget_queue()
1208 if (request->ep != musb_ep) in musb_gadget_queue()
1222 trace_musb_req_enq(request); in musb_gadget_queue()
1224 /* request is mine now... */ in musb_gadget_queue()
1225 request->request.actual = 0; in musb_gadget_queue()
1226 request->request.status = -EINPROGRESS; in musb_gadget_queue()
1227 request->epnum = musb_ep->current_epnum; in musb_gadget_queue()
1228 request->tx = musb_ep->is_in; in musb_gadget_queue()
1230 map_dma_buffer(request, musb, musb_ep); in musb_gadget_queue()
1239 unmap_dma_buffer(request, musb); in musb_gadget_queue()
1243 /* add request to the list */ in musb_gadget_queue()
1244 list_add_tail(&request->list, &musb_ep->req_list); in musb_gadget_queue()
1247 if (!musb_ep->busy && &request->list == musb_ep->req_list.next) { in musb_gadget_queue()
1250 request); in musb_gadget_queue()
1264 static int musb_gadget_dequeue(struct usb_ep *ep, struct usb_request *request) in musb_gadget_dequeue() argument
1267 struct musb_request *req = to_musb_request(request); in musb_gadget_dequeue()
1273 if (!ep || !request || req->ep != musb_ep) in musb_gadget_dequeue()
1285 dev_err(musb->controller, "request %p not queued to %s\n", in musb_gadget_dequeue()
1286 request, ep->name); in musb_gadget_dequeue()
1291 /* if the hardware doesn't have the request, easy ... */ in musb_gadget_dequeue()
1293 musb_g_giveback(musb_ep, request, -ECONNRESET); in musb_gadget_dequeue()
1305 musb_g_giveback(musb_ep, request, -ECONNRESET); in musb_gadget_dequeue()
1310 musb_g_giveback(musb_ep, request, -ECONNRESET); in musb_gadget_dequeue()
1333 struct musb_request *request; in musb_gadget_set_halt() local
1349 request = next_request(musb_ep); in musb_gadget_set_halt()
1351 if (request) { in musb_gadget_set_halt()
1352 musb_dbg(musb, "request in progress, cannot halt %s", in musb_gadget_set_halt()
1396 /* maybe start the first request in the queue */ in musb_gadget_set_halt()
1397 if (!musb_ep->busy && !value && request) { in musb_gadget_set_halt()
1398 musb_dbg(musb, "restarting the request"); in musb_gadget_set_halt()
1399 musb_ep_restart(musb, request); in musb_gadget_set_halt()