Lines Matching refs:hwreq
357 static int add_td_to_list(struct ci_hw_ep *hwep, struct ci_hw_req *hwreq,
378 u32 mul = hwreq->req.length / hwep->ep.maxpacket;
380 if (hwreq->req.length == 0
381 || hwreq->req.length % hwep->ep.maxpacket)
387 temp = (u32) (sg_dma_address(s) + hwreq->req.actual);
390 temp = (u32) (hwreq->req.dma + hwreq->req.actual);
402 hwreq->req.actual += length;
404 if (!list_empty(&hwreq->tds)) {
406 lastnode = list_entry(hwreq->tds.prev,
412 list_add_tail(&node->td, &hwreq->tds);
427 struct ci_hw_req *hwreq)
429 unsigned int rest = hwreq->req.length;
434 ret = add_td_to_list(hwep, hwreq, 0, NULL);
443 if (hwreq->req.dma % PAGE_SIZE)
447 unsigned int count = min(hwreq->req.length - hwreq->req.actual,
450 ret = add_td_to_list(hwep, hwreq, count, NULL);
457 if (hwreq->req.zero && hwreq->req.length && hwep->dir == TX
458 && (hwreq->req.length % hwep->ep.maxpacket == 0)) {
459 ret = add_td_to_list(hwep, hwreq, 0, NULL);
467 static int prepare_td_per_sg(struct ci_hw_ep *hwep, struct ci_hw_req *hwreq,
473 hwreq->req.actual = 0;
478 ret = add_td_to_list(hwep, hwreq, count, s);
507 static int prepare_td_for_sg(struct ci_hw_ep *hwep, struct ci_hw_req *hwreq)
509 struct usb_request *req = &hwreq->req;
529 ret = prepare_td_per_sg(hwep, hwreq, s);
533 node = list_entry(hwreq->tds.prev,
546 * @hwreq: request
550 static int _hardware_enqueue(struct ci_hw_ep *hwep, struct ci_hw_req *hwreq)
557 if (hwreq->req.status == -EALREADY)
560 hwreq->req.status = -EALREADY;
563 &hwreq->req, hwep->dir);
567 if (hwreq->req.num_mapped_sgs)
568 ret = prepare_td_for_sg(hwep, hwreq);
570 ret = prepare_td_for_non_sg(hwep, hwreq);
575 lastnode = list_entry(hwreq->tds.prev,
579 if (!hwreq->req.no_interrupt)
582 list_for_each_entry_safe(firstnode, lastnode, &hwreq->tds, td)
583 trace_ci_prepare_td(hwep, hwreq, firstnode);
585 firstnode = list_first_entry(&hwreq->tds, struct td_node, td);
589 hwreq->req.actual = 0;
627 u32 mul = hwreq->req.length / hwep->ep.maxpacket;
629 if (hwreq->req.length == 0
630 || hwreq->req.length % hwep->ep.maxpacket)
668 * @hwreq: request
672 static int _hardware_dequeue(struct ci_hw_ep *hwep, struct ci_hw_req *hwreq)
677 unsigned actual = hwreq->req.length;
680 if (hwreq->req.status != -EALREADY)
683 hwreq->req.status = 0;
685 list_for_each_entry_safe(node, tmpnode, &hwreq->tds, td) {
687 trace_ci_complete_td(hwep, hwreq, node);
694 hwreq->req.status = -EALREADY;
702 hwreq->req.status = tmptoken & TD_STATUS;
703 if ((TD_STATUS_HALTED & hwreq->req.status)) {
704 hwreq->req.status = -EPIPE;
706 } else if ((TD_STATUS_DT_ERR & hwreq->req.status)) {
707 hwreq->req.status = -EPROTO;
709 } else if ((TD_STATUS_TR_ERR & hwreq->req.status)) {
710 hwreq->req.status = -EILSEQ;
716 hwreq->req.status = -EPROTO;
733 &hwreq->req, hwep->dir);
735 hwreq->req.actual += actual;
737 if (hwreq->req.status)
738 return hwreq->req.status;
740 return hwreq->req.actual;
763 struct ci_hw_req *hwreq = list_entry(hwep->qh.queue.next,
766 list_for_each_entry_safe(node, tmpnode, &hwreq->tds, td) {
773 list_del_init(&hwreq->queue);
774 hwreq->req.status = -ESHUTDOWN;
776 if (hwreq->req.complete != NULL) {
778 usb_gadget_giveback_request(&hwep->ep, &hwreq->req);
932 struct ci_hw_req *hwreq = container_of(req, struct ci_hw_req, req);
951 hwreq->req.length > hwep->ep.mult * hwep->ep.maxpacket) {
957 if (!list_empty(&hwreq->queue)) {
963 hwreq->req.status = -EINPROGRESS;
964 hwreq->req.actual = 0;
966 retval = _hardware_enqueue(hwep, hwreq);
971 list_add_tail(&hwreq->queue, &hwep->qh.queue);
1104 struct ci_hw_req *hwreq, *hwreqtemp;
1108 list_for_each_entry_safe(hwreq, hwreqtemp, &hwep->qh.queue,
1110 retval = _hardware_dequeue(hwep, hwreq);
1113 list_del_init(&hwreq->queue);
1114 if (hwreq->req.complete != NULL) {
1117 hwreq->req.length)
1119 usb_gadget_giveback_request(&hweptemp->ep, &hwreq->req);
1466 struct ci_hw_req *hwreq;
1471 hwreq = kzalloc(sizeof(struct ci_hw_req), gfp_flags);
1472 if (hwreq != NULL) {
1473 INIT_LIST_HEAD(&hwreq->queue);
1474 INIT_LIST_HEAD(&hwreq->tds);
1477 return (hwreq == NULL) ? NULL : &hwreq->req;
1488 struct ci_hw_req *hwreq = container_of(req, struct ci_hw_req, req);
1494 } else if (!list_empty(&hwreq->queue)) {
1501 list_for_each_entry_safe(node, tmpnode, &hwreq->tds, td) {
1508 kfree(hwreq);
1546 struct ci_hw_req *hwreq = container_of(req, struct ci_hw_req, req);
1550 if (ep == NULL || req == NULL || hwreq->req.status != -EALREADY ||
1551 hwep->ep.desc == NULL || list_empty(&hwreq->queue) ||
1559 list_for_each_entry_safe(node, tmpnode, &hwreq->tds, td) {
1566 list_del_init(&hwreq->queue);
1572 if (hwreq->req.complete != NULL) {
1574 usb_gadget_giveback_request(&hwep->ep, &hwreq->req);