Lines Matching refs:ci_req

264 	struct ci_req *ci_req;  in ci_ep_alloc_request()  local
272 ci_req = calloc(1, sizeof(*ci_req)); in ci_ep_alloc_request()
273 if (!ci_req) in ci_ep_alloc_request()
276 INIT_LIST_HEAD(&ci_req->queue); in ci_ep_alloc_request()
279 controller.ep0_req = ci_req; in ci_ep_alloc_request()
281 return &ci_req->req; in ci_ep_alloc_request()
287 struct ci_req *ci_req = container_of(req, struct ci_req, req); in ci_ep_free_request() local
299 if (ci_req->b_buf) in ci_ep_free_request()
300 free(ci_req->b_buf); in ci_ep_free_request()
301 free(ci_req); in ci_ep_free_request()
357 static int ci_bounce(struct ci_req *ci_req, int in) in ci_bounce() argument
359 struct usb_request *req = &ci_req->req; in ci_bounce()
373 ci_req->hw_len = req->length; in ci_bounce()
374 ci_req->hw_buf = req->buf; in ci_bounce()
378 if (ci_req->b_buf && req->length > ci_req->b_len) { in ci_bounce()
379 free(ci_req->b_buf); in ci_bounce()
380 ci_req->b_buf = 0; in ci_bounce()
382 if (!ci_req->b_buf) { in ci_bounce()
383 ci_req->b_len = roundup(req->length, ARCH_DMA_MINALIGN); in ci_bounce()
384 ci_req->b_buf = memalign(ARCH_DMA_MINALIGN, ci_req->b_len); in ci_bounce()
385 if (!ci_req->b_buf) in ci_bounce()
388 ci_req->hw_len = ci_req->b_len; in ci_bounce()
389 ci_req->hw_buf = ci_req->b_buf; in ci_bounce()
392 memcpy(ci_req->hw_buf, req->buf, req->length); in ci_bounce()
395 hwaddr = (unsigned long)ci_req->hw_buf; in ci_bounce()
402 static void ci_debounce(struct ci_req *ci_req, int in) in ci_debounce() argument
404 struct usb_request *req = &ci_req->req; in ci_debounce()
406 unsigned long hwaddr = (unsigned long)ci_req->hw_buf; in ci_debounce()
418 memcpy(req->buf, ci_req->hw_buf, req->actual); in ci_debounce()
427 struct ci_req *ci_req; in ci_ep_submit_next_request() local
439 ci_req = list_first_entry(&ci_ep->queue, struct ci_req, queue); in ci_ep_submit_next_request()
440 len = ci_req->req.length; in ci_ep_submit_next_request()
445 ci_req->dtd_count = 0; in ci_ep_submit_next_request()
446 buf = ci_req->hw_buf; in ci_ep_submit_next_request()
471 ci_req->dtd_count++; in ci_ep_submit_next_request()
491 if (in && len && !(len % ci_ep->ep.maxpacket) && ci_req->req.zero) { in ci_ep_submit_next_request()
517 num, in ? "in" : "out", len, ci_req, ci_req->hw_buf); in ci_ep_submit_next_request()
531 struct ci_req *ci_req; in ci_ep_dequeue() local
533 list_for_each_entry(ci_req, &ci_ep->queue, queue) { in ci_ep_dequeue()
534 if (&ci_req->req == _req) in ci_ep_dequeue()
538 if (&ci_req->req != _req) in ci_ep_dequeue()
541 list_del_init(&ci_req->queue); in ci_ep_dequeue()
543 if (ci_req->req.status == -EINPROGRESS) { in ci_ep_dequeue()
544 ci_req->req.status = -ECONNRESET; in ci_ep_dequeue()
545 if (ci_req->req.complete) in ci_ep_dequeue()
546 ci_req->req.complete(_ep, _req); in ci_ep_dequeue()
556 struct ci_req *ci_req = container_of(req, struct ci_req, req); in ci_ep_queue() local
578 ret = ci_bounce(ci_req, in); in ci_ep_queue()
583 num, in ? "in" : "out", ci_req, ci_req->hw_buf); in ci_ep_queue()
584 list_add_tail(&ci_req->queue, &ci_ep->queue); in ci_ep_queue()
607 struct ci_req *ci_req; in handle_ep_complete() local
613 ci_req = list_first_entry(&ci_ep->queue, struct ci_req, queue); in handle_ep_complete()
617 for (j = 0; j < ci_req->dtd_count; j++) { in handle_ep_complete()
624 if (j != ci_req->dtd_count - 1) in handle_ep_complete()
631 list_del_init(&ci_req->queue); in handle_ep_complete()
637 ci_req->req.actual = ci_req->req.length - len; in handle_ep_complete()
638 ci_debounce(ci_req, in); in handle_ep_complete()
641 num, in ? "in" : "out", ci_req, len); in handle_ep_complete()
643 ci_req->req.complete(&ci_ep->ep, &ci_req->req); in handle_ep_complete()
652 ci_req->req.length = 0; in handle_ep_complete()
653 usb_ep_queue(&ci_ep->ep, &ci_req->req, 0); in handle_ep_complete()
662 struct ci_req *ci_req; in handle_setup() local
671 ci_req = controller.ep0_req; in handle_setup()
672 req = &ci_req->req; in handle_setup()
703 list_del_init(&ci_req->queue); in handle_setup()