Lines Matching refs:ci_req

267 	struct ci_req *ci_req;  in ci_ep_alloc_request()  local
275 ci_req = calloc(1, sizeof(*ci_req)); in ci_ep_alloc_request()
276 if (!ci_req) in ci_ep_alloc_request()
279 INIT_LIST_HEAD(&ci_req->queue); in ci_ep_alloc_request()
282 controller.ep0_req = ci_req; in ci_ep_alloc_request()
284 return &ci_req->req; in ci_ep_alloc_request()
290 struct ci_req *ci_req = container_of(req, struct ci_req, req); in ci_ep_free_request() local
302 if (ci_req->b_buf) in ci_ep_free_request()
303 free(ci_req->b_buf); in ci_ep_free_request()
304 free(ci_req); in ci_ep_free_request()
360 static int ci_bounce(struct ci_req *ci_req, int in) in ci_bounce() argument
362 struct usb_request *req = &ci_req->req; in ci_bounce()
376 ci_req->hw_len = req->length; in ci_bounce()
377 ci_req->hw_buf = req->buf; in ci_bounce()
381 if (ci_req->b_buf && req->length > ci_req->b_len) { in ci_bounce()
382 free(ci_req->b_buf); in ci_bounce()
383 ci_req->b_buf = 0; in ci_bounce()
385 if (!ci_req->b_buf) { in ci_bounce()
386 ci_req->b_len = roundup(req->length, ARCH_DMA_MINALIGN); in ci_bounce()
387 ci_req->b_buf = memalign(ARCH_DMA_MINALIGN, ci_req->b_len); in ci_bounce()
388 if (!ci_req->b_buf) in ci_bounce()
391 ci_req->hw_len = ci_req->b_len; in ci_bounce()
392 ci_req->hw_buf = ci_req->b_buf; in ci_bounce()
395 memcpy(ci_req->hw_buf, req->buf, req->length); in ci_bounce()
398 hwaddr = (unsigned long)ci_req->hw_buf; in ci_bounce()
405 static void ci_debounce(struct ci_req *ci_req, int in) in ci_debounce() argument
407 struct usb_request *req = &ci_req->req; in ci_debounce()
409 unsigned long hwaddr = (unsigned long)ci_req->hw_buf; in ci_debounce()
421 memcpy(req->buf, ci_req->hw_buf, req->actual); in ci_debounce()
430 struct ci_req *ci_req; in ci_ep_submit_next_request() local
442 ci_req = list_first_entry(&ci_ep->queue, struct ci_req, queue); in ci_ep_submit_next_request()
443 len = ci_req->req.length; in ci_ep_submit_next_request()
448 ci_req->dtd_count = 0; in ci_ep_submit_next_request()
449 buf = ci_req->hw_buf; in ci_ep_submit_next_request()
474 ci_req->dtd_count++; in ci_ep_submit_next_request()
494 if (in && len && !(len % ci_ep->ep.maxpacket) && ci_req->req.zero) { in ci_ep_submit_next_request()
520 num, in ? "in" : "out", len, ci_req, ci_req->hw_buf); in ci_ep_submit_next_request()
534 struct ci_req *ci_req; in ci_ep_dequeue() local
536 list_for_each_entry(ci_req, &ci_ep->queue, queue) { in ci_ep_dequeue()
537 if (&ci_req->req == _req) in ci_ep_dequeue()
541 if (&ci_req->req != _req) in ci_ep_dequeue()
544 list_del_init(&ci_req->queue); in ci_ep_dequeue()
546 if (ci_req->req.status == -EINPROGRESS) { in ci_ep_dequeue()
547 ci_req->req.status = -ECONNRESET; in ci_ep_dequeue()
548 if (ci_req->req.complete) in ci_ep_dequeue()
549 ci_req->req.complete(_ep, _req); in ci_ep_dequeue()
559 struct ci_req *ci_req = container_of(req, struct ci_req, req); in ci_ep_queue() local
581 ret = ci_bounce(ci_req, in); in ci_ep_queue()
586 num, in ? "in" : "out", ci_req, ci_req->hw_buf); in ci_ep_queue()
587 list_add_tail(&ci_req->queue, &ci_ep->queue); in ci_ep_queue()
610 struct ci_req *ci_req; in handle_ep_complete() local
616 ci_req = list_first_entry(&ci_ep->queue, struct ci_req, queue); in handle_ep_complete()
620 for (j = 0; j < ci_req->dtd_count; j++) { in handle_ep_complete()
627 if (j != ci_req->dtd_count - 1) in handle_ep_complete()
634 list_del_init(&ci_req->queue); in handle_ep_complete()
640 ci_req->req.actual = ci_req->req.length - len; in handle_ep_complete()
641 ci_debounce(ci_req, in); in handle_ep_complete()
644 num, in ? "in" : "out", ci_req, len); in handle_ep_complete()
646 ci_req->req.complete(&ci_ep->ep, &ci_req->req); in handle_ep_complete()
655 ci_req->req.length = 0; in handle_ep_complete()
656 usb_ep_queue(&ci_ep->ep, &ci_req->req, 0); in handle_ep_complete()
665 struct ci_req *ci_req; in handle_setup() local
674 ci_req = controller.ep0_req; in handle_setup()
675 req = &ci_req->req; in handle_setup()
706 list_del_init(&ci_req->queue); in handle_setup()