Lines Matching refs:req

112 #define to_xusb_req(req) container_of((req), struct xusb_req, usb_req)  argument
187 struct xusb_req *req; member
380 static int xudc_dma_send(struct xusb_ep *ep, struct xusb_req *req, in xudc_dma_send() argument
388 src = req->usb_req.dma + req->usb_req.actual; in xudc_dma_send()
389 if (req->usb_req.length) in xudc_dma_send()
434 static int xudc_dma_receive(struct xusb_ep *ep, struct xusb_req *req, in xudc_dma_receive() argument
442 dst = req->usb_req.dma + req->usb_req.actual; in xudc_dma_receive()
483 static int xudc_eptxrx(struct xusb_ep *ep, struct xusb_req *req, in xudc_eptxrx() argument
494 rc = xudc_dma_send(ep, req, bufferptr, bufferlen); in xudc_eptxrx()
496 rc = xudc_dma_receive(ep, req, bufferptr, bufferlen); in xudc_eptxrx()
551 static void xudc_done(struct xusb_ep *ep, struct xusb_req *req, int status) in xudc_done() argument
555 list_del_init(&req->queue); in xudc_done()
557 if (req->usb_req.status == -EINPROGRESS) in xudc_done()
558 req->usb_req.status = status; in xudc_done()
560 status = req->usb_req.status; in xudc_done()
564 ep->ep_usb.name, req, status); in xudc_done()
566 if (udc->dma_enabled && ep->epnumber && req->usb_req.length) in xudc_done()
567 usb_gadget_unmap_request(&udc->gadget, &req->usb_req, in xudc_done()
570 if (req->usb_req.complete) { in xudc_done()
572 req->usb_req.complete(&ep->ep_usb, &req->usb_req); in xudc_done()
586 static int xudc_read_fifo(struct xusb_ep *ep, struct xusb_req *req) in xudc_read_fifo() argument
611 buf = req->usb_req.buf + req->usb_req.actual; in xudc_read_fifo()
613 bufferspace = req->usb_req.length - req->usb_req.actual; in xudc_read_fifo()
622 if (req->usb_req.status != -EOVERFLOW) in xudc_read_fifo()
625 req->usb_req.status = -EOVERFLOW; in xudc_read_fifo()
626 xudc_done(ep, req, -EOVERFLOW); in xudc_read_fifo()
630 ret = xudc_eptxrx(ep, req, buf, count); in xudc_read_fifo()
633 req->usb_req.actual += min(count, bufferspace); in xudc_read_fifo()
635 ep->ep_usb.name, count, is_short ? "/S" : "", req, in xudc_read_fifo()
636 req->usb_req.actual, req->usb_req.length); in xudc_read_fifo()
639 if ((req->usb_req.actual == req->usb_req.length) || is_short) { in xudc_read_fifo()
640 if (udc->dma_enabled && req->usb_req.length) in xudc_read_fifo()
642 req->usb_req.dma, in xudc_read_fifo()
643 req->usb_req.actual, in xudc_read_fifo()
645 xudc_done(ep, req, 0); in xudc_read_fifo()
659 xudc_done(ep, req, -ECONNRESET); in xudc_read_fifo()
676 static int xudc_write_fifo(struct xusb_ep *ep, struct xusb_req *req) in xudc_write_fifo() argument
687 buf = req->usb_req.buf + req->usb_req.actual; in xudc_write_fifo()
689 length = req->usb_req.length - req->usb_req.actual; in xudc_write_fifo()
692 ret = xudc_eptxrx(ep, req, buf, length); in xudc_write_fifo()
695 req->usb_req.actual += length; in xudc_write_fifo()
699 if (likely(req->usb_req.length != in xudc_write_fifo()
700 req->usb_req.actual) || req->usb_req.zero) in xudc_write_fifo()
708 req->usb_req.length - req->usb_req.actual, req); in xudc_write_fifo()
711 xudc_done(ep, req, 0); in xudc_write_fifo()
721 xudc_done(ep, req, -ECONNRESET); in xudc_write_fifo()
736 struct xusb_req *req; in xudc_nuke() local
739 req = list_first_entry(&ep->queue, struct xusb_req, queue); in xudc_nuke()
740 xudc_done(ep, req, status); in xudc_nuke()
972 struct xusb_req *req; in xudc_ep_alloc_request() local
975 req = kzalloc(sizeof(*req), gfp_flags); in xudc_ep_alloc_request()
976 if (!req) { in xudc_ep_alloc_request()
981 req->ep = ep; in xudc_ep_alloc_request()
982 INIT_LIST_HEAD(&req->queue); in xudc_ep_alloc_request()
983 return &req->usb_req; in xudc_ep_alloc_request()
993 struct xusb_req *req = to_xusb_req(_req); in xudc_free_request() local
995 kfree(req); in xudc_free_request()
1005 static int __xudc_ep0_queue(struct xusb_ep *ep0, struct xusb_req *req) in __xudc_ep0_queue() argument
1020 req->usb_req.status = -EINPROGRESS; in __xudc_ep0_queue()
1021 req->usb_req.actual = 0; in __xudc_ep0_queue()
1023 list_add_tail(&req->queue, &ep0->queue); in __xudc_ep0_queue()
1026 prefetch(req->usb_req.buf); in __xudc_ep0_queue()
1027 length = req->usb_req.length; in __xudc_ep0_queue()
1030 length = req->usb_req.actual = min_t(u32, length, in __xudc_ep0_queue()
1032 memcpy(corebuf, req->usb_req.buf, length); in __xudc_ep0_queue()
1059 struct xusb_req *req = to_xusb_req(_req); in xudc_ep0_queue() local
1066 ret = __xudc_ep0_queue(ep0, req); in xudc_ep0_queue()
1083 struct xusb_req *req = to_xusb_req(_req); in xudc_ep_queue() local
1106 ret = usb_gadget_map_request(&udc->gadget, &req->usb_req, in xudc_ep_queue()
1119 if (!xudc_write_fifo(ep, req)) in xudc_ep_queue()
1120 req = NULL; in xudc_ep_queue()
1123 if (!xudc_read_fifo(ep, req)) in xudc_ep_queue()
1124 req = NULL; in xudc_ep_queue()
1128 if (req != NULL) in xudc_ep_queue()
1129 list_add_tail(&req->queue, &ep->queue); in xudc_ep_queue()
1145 struct xusb_req *req = to_xusb_req(_req); in xudc_ep_dequeue() local
1151 list_for_each_entry(req, &ep->queue, queue) { in xudc_ep_dequeue()
1152 if (&req->usb_req == _req) in xudc_ep_dequeue()
1155 if (&req->usb_req != _req) { in xudc_ep_dequeue()
1159 xudc_done(ep, req, -ECONNRESET); in xudc_ep_dequeue()
1576 struct xusb_req *req = udc->req; in xudc_setaddress() local
1579 req->usb_req.length = 0; in xudc_setaddress()
1580 ret = __xudc_ep0_queue(ep0, req); in xudc_setaddress()
1597 struct xusb_req *req = udc->req; in xudc_getstatus() local
1633 req->usb_req.length = 2; in xudc_getstatus()
1634 *(u16 *)req->usb_req.buf = cpu_to_le16(status); in xudc_getstatus()
1635 ret = __xudc_ep0_queue(ep0, req); in xudc_getstatus()
1652 struct xusb_req *req = udc->req; in xudc_set_clear_feature() local
1720 req->usb_req.length = 0; in xudc_set_clear_feature()
1721 ret = __xudc_ep0_queue(ep0, req); in xudc_set_clear_feature()
1804 struct xusb_req *req; in xudc_ep0_out() local
1809 req = list_first_entry(&ep0->queue, struct xusb_req, queue); in xudc_ep0_out()
1819 req->usb_req.actual = req->usb_req.length; in xudc_ep0_out()
1820 xudc_done(ep0, req, 0); in xudc_ep0_out()
1828 buffer = req->usb_req.buf + req->usb_req.actual; in xudc_ep0_out()
1829 req->usb_req.actual = req->usb_req.actual + bytes_to_rx; in xudc_ep0_out()
1832 if (req->usb_req.length == req->usb_req.actual) { in xudc_ep0_out()
1853 struct xusb_req *req; in xudc_ep0_in() local
1862 req = list_first_entry(&ep0->queue, struct xusb_req, queue); in xudc_ep0_in()
1863 bytes_to_tx = req->usb_req.length - req->usb_req.actual; in xudc_ep0_in()
1884 req->usb_req.actual = req->usb_req.length; in xudc_ep0_in()
1885 xudc_done(ep0, req, 0); in xudc_ep0_in()
1904 buffer = req->usb_req.buf + req->usb_req.actual; in xudc_ep0_in()
1905 req->usb_req.actual = req->usb_req.actual + length; in xudc_ep0_in()
1949 struct xusb_req *req; in xudc_nonctrl_ep_handler() local
1962 req = list_first_entry(&ep->queue, struct xusb_req, queue); in xudc_nonctrl_ep_handler()
1965 xudc_write_fifo(ep, req); in xudc_nonctrl_ep_handler()
1967 xudc_read_fifo(ep, req); in xudc_nonctrl_ep_handler()
2060 udc->req = devm_kzalloc(&pdev->dev, sizeof(struct xusb_req), in xudc_probe()
2062 if (!udc->req) in xudc_probe()
2069 udc->req->usb_req.buf = buff; in xudc_probe()