Lines Matching refs:qtd

483 static int oxu_buf_alloc(struct oxu_hcd *oxu, struct ehci_qtd *qtd, int len)  in oxu_buf_alloc()  argument
517 qtd->buffer = (void *) &oxu->mem->db_pool[i]; in oxu_buf_alloc()
518 qtd->buffer_dma = virt_to_phys(qtd->buffer); in oxu_buf_alloc()
520 qtd->qtd_buffer_len = BUFFER_SIZE * a_blocks; in oxu_buf_alloc()
535 static void oxu_buf_free(struct oxu_hcd *oxu, struct ehci_qtd *qtd) in oxu_buf_free() argument
541 index = (qtd->buffer - (void *) &oxu->mem->db_pool[0]) in oxu_buf_free()
544 qtd->qtd_buffer_len = 0; in oxu_buf_free()
545 qtd->buffer_dma = 0; in oxu_buf_free()
546 qtd->buffer = NULL; in oxu_buf_free()
551 static inline void ehci_qtd_init(struct ehci_qtd *qtd, dma_addr_t dma) in ehci_qtd_init() argument
553 memset(qtd, 0, sizeof *qtd); in ehci_qtd_init()
554 qtd->qtd_dma = dma; in ehci_qtd_init()
555 qtd->hw_token = cpu_to_le32(QTD_STS_HALT); in ehci_qtd_init()
556 qtd->hw_next = EHCI_LIST_END; in ehci_qtd_init()
557 qtd->hw_alt_next = EHCI_LIST_END; in ehci_qtd_init()
558 INIT_LIST_HEAD(&qtd->qtd_list); in ehci_qtd_init()
561 static inline void oxu_qtd_free(struct oxu_hcd *oxu, struct ehci_qtd *qtd) in oxu_qtd_free() argument
565 if (qtd->buffer) in oxu_qtd_free()
566 oxu_buf_free(oxu, qtd); in oxu_qtd_free()
570 index = qtd - &oxu->mem->qtd_pool[0]; in oxu_qtd_free()
579 struct ehci_qtd *qtd = NULL; in ehci_qtd_alloc() local
588 qtd = (struct ehci_qtd *) &oxu->mem->qtd_pool[i]; in ehci_qtd_alloc()
589 memset(qtd, 0, sizeof *qtd); in ehci_qtd_alloc()
591 qtd->hw_token = cpu_to_le32(QTD_STS_HALT); in ehci_qtd_alloc()
592 qtd->hw_next = EHCI_LIST_END; in ehci_qtd_alloc()
593 qtd->hw_alt_next = EHCI_LIST_END; in ehci_qtd_alloc()
594 INIT_LIST_HEAD(&qtd->qtd_list); in ehci_qtd_alloc()
596 qtd->qtd_dma = virt_to_phys(qtd); in ehci_qtd_alloc()
603 return qtd; in ehci_qtd_alloc()
782 static int qtd_fill(struct ehci_qtd *qtd, dma_addr_t buf, size_t len, in qtd_fill() argument
789 qtd->hw_buf[0] = cpu_to_le32((u32)addr); in qtd_fill()
790 qtd->hw_buf_hi[0] = cpu_to_le32((u32)(addr >> 32)); in qtd_fill()
801 qtd->hw_buf[i] = cpu_to_le32((u32)addr); in qtd_fill()
802 qtd->hw_buf_hi[i] = cpu_to_le32((u32)(addr >> 32)); in qtd_fill()
814 qtd->hw_token = cpu_to_le32((count << 16) | token); in qtd_fill()
815 qtd->length = count; in qtd_fill()
821 struct ehci_qh *qh, struct ehci_qtd *qtd) in qh_update() argument
826 qh->hw_qtd_next = QTD_NEXT(qtd->qtd_dma); in qh_update()
837 is_out = !(qtd->hw_token & cpu_to_le32(1 << 8)); in qh_update()
856 struct ehci_qtd *qtd; in qh_refresh() local
859 qtd = qh->dummy; in qh_refresh()
861 qtd = list_entry(qh->qtd_list.next, in qh_refresh()
864 if (cpu_to_le32(qtd->qtd_dma) == qh->hw_current) in qh_refresh()
865 qtd = NULL; in qh_refresh()
868 if (qtd) in qh_refresh()
869 qh_update(oxu, qh, qtd); in qh_refresh()
1011 struct ehci_qtd *qtd; in qh_completions() local
1015 qtd = list_entry(entry, struct ehci_qtd, qtd_list); in qh_completions()
1016 urb = qtd->urb; in qh_completions()
1039 if (qtd == end) in qh_completions()
1044 token = le32_to_cpu(qtd->hw_token); in qh_completions()
1056 !(qtd->hw_alt_next & EHCI_LIST_END)) { in qh_completions()
1088 && cpu_to_le32(qtd->qtd_dma) in qh_completions()
1106 qtd->length, token); in qh_completions()
1107 if ((usb_pipein(qtd->urb->pipe)) && in qh_completions()
1108 (NULL != qtd->transfer_buffer)) in qh_completions()
1109 memcpy(qtd->transfer_buffer, qtd->buffer, qtd->length); in qh_completions()
1113 if (stopped && qtd->qtd_list.prev != &qh->qtd_list) { in qh_completions()
1114 last = list_entry(qtd->qtd_list.prev, in qh_completions()
1116 last->hw_next = qtd->hw_next; in qh_completions()
1118 list_del(&qtd->qtd_list); in qh_completions()
1119 last = qtd; in qh_completions()
1183 struct ehci_qtd *qtd; in qtd_list_free() local
1185 qtd = list_entry(entry, struct ehci_qtd, qtd_list); in qtd_list_free()
1186 list_del(&qtd->qtd_list); in qtd_list_free()
1187 oxu_qtd_free(oxu, qtd); in qtd_list_free()
1198 struct ehci_qtd *qtd, *qtd_prev; in qh_urb_transaction() local
1209 qtd = ehci_qtd_alloc(oxu); in qh_urb_transaction()
1210 if (unlikely(!qtd)) in qh_urb_transaction()
1212 list_add_tail(&qtd->qtd_list, head); in qh_urb_transaction()
1213 qtd->urb = urb; in qh_urb_transaction()
1226 ret = oxu_buf_alloc(oxu, qtd, sizeof(struct usb_ctrlrequest)); in qh_urb_transaction()
1230 qtd_fill(qtd, qtd->buffer_dma, sizeof(struct usb_ctrlrequest), in qh_urb_transaction()
1232 memcpy(qtd->buffer, qtd->urb->setup_packet, in qh_urb_transaction()
1237 qtd_prev = qtd; in qh_urb_transaction()
1238 qtd = ehci_qtd_alloc(oxu); in qh_urb_transaction()
1239 if (unlikely(!qtd)) in qh_urb_transaction()
1241 qtd->urb = urb; in qh_urb_transaction()
1242 qtd_prev->hw_next = QTD_NEXT(qtd->qtd_dma); in qh_urb_transaction()
1243 list_add_tail(&qtd->qtd_list, head); in qh_urb_transaction()
1254 ret = oxu_buf_alloc(oxu, qtd, len); in qh_urb_transaction()
1258 buf = qtd->buffer_dma; in qh_urb_transaction()
1262 memcpy(qtd->buffer, qtd->urb->transfer_buffer, len); in qh_urb_transaction()
1278 this_qtd_len = qtd_fill(qtd, buf, len, token, maxpacket); in qh_urb_transaction()
1279 qtd->transfer_buffer = transfer_buf; in qh_urb_transaction()
1284 qtd->hw_alt_next = oxu->async->hw_alt_next; in qh_urb_transaction()
1293 qtd_prev = qtd; in qh_urb_transaction()
1294 qtd = ehci_qtd_alloc(oxu); in qh_urb_transaction()
1295 if (unlikely(!qtd)) in qh_urb_transaction()
1298 ret = oxu_buf_alloc(oxu, qtd, len); in qh_urb_transaction()
1302 qtd->urb = urb; in qh_urb_transaction()
1303 qtd_prev->hw_next = QTD_NEXT(qtd->qtd_dma); in qh_urb_transaction()
1304 list_add_tail(&qtd->qtd_list, head); in qh_urb_transaction()
1312 qtd->hw_alt_next = EHCI_LIST_END; in qh_urb_transaction()
1331 qtd_prev = qtd; in qh_urb_transaction()
1332 qtd = ehci_qtd_alloc(oxu); in qh_urb_transaction()
1333 if (unlikely(!qtd)) in qh_urb_transaction()
1335 qtd->urb = urb; in qh_urb_transaction()
1336 qtd_prev->hw_next = QTD_NEXT(qtd->qtd_dma); in qh_urb_transaction()
1337 list_add_tail(&qtd->qtd_list, head); in qh_urb_transaction()
1340 qtd_fill(qtd, 0, 0, token, 0); in qh_urb_transaction()
1345 qtd->hw_token |= cpu_to_le32(QTD_IOC); in qh_urb_transaction()
1555 struct ehci_qtd *qtd; in qh_append_tds() local
1558 qtd = NULL; in qh_append_tds()
1560 qtd = list_entry(qtd_list->next, struct ehci_qtd, in qh_append_tds()
1574 if (likely(qtd != NULL)) { in qh_append_tds()
1584 token = qtd->hw_token; in qh_append_tds()
1585 qtd->hw_token = HALT_BIT; in qh_append_tds()
1590 *dummy = *qtd; in qh_append_tds()
1593 list_del(&qtd->qtd_list); in qh_append_tds()
1597 ehci_qtd_init(qtd, qtd->qtd_dma); in qh_append_tds()
1598 qh->dummy = qtd; in qh_append_tds()
1601 dma = qtd->qtd_dma; in qh_append_tds()
1602 qtd = list_entry(qh->qtd_list.prev, in qh_append_tds()
1604 qtd->hw_next = QTD_NEXT(dma); in qh_append_tds()
1620 struct ehci_qtd *qtd; in submit_async() local
1626 qtd = list_entry(qtd_list->next, struct ehci_qtd, qtd_list); in submit_async()
1634 qtd, urb->ep->hcpriv); in submit_async()