H A D | udc.c | 341 static int add_td_to_list(struct ci_hw_ep *hwep, struct ci_hw_req *hwreq, add_td_to_list() argument 364 u32 mul = hwreq->req.length / hwep->ep.maxpacket; add_td_to_list() 366 if (hwreq->req.length == 0 add_td_to_list() 367 || hwreq->req.length % hwep->ep.maxpacket) add_td_to_list() 372 temp = (u32) (hwreq->req.dma + hwreq->req.actual); add_td_to_list() 382 hwreq->req.actual += length; add_td_to_list() 384 if (!list_empty(&hwreq->tds)) { add_td_to_list() 386 lastnode = list_entry(hwreq->tds.prev, add_td_to_list() 392 list_add_tail(&node->td, &hwreq->tds); add_td_to_list() 413 static int _hardware_enqueue(struct ci_hw_ep *hwep, struct ci_hw_req *hwreq) _hardware_enqueue() argument 417 unsigned rest = hwreq->req.length; _hardware_enqueue() 422 if (hwreq->req.status == -EALREADY) _hardware_enqueue() 425 hwreq->req.status = -EALREADY; _hardware_enqueue() 427 ret = usb_gadget_map_request(&ci->gadget, &hwreq->req, hwep->dir); _hardware_enqueue() 435 if (hwreq->req.dma % PAGE_SIZE) _hardware_enqueue() 439 add_td_to_list(hwep, hwreq, 0); _hardware_enqueue() 442 unsigned count = min(hwreq->req.length - hwreq->req.actual, _hardware_enqueue() 444 add_td_to_list(hwep, hwreq, count); _hardware_enqueue() 448 if (hwreq->req.zero && hwreq->req.length _hardware_enqueue() 449 && (hwreq->req.length % hwep->ep.maxpacket == 0)) _hardware_enqueue() 450 add_td_to_list(hwep, hwreq, 0); _hardware_enqueue() 452 firstnode = list_first_entry(&hwreq->tds, struct td_node, td); _hardware_enqueue() 454 lastnode = list_entry(hwreq->tds.prev, _hardware_enqueue() 458 if (!hwreq->req.no_interrupt) _hardware_enqueue() 462 hwreq->req.actual = 0; _hardware_enqueue() 494 u32 mul = hwreq->req.length / hwep->ep.maxpacket; _hardware_enqueue() 496 if (hwreq->req.length == 0 _hardware_enqueue() 497 || hwreq->req.length % hwep->ep.maxpacket) _hardware_enqueue() 544 static int _hardware_dequeue(struct ci_hw_ep *hwep, struct ci_hw_req *hwreq) _hardware_dequeue() argument 549 unsigned actual = hwreq->req.length; _hardware_dequeue() 552 if (hwreq->req.status != -EALREADY) _hardware_dequeue() 555 hwreq->req.status = 0; _hardware_dequeue() 557 list_for_each_entry_safe(node, tmpnode, &hwreq->tds, td) { _hardware_dequeue() 565 hwreq->req.status = -EALREADY; _hardware_dequeue() 573 hwreq->req.status = tmptoken & TD_STATUS; _hardware_dequeue() 574 if ((TD_STATUS_HALTED & hwreq->req.status)) { _hardware_dequeue() 575 hwreq->req.status = -EPIPE; _hardware_dequeue() 577 } else if ((TD_STATUS_DT_ERR & hwreq->req.status)) { _hardware_dequeue() 578 hwreq->req.status = -EPROTO; _hardware_dequeue() 580 } else if ((TD_STATUS_TR_ERR & hwreq->req.status)) { _hardware_dequeue() 581 hwreq->req.status = -EILSEQ; _hardware_dequeue() 587 hwreq->req.status = -EPROTO; _hardware_dequeue() 603 usb_gadget_unmap_request(&hwep->ci->gadget, &hwreq->req, hwep->dir); _hardware_dequeue() 605 hwreq->req.actual += actual; _hardware_dequeue() 607 if (hwreq->req.status) _hardware_dequeue() 608 return hwreq->req.status; _hardware_dequeue() 610 return hwreq->req.actual; _hardware_dequeue() 633 struct ci_hw_req *hwreq = list_entry(hwep->qh.queue.next, variable in typeref:struct:ci_hw_req 636 list_for_each_entry_safe(node, tmpnode, &hwreq->tds, td) { 643 list_del_init(&hwreq->queue); 644 hwreq->req.status = -ESHUTDOWN; 646 if (hwreq->req.complete != NULL) { 648 usb_gadget_giveback_request(&hwep->ep, &hwreq->req); 798 struct ci_hw_req *hwreq = container_of(req, struct ci_hw_req, req); _ep_queue() local 818 hwreq->req.length > (1 + hwep->ep.mult) * hwep->ep.maxpacket) { _ep_queue() 824 if (!list_empty(&hwreq->queue)) { _ep_queue() 830 hwreq->req.status = -EINPROGRESS; _ep_queue() 831 hwreq->req.actual = 0; _ep_queue() 833 retval = _hardware_enqueue(hwep, hwreq); _ep_queue() 838 list_add_tail(&hwreq->queue, &hwep->qh.queue); _ep_queue() 962 struct ci_hw_req *hwreq, *hwreqtemp; variable in typeref:struct:ci_hw_req 966 list_for_each_entry_safe(hwreq, hwreqtemp, &hwep->qh.queue, 968 retval = _hardware_dequeue(hwep, hwreq); 971 list_del_init(&hwreq->queue); 972 if (hwreq->req.complete != NULL) { 975 hwreq->req.length) 977 usb_gadget_giveback_request(&hweptemp->ep, &hwreq->req); 1312 struct ci_hw_req *hwreq = NULL; ep_alloc_request() local 1317 hwreq = kzalloc(sizeof(struct ci_hw_req), gfp_flags); ep_alloc_request() 1318 if (hwreq != NULL) { ep_alloc_request() 1319 INIT_LIST_HEAD(&hwreq->queue); ep_alloc_request() 1320 INIT_LIST_HEAD(&hwreq->tds); ep_alloc_request() 1323 return (hwreq == NULL) ? NULL : &hwreq->req; ep_alloc_request() 1334 struct ci_hw_req *hwreq = container_of(req, struct ci_hw_req, req); ep_free_request() local 1340 } else if (!list_empty(&hwreq->queue)) { ep_free_request() 1347 list_for_each_entry_safe(node, tmpnode, &hwreq->tds, td) { ep_free_request() 1354 kfree(hwreq); ep_free_request() 1388 struct ci_hw_req *hwreq = container_of(req, struct ci_hw_req, req); ep_dequeue() local 1392 if (ep == NULL || req == NULL || hwreq->req.status != -EALREADY || ep_dequeue() 1393 hwep->ep.desc == NULL || list_empty(&hwreq->queue) || ep_dequeue() 1401 list_for_each_entry_safe(node, tmpnode, &hwreq->tds, td) { ep_dequeue() 1408 list_del_init(&hwreq->queue); ep_dequeue() 1414 if (hwreq->req.complete != NULL) { ep_dequeue() 1416 usb_gadget_giveback_request(&hwep->ep, &hwreq->req); ep_dequeue()
|