Lines Matching refs:req
266 struct omap_req *req;
268 req = kzalloc(sizeof(*req), gfp_flags);
269 if (!req)
272 INIT_LIST_HEAD(&req->queue);
274 return &req->req;
280 struct omap_req *req = container_of(_req, struct omap_req, req);
282 kfree(req);
288 done(struct omap_ep *ep, struct omap_req *req, int status)
293 list_del_init(&req->queue);
295 if (req->req.status == -EINPROGRESS)
296 req->req.status = status;
298 status = req->req.status;
301 usb_gadget_unmap_request(&udc->gadget, &req->req,
307 VDBG("complete %s req %p stat %d len %u/%u\n",
308 ep->ep.name, &req->req, status,
309 req->req.actual, req->req.length);
314 usb_gadget_giveback_request(&ep->ep, &req->req);
328 write_packet(u8 *buf, struct omap_req *req, unsigned max)
333 len = min(req->req.length - req->req.actual, max);
334 req->req.actual += len;
354 static int write_fifo(struct omap_ep *ep, struct omap_req *req)
361 buf = req->req.buf + req->req.actual;
370 count = write_packet(buf, req, count);
377 else if (req->req.length == req->req.actual
378 && !req->req.zero)
388 done(ep, req, 0);
393 read_packet(u8 *buf, struct omap_req *req, unsigned avail)
398 len = min(req->req.length - req->req.actual, avail);
399 req->req.actual += len;
416 static int read_fifo(struct omap_ep *ep, struct omap_req *req)
422 buf = req->req.buf + req->req.actual;
443 count = read_packet(buf, req, avail);
450 req->req.status = -EOVERFLOW;
455 } else if (req->req.length == req->req.actual)
463 done(ep, req, 0);
513 static void next_in_dma(struct omap_ep *ep, struct omap_req *req)
516 unsigned length = req->req.length - req->req.actual;
538 OMAP_DMA_AMODE_POST_INC, req->req.dma + req->req.actual,
547 req->dma_bytes = length;
550 static void finish_in_dma(struct omap_ep *ep, struct omap_req *req, int status)
555 req->req.actual += req->dma_bytes;
558 if (req->req.actual < req->req.length)
560 if (req->req.zero
561 && req->dma_bytes != 0
562 && (req->req.actual % ep->maxpacket) == 0)
565 req->req.actual += dma_src_len(ep, req->req.dma
566 + req->req.actual);
573 done(ep, req, status);
576 static void next_out_dma(struct omap_ep *ep, struct omap_req *req)
578 unsigned packets = req->req.length - req->req.actual;
585 req->dma_bytes = packets * ep->ep.maxpacket;
591 OMAP_DMA_AMODE_POST_INC, req->req.dma + req->req.actual,
606 finish_out_dma(struct omap_ep *ep, struct omap_req *req, int status, int one)
611 ep->dma_counter = (u16) (req->req.dma + req->req.actual);
612 count = dma_dest_len(ep, req->req.dma + req->req.actual);
613 count += req->req.actual;
616 if (count <= req->req.length)
617 req->req.actual = count;
619 if (count != req->dma_bytes || status)
623 else if (req->req.actual < req->req.length)
630 done(ep, req, status);
637 struct omap_req *req;
645 req = container_of(ep->queue.next,
647 finish_in_dma(ep, req, 0);
652 req = container_of(ep->queue.next,
654 next_in_dma(ep, req);
664 req = container_of(ep->queue.next,
666 finish_out_dma(ep, req, 0, dman_stat & UDC_DMA_RX_SB);
671 req = container_of(ep->queue.next,
673 next_out_dma(ep, req);
787 struct omap_req *req;
788 req = container_of(ep->queue.next, struct omap_req, queue);
790 (is_in ? next_in_dma : next_out_dma)(ep, req);
793 (is_in ? write_fifo : read_fifo)(ep, req);
808 struct omap_req *req;
813 req = container_of(ep->queue.next, struct omap_req, queue);
815 req = NULL;
822 ep->dma_channel - 1, req);
833 if (req) {
834 finish_in_dma(ep, req, -ECONNRESET);
850 if (req)
851 finish_out_dma(ep, req, -ECONNRESET, 0);
866 struct omap_req *req = container_of(_req, struct omap_req, req);
872 if (!_req || !req->req.complete || !req->req.buf
873 || !list_empty(&req->queue)) {
882 if (req->req.length > ep->ep.maxpacket)
894 && (req->req.length % ep->ep.maxpacket) != 0) {
904 usb_gadget_map_request(&udc->gadget, &req->req,
907 VDBG("%s queue req %p, len %d buf %p\n",
912 req->req.status = -EINPROGRESS;
913 req->req.actual = 0;
933 if (!req->req.length) {
961 done(ep, req, 0);
962 req = NULL;
981 (is_in ? next_in_dma : next_out_dma)(ep, req);
982 else if (req) {
983 if ((is_in ? write_fifo : read_fifo)(ep, req) == 1)
984 req = NULL;
996 if (req != NULL)
997 list_add_tail(&req->queue, &ep->queue);
1006 struct omap_req *req;
1015 list_for_each_entry(req, &ep->queue, queue) {
1016 if (&req->req == _req)
1019 if (&req->req != _req) {
1024 if (use_dma && ep->dma_channel && ep->queue.next == &req->queue) {
1033 done(ep, req, -ECONNRESET);
1329 struct omap_req *req;
1342 req = list_entry(ep->queue.next, struct omap_req, queue);
1343 done(ep, req, status);
1392 struct omap_req *req = NULL;
1418 req = container_of(ep0->queue.next, struct omap_req, queue);
1432 if (req)
1433 stat = write_fifo(ep0, req);
1435 if (!req && udc->ep0_pending) {
1445 if (req)
1446 done(ep0, req, 0);
1448 req = NULL;
1470 stat = read_fifo(ep0, req);
1471 if (!req || stat < 0) {
1481 done(ep0, req, 0);
1493 if (req)
1494 done(ep0, req, 0);
1702 VDBG("req %02x.%02x protocol STALL; stat %d\n",
1870 struct omap_req *req;
1873 req = container_of(ep->queue.next,
1875 (void) read_fifo(ep, req);
1893 struct omap_req *req;
1914 req = container_of(ep->queue.next,
1916 stat = read_fifo(ep, req);
1948 req = container_of(ep->queue.next,
1950 (void) write_fifo(ep, req);
1977 struct omap_req *req;
1981 req = list_entry(ep->queue.next, struct omap_req, queue);
1991 /* done(ep, req, -EPROTO) */;
1993 write_fifo(ep, req);
2005 /* done(ep, req, status) */;
2007 read_fifo(ep, req);
2144 struct omap_req *req;
2194 list_for_each_entry(req, &ep->queue, queue) {
2195 unsigned length = req->req.actual;
2200 (ep, req->req.dma + length);
2204 &req->req, length,
2205 req->req.length, req->req.buf);
2322 seq_printf(s, "ULPD control %04x req %04x status %04x\n",