Lines Matching refs:req

270 	struct omap_req	*req;  in omap_alloc_request()  local
272 req = kzalloc(sizeof(*req), gfp_flags); in omap_alloc_request()
273 if (!req) in omap_alloc_request()
276 INIT_LIST_HEAD(&req->queue); in omap_alloc_request()
278 return &req->req; in omap_alloc_request()
284 struct omap_req *req = container_of(_req, struct omap_req, req); in omap_free_request() local
286 kfree(req); in omap_free_request()
292 done(struct omap_ep *ep, struct omap_req *req, int status) in done() argument
297 list_del_init(&req->queue); in done()
299 if (req->req.status == -EINPROGRESS) in done()
300 req->req.status = status; in done()
302 status = req->req.status; in done()
305 usb_gadget_unmap_request(&udc->gadget, &req->req, in done()
312 ep->ep.name, &req->req, status, in done()
313 req->req.actual, req->req.length); in done()
318 usb_gadget_giveback_request(&ep->ep, &req->req); in done()
332 write_packet(u8 *buf, struct omap_req *req, unsigned max) in write_packet() argument
337 len = min(req->req.length - req->req.actual, max); in write_packet()
338 req->req.actual += len; in write_packet()
358 static int write_fifo(struct omap_ep *ep, struct omap_req *req) in write_fifo() argument
365 buf = req->req.buf + req->req.actual; in write_fifo()
374 count = write_packet(buf, req, count); in write_fifo()
381 else if (req->req.length == req->req.actual in write_fifo()
382 && !req->req.zero) in write_fifo()
392 done(ep, req, 0); in write_fifo()
397 read_packet(u8 *buf, struct omap_req *req, unsigned avail) in read_packet() argument
402 len = min(req->req.length - req->req.actual, avail); in read_packet()
403 req->req.actual += len; in read_packet()
420 static int read_fifo(struct omap_ep *ep, struct omap_req *req) in read_fifo() argument
426 buf = req->req.buf + req->req.actual; in read_fifo()
447 count = read_packet(buf, req, avail); in read_fifo()
454 req->req.status = -EOVERFLOW; in read_fifo()
459 } else if (req->req.length == req->req.actual) in read_fifo()
467 done(ep, req, 0); in read_fifo()
517 static void next_in_dma(struct omap_ep *ep, struct omap_req *req) in next_in_dma() argument
520 unsigned length = req->req.length - req->req.actual; in next_in_dma()
542 OMAP_DMA_AMODE_POST_INC, req->req.dma + req->req.actual, in next_in_dma()
551 req->dma_bytes = length; in next_in_dma()
554 static void finish_in_dma(struct omap_ep *ep, struct omap_req *req, int status) in finish_in_dma() argument
559 req->req.actual += req->dma_bytes; in finish_in_dma()
562 if (req->req.actual < req->req.length) in finish_in_dma()
564 if (req->req.zero in finish_in_dma()
565 && req->dma_bytes != 0 in finish_in_dma()
566 && (req->req.actual % ep->maxpacket) == 0) in finish_in_dma()
569 req->req.actual += dma_src_len(ep, req->req.dma in finish_in_dma()
570 + req->req.actual); in finish_in_dma()
577 done(ep, req, status); in finish_in_dma()
580 static void next_out_dma(struct omap_ep *ep, struct omap_req *req) in next_out_dma() argument
582 unsigned packets = req->req.length - req->req.actual; in next_out_dma()
589 req->dma_bytes = packets * ep->ep.maxpacket; in next_out_dma()
595 OMAP_DMA_AMODE_POST_INC, req->req.dma + req->req.actual, in next_out_dma()
610 finish_out_dma(struct omap_ep *ep, struct omap_req *req, int status, int one) in finish_out_dma() argument
615 ep->dma_counter = (u16) (req->req.dma + req->req.actual); in finish_out_dma()
616 count = dma_dest_len(ep, req->req.dma + req->req.actual); in finish_out_dma()
617 count += req->req.actual; in finish_out_dma()
620 if (count <= req->req.length) in finish_out_dma()
621 req->req.actual = count; in finish_out_dma()
623 if (count != req->dma_bytes || status) in finish_out_dma()
627 else if (req->req.actual < req->req.length) in finish_out_dma()
634 done(ep, req, status); in finish_out_dma()
641 struct omap_req *req; in dma_irq() local
649 req = container_of(ep->queue.next, in dma_irq()
651 finish_in_dma(ep, req, 0); in dma_irq()
656 req = container_of(ep->queue.next, in dma_irq()
658 next_in_dma(ep, req); in dma_irq()
668 req = container_of(ep->queue.next, in dma_irq()
670 finish_out_dma(ep, req, 0, dman_stat & UDC_DMA_RX_SB); in dma_irq()
675 req = container_of(ep->queue.next, in dma_irq()
677 next_out_dma(ep, req); in dma_irq()
791 struct omap_req *req; in dma_channel_claim() local
792 req = container_of(ep->queue.next, struct omap_req, queue); in dma_channel_claim()
794 (is_in ? next_in_dma : next_out_dma)(ep, req); in dma_channel_claim()
797 (is_in ? write_fifo : read_fifo)(ep, req); in dma_channel_claim()
812 struct omap_req *req; in dma_channel_release() local
817 req = container_of(ep->queue.next, struct omap_req, queue); in dma_channel_release()
819 req = NULL; in dma_channel_release()
826 ep->dma_channel - 1, req); in dma_channel_release()
837 if (req) { in dma_channel_release()
838 finish_in_dma(ep, req, -ECONNRESET); in dma_channel_release()
854 if (req) in dma_channel_release()
855 finish_out_dma(ep, req, -ECONNRESET, 0); in dma_channel_release()
870 struct omap_req *req = container_of(_req, struct omap_req, req); in omap_ep_queue() local
876 if (!_req || !req->req.complete || !req->req.buf in omap_ep_queue()
877 || !list_empty(&req->queue)) { in omap_ep_queue()
886 if (req->req.length > ep->ep.maxpacket) in omap_ep_queue()
898 && (req->req.length % ep->ep.maxpacket) != 0) { in omap_ep_queue()
908 usb_gadget_map_request(&udc->gadget, &req->req, in omap_ep_queue()
916 req->req.status = -EINPROGRESS; in omap_ep_queue()
917 req->req.actual = 0; in omap_ep_queue()
937 if (!req->req.length) { in omap_ep_queue()
965 done(ep, req, 0); in omap_ep_queue()
966 req = NULL; in omap_ep_queue()
985 (is_in ? next_in_dma : next_out_dma)(ep, req); in omap_ep_queue()
986 else if (req) { in omap_ep_queue()
987 if ((is_in ? write_fifo : read_fifo)(ep, req) == 1) in omap_ep_queue()
988 req = NULL; in omap_ep_queue()
1000 if (req != NULL) in omap_ep_queue()
1001 list_add_tail(&req->queue, &ep->queue); in omap_ep_queue()
1010 struct omap_req *req; in omap_ep_dequeue() local
1019 list_for_each_entry(req, &ep->queue, queue) { in omap_ep_dequeue()
1020 if (&req->req == _req) in omap_ep_dequeue()
1023 if (&req->req != _req) { in omap_ep_dequeue()
1028 if (use_dma && ep->dma_channel && ep->queue.next == &req->queue) { in omap_ep_dequeue()
1037 done(ep, req, -ECONNRESET); in omap_ep_dequeue()
1333 struct omap_req *req; in nuke() local
1346 req = list_entry(ep->queue.next, struct omap_req, queue); in nuke()
1347 done(ep, req, status); in nuke()
1396 struct omap_req *req = NULL; in ep0_irq() local
1422 req = container_of(ep0->queue.next, struct omap_req, queue); in ep0_irq()
1436 if (req) in ep0_irq()
1437 stat = write_fifo(ep0, req); in ep0_irq()
1439 if (!req && udc->ep0_pending) { in ep0_irq()
1449 if (req) in ep0_irq()
1450 done(ep0, req, 0); in ep0_irq()
1452 req = NULL; in ep0_irq()
1474 stat = read_fifo(ep0, req); in ep0_irq()
1475 if (!req || stat < 0) { in ep0_irq()
1485 done(ep0, req, 0); in ep0_irq()
1497 if (req) in ep0_irq()
1498 done(ep0, req, 0); in ep0_irq()
1874 struct omap_req *req; in pio_out_timer() local
1877 req = container_of(ep->queue.next, in pio_out_timer()
1879 (void) read_fifo(ep, req); in pio_out_timer()
1897 struct omap_req *req; in omap_udc_pio_irq() local
1918 req = container_of(ep->queue.next, in omap_udc_pio_irq()
1920 stat = read_fifo(ep, req); in omap_udc_pio_irq()
1952 req = container_of(ep->queue.next, in omap_udc_pio_irq()
1954 (void) write_fifo(ep, req); in omap_udc_pio_irq()
1981 struct omap_req *req; in omap_udc_iso_irq() local
1985 req = list_entry(ep->queue.next, struct omap_req, queue); in omap_udc_iso_irq()
1997 write_fifo(ep, req); in omap_udc_iso_irq()
2011 read_fifo(ep, req); in omap_udc_iso_irq()
2147 struct omap_req *req; in proc_ep_show() local
2197 list_for_each_entry(req, &ep->queue, queue) { in proc_ep_show()
2198 unsigned length = req->req.actual; in proc_ep_show()
2203 (ep, req->req.dma + length); in proc_ep_show()
2207 &req->req, length, in proc_ep_show()
2208 req->req.length, req->req.buf); in proc_ep_show()