Lines Matching refs:qh

76 qh_update (struct ehci_hcd *ehci, struct ehci_qh *qh, struct ehci_qtd *qtd)  in qh_update()  argument
78 struct ehci_qh_hw *hw = qh->hw; in qh_update()
81 WARN_ON(qh->qh_state != QH_STATE_IDLE); in qh_update()
94 is_out = qh->is_out; in qh_update()
96 if (unlikely(!usb_gettoggle(qh->ps.udev, epnum, is_out))) { in qh_update()
98 usb_settoggle(qh->ps.udev, epnum, is_out, 1); in qh_update()
110 qh_refresh (struct ehci_hcd *ehci, struct ehci_qh *qh) in qh_refresh() argument
114 qtd = list_entry(qh->qtd_list.next, struct ehci_qtd, qtd_list); in qh_refresh()
123 if (qh->hw->hw_token & ACTIVE_BIT(ehci)) { in qh_refresh()
124 qh->hw->hw_qtd_next = qtd->hw_next; in qh_refresh()
125 if (qh->should_be_inactive) in qh_refresh()
126 ehci_warn(ehci, "qh %p should be inactive!\n", qh); in qh_refresh()
128 qh_update(ehci, qh, qtd); in qh_refresh()
130 qh->should_be_inactive = 0; in qh_refresh()
135 static void qh_link_async(struct ehci_hcd *ehci, struct ehci_qh *qh);
141 struct ehci_qh *qh = ep->hcpriv; in ehci_clear_tt_buffer_complete() local
145 qh->clearing_tt = 0; in ehci_clear_tt_buffer_complete()
146 if (qh->qh_state == QH_STATE_IDLE && !list_empty(&qh->qtd_list) in ehci_clear_tt_buffer_complete()
148 qh_link_async(ehci, qh); in ehci_clear_tt_buffer_complete()
152 static void ehci_clear_tt_buffer(struct ehci_hcd *ehci, struct ehci_qh *qh, in ehci_clear_tt_buffer() argument
162 if (urb->dev->tt && !usb_pipeint(urb->pipe) && !qh->clearing_tt) { in ehci_clear_tt_buffer()
174 qh->clearing_tt = 1; in ehci_clear_tt_buffer()
278 static int qh_schedule (struct ehci_hcd *ehci, struct ehci_qh *qh);
286 qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh) in qh_completions() argument
288 struct ehci_qtd *last, *end = qh->dummy; in qh_completions()
293 struct ehci_qh_hw *hw = qh->hw; in qh_completions()
305 state = qh->qh_state; in qh_completions()
306 qh->qh_state = QH_STATE_COMPLETING; in qh_completions()
312 qh->dequeue_during_giveback = 0; in qh_completions()
319 list_for_each_safe (entry, tmp, &qh->qtd_list) { in qh_completions()
358 qh); in qh_completions()
370 ++qh->xacterrs < QH_XACTERR_MAX && in qh_completions()
374 qtd->length - QTD_LENGTH(token), qtd->length, qh->xacterrs); in qh_completions()
392 qh->unlink_reason |= QH_UNLINK_HALTED; in qh_completions()
407 qh->unlink_reason |= QH_UNLINK_SHORT_READ; in qh_completions()
422 qh->unlink_reason |= QH_UNLINK_SHUTDOWN; in qh_completions()
440 qh->qtd_list.next == &qtd->qtd_list && in qh_completions()
444 qh->should_be_inactive = 1; in qh_completions()
450 ehci_clear_tt_buffer(ehci, qh, urb, token); in qh_completions()
484 ehci_clear_tt_buffer(ehci, qh, urb, in qh_completions()
492 if (stopped && qtd->qtd_list.prev != &qh->qtd_list) { in qh_completions()
503 qh->xacterrs = 0; in qh_completions()
513 if (unlikely(qh->dequeue_during_giveback)) { in qh_completions()
522 qh->qh_state = state; in qh_completions()
540 qh->unlink_reason |= QH_UNLINK_DUMMY_OVERLAY; in qh_completions()
543 return qh->unlink_reason; in qh_completions()
762 struct ehci_qh *qh = ehci_qh_alloc (ehci, flags); in qh_make() local
771 if (!qh) in qh_make()
772 return qh; in qh_make()
805 qh->ps.usecs = NS_TO_US(usb_calc_bus_time(USB_SPEED_HIGH, in qh_make()
807 qh->ps.phase = NO_FRAME; in qh_make()
810 qh->ps.c_usecs = 0; in qh_make()
811 qh->gap_uf = 0; in qh_make()
822 qh->ps.period = urb->interval >> 3; in qh_make()
829 qh->ps.bw_uperiod = min_t(unsigned, tmp, urb->interval); in qh_make()
830 qh->ps.bw_period = qh->ps.bw_uperiod >> 3; in qh_make()
835 qh->gap_uf = 1 + usb_calc_bus_time (urb->dev->speed, in qh_make()
840 qh->ps.c_usecs = qh->ps.usecs + HS_USECS(0); in qh_make()
841 qh->ps.usecs = HS_USECS(1); in qh_make()
843 qh->ps.usecs += HS_USECS(1); in qh_make()
844 qh->ps.c_usecs = HS_USECS(0); in qh_make()
848 qh->ps.tt_usecs = NS_TO_US(think_time + in qh_make()
853 qh->ps.period = urb->interval; in qh_make()
861 qh->ps.bw_period = min_t(unsigned, tmp, urb->interval); in qh_make()
862 qh->ps.bw_uperiod = qh->ps.bw_period << 3; in qh_make()
867 qh->ps.udev = urb->dev; in qh_make()
868 qh->ps.ep = urb->ep; in qh_make()
932 qh_destroy(ehci, qh); in qh_make()
939 qh->qh_state = QH_STATE_IDLE; in qh_make()
940 hw = qh->hw; in qh_make()
943 qh->is_out = !is_input; in qh_make()
945 return qh; in qh_make()
969 WARN_ON(ehci->async->qh_next.qh || !list_empty(&ehci->async_unlink) || in disable_async()
978 static void qh_link_async (struct ehci_hcd *ehci, struct ehci_qh *qh) in qh_link_async() argument
980 __hc32 dma = QH_NEXT(ehci, qh->qh_dma); in qh_link_async()
984 if (unlikely(qh->clearing_tt)) in qh_link_async()
987 WARN_ON(qh->qh_state != QH_STATE_IDLE); in qh_link_async()
990 qh_refresh(ehci, qh); in qh_link_async()
994 qh->qh_next = head->qh_next; in qh_link_async()
995 qh->hw->hw_next = head->hw->hw_next; in qh_link_async()
998 head->qh_next.qh = qh; in qh_link_async()
1001 qh->qh_state = QH_STATE_LINKED; in qh_link_async()
1002 qh->xacterrs = 0; in qh_link_async()
1003 qh->unlink_reason = 0; in qh_link_async()
1025 struct ehci_qh *qh = NULL; in qh_append_tds() local
1028 qh = (struct ehci_qh *) *ptr; in qh_append_tds()
1029 if (unlikely (qh == NULL)) { in qh_append_tds()
1031 qh = qh_make (ehci, urb, GFP_ATOMIC); in qh_append_tds()
1032 *ptr = qh; in qh_append_tds()
1034 if (likely (qh != NULL)) { in qh_append_tds()
1048 qh->hw->hw_info1 &= ~qh_addr_mask; in qh_append_tds()
1067 dummy = qh->dummy; in qh_append_tds()
1075 list_splice_tail(qtd_list, &qh->qtd_list); in qh_append_tds()
1078 qh->dummy = qtd; in qh_append_tds()
1082 qtd = list_entry (qh->qtd_list.prev, in qh_append_tds()
1090 urb->hcpriv = qh; in qh_append_tds()
1093 return qh; in qh_append_tds()
1107 struct ehci_qh *qh = NULL; in submit_async() local
1134 qh = qh_append_tds(ehci, urb, qtd_list, epnum, &urb->ep->hcpriv); in submit_async()
1135 if (unlikely(qh == NULL)) { in submit_async()
1144 if (likely (qh->qh_state == QH_STATE_IDLE)) in submit_async()
1145 qh_link_async(ehci, qh); in submit_async()
1148 if (unlikely (qh == NULL)) in submit_async()
1254 static void single_unlink_async(struct ehci_hcd *ehci, struct ehci_qh *qh) in single_unlink_async() argument
1259 qh->qh_state = QH_STATE_UNLINK_WAIT; in single_unlink_async()
1260 list_add_tail(&qh->unlink_node, &ehci->async_unlink); in single_unlink_async()
1264 while (prev->qh_next.qh != qh) in single_unlink_async()
1265 prev = prev->qh_next.qh; in single_unlink_async()
1267 prev->hw->hw_next = qh->hw->hw_next; in single_unlink_async()
1268 prev->qh_next = qh->qh_next; in single_unlink_async()
1269 if (ehci->qh_scan_next == qh) in single_unlink_async()
1270 ehci->qh_scan_next = qh->qh_next.qh; in single_unlink_async()
1310 struct ehci_qh *qh; in end_unlink_async() local
1315 qh = list_first_entry(&ehci->async_unlink, struct ehci_qh, in end_unlink_async()
1333 else if (qh->qh_state == QH_STATE_UNLINK) { in end_unlink_async()
1338 list_move_tail(&qh->unlink_node, &ehci->async_idle); in end_unlink_async()
1355 else if (qh->unlink_reason & (QH_UNLINK_HALTED | in end_unlink_async()
1360 else if ((qh->unlink_reason & QH_UNLINK_QUEUE_EMPTY) && in end_unlink_async()
1361 list_empty(&qh->qtd_list)) in end_unlink_async()
1365 else if (qh->hw->hw_token & cpu_to_hc32(ehci, QTD_STS_HALT)) in end_unlink_async()
1372 qh_current = qh->hw->hw_current; in end_unlink_async()
1373 qh_token = qh->hw->hw_token; in end_unlink_async()
1383 qh->qh_state = QH_STATE_UNLINK; in end_unlink_async()
1402 qh = list_first_entry(&ehci->async_idle, struct ehci_qh, in end_unlink_async()
1404 list_del(&qh->unlink_node); in end_unlink_async()
1406 qh->qh_state = QH_STATE_IDLE; in end_unlink_async()
1407 qh->qh_next.qh = NULL; in end_unlink_async()
1409 if (!list_empty(&qh->qtd_list)) in end_unlink_async()
1410 qh_completions(ehci, qh); in end_unlink_async()
1411 if (!list_empty(&qh->qtd_list) && in end_unlink_async()
1413 qh_link_async(ehci, qh); in end_unlink_async()
1419 static void start_unlink_async(struct ehci_hcd *ehci, struct ehci_qh *qh);
1423 struct ehci_qh *qh; in unlink_empty_async() local
1428 for (qh = ehci->async->qh_next.qh; qh; qh = qh->qh_next.qh) { in unlink_empty_async()
1429 if (list_empty(&qh->qtd_list) && in unlink_empty_async()
1430 qh->qh_state == QH_STATE_LINKED) { in unlink_empty_async()
1432 if (qh->unlink_cycle != ehci->async_unlink_cycle) in unlink_empty_async()
1433 qh_to_unlink = qh; in unlink_empty_async()
1456 struct ehci_qh *qh; in unlink_empty_async_suspended() local
1458 while (ehci->async->qh_next.qh) { in unlink_empty_async_suspended()
1459 qh = ehci->async->qh_next.qh; in unlink_empty_async_suspended()
1460 WARN_ON(!list_empty(&qh->qtd_list)); in unlink_empty_async_suspended()
1461 single_unlink_async(ehci, qh); in unlink_empty_async_suspended()
1470 static void start_unlink_async(struct ehci_hcd *ehci, struct ehci_qh *qh) in start_unlink_async() argument
1473 if (qh->qh_state != QH_STATE_LINKED) in start_unlink_async()
1476 single_unlink_async(ehci, qh); in start_unlink_async()
1484 struct ehci_qh *qh; in scan_async() local
1487 ehci->qh_scan_next = ehci->async->qh_next.qh; in scan_async()
1489 qh = ehci->qh_scan_next; in scan_async()
1490 ehci->qh_scan_next = qh->qh_next.qh; in scan_async()
1493 if (!list_empty(&qh->qtd_list)) { in scan_async()
1503 temp = qh_completions(ehci, qh); in scan_async()
1505 start_unlink_async(ehci, qh); in scan_async()
1506 } else if (list_empty(&qh->qtd_list) in scan_async()
1507 && qh->qh_state == QH_STATE_LINKED) { in scan_async()
1508 qh->unlink_cycle = ehci->async_unlink_cycle; in scan_async()