Lines Matching refs:qh

88 qh_update (struct ehci_hcd *ehci, struct ehci_qh *qh, struct ehci_qtd *qtd)  in qh_update()  argument
90 struct ehci_qh_hw *hw = qh->hw; in qh_update()
93 WARN_ON(qh->qh_state != QH_STATE_IDLE); in qh_update()
106 is_out = qh->is_out; in qh_update()
108 if (unlikely(!usb_gettoggle(qh->ps.udev, epnum, is_out))) { in qh_update()
110 usb_settoggle(qh->ps.udev, epnum, is_out, 1); in qh_update()
122 qh_refresh (struct ehci_hcd *ehci, struct ehci_qh *qh) in qh_refresh() argument
126 qtd = list_entry(qh->qtd_list.next, struct ehci_qtd, qtd_list); in qh_refresh()
135 if (qh->hw->hw_token & ACTIVE_BIT(ehci)) in qh_refresh()
136 qh->hw->hw_qtd_next = qtd->hw_next; in qh_refresh()
138 qh_update(ehci, qh, qtd); in qh_refresh()
143 static void qh_link_async(struct ehci_hcd *ehci, struct ehci_qh *qh);
149 struct ehci_qh *qh = ep->hcpriv; in ehci_clear_tt_buffer_complete() local
153 qh->clearing_tt = 0; in ehci_clear_tt_buffer_complete()
154 if (qh->qh_state == QH_STATE_IDLE && !list_empty(&qh->qtd_list) in ehci_clear_tt_buffer_complete()
156 qh_link_async(ehci, qh); in ehci_clear_tt_buffer_complete()
160 static void ehci_clear_tt_buffer(struct ehci_hcd *ehci, struct ehci_qh *qh, in ehci_clear_tt_buffer() argument
170 if (urb->dev->tt && !usb_pipeint(urb->pipe) && !qh->clearing_tt) { in ehci_clear_tt_buffer()
182 qh->clearing_tt = 1; in ehci_clear_tt_buffer()
279 static int qh_schedule (struct ehci_hcd *ehci, struct ehci_qh *qh);
287 qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh) in qh_completions() argument
289 struct ehci_qtd *last, *end = qh->dummy; in qh_completions()
294 struct ehci_qh_hw *hw = qh->hw; in qh_completions()
306 state = qh->qh_state; in qh_completions()
307 qh->qh_state = QH_STATE_COMPLETING; in qh_completions()
313 qh->dequeue_during_giveback = 0; in qh_completions()
320 list_for_each_safe (entry, tmp, &qh->qtd_list) { in qh_completions()
359 qh); in qh_completions()
371 ++qh->xacterrs < QH_XACTERR_MAX && in qh_completions()
375 qtd->length - QTD_LENGTH(token), qtd->length, qh->xacterrs); in qh_completions()
437 qh->qtd_list.next == &qtd->qtd_list && in qh_completions()
446 ehci_clear_tt_buffer(ehci, qh, urb, token); in qh_completions()
480 ehci_clear_tt_buffer(ehci, qh, urb, in qh_completions()
488 if (stopped && qtd->qtd_list.prev != &qh->qtd_list) { in qh_completions()
499 qh->xacterrs = 0; in qh_completions()
509 if (unlikely(qh->dequeue_during_giveback)) { in qh_completions()
518 qh->qh_state = state; in qh_completions()
536 qh->exception = 1; in qh_completions()
539 return qh->exception; in qh_completions()
763 struct ehci_qh *qh = ehci_qh_alloc (ehci, flags); in qh_make() local
770 if (!qh) in qh_make()
771 return qh; in qh_make()
802 qh->ps.usecs = NS_TO_US(usb_calc_bus_time(USB_SPEED_HIGH, in qh_make()
805 qh->ps.phase = NO_FRAME; in qh_make()
808 qh->ps.c_usecs = 0; in qh_make()
809 qh->gap_uf = 0; in qh_make()
820 qh->ps.period = urb->interval >> 3; in qh_make()
827 qh->ps.bw_uperiod = min_t(unsigned, tmp, urb->interval); in qh_make()
828 qh->ps.bw_period = qh->ps.bw_uperiod >> 3; in qh_make()
833 qh->gap_uf = 1 + usb_calc_bus_time (urb->dev->speed, in qh_make()
838 qh->ps.c_usecs = qh->ps.usecs + HS_USECS(0); in qh_make()
839 qh->ps.usecs = HS_USECS(1); in qh_make()
841 qh->ps.usecs += HS_USECS(1); in qh_make()
842 qh->ps.c_usecs = HS_USECS(0); in qh_make()
846 qh->ps.tt_usecs = NS_TO_US(think_time + in qh_make()
851 qh->ps.period = urb->interval; in qh_make()
859 qh->ps.bw_period = min_t(unsigned, tmp, urb->interval); in qh_make()
860 qh->ps.bw_uperiod = qh->ps.bw_period << 3; in qh_make()
865 qh->ps.udev = urb->dev; in qh_make()
866 qh->ps.ep = urb->ep; in qh_make()
930 qh_destroy(ehci, qh); in qh_make()
937 qh->qh_state = QH_STATE_IDLE; in qh_make()
938 hw = qh->hw; in qh_make()
941 qh->is_out = !is_input; in qh_make()
943 return qh; in qh_make()
967 WARN_ON(ehci->async->qh_next.qh || !list_empty(&ehci->async_unlink) || in disable_async()
976 static void qh_link_async (struct ehci_hcd *ehci, struct ehci_qh *qh) in qh_link_async() argument
978 __hc32 dma = QH_NEXT(ehci, qh->qh_dma); in qh_link_async()
982 if (unlikely(qh->clearing_tt)) in qh_link_async()
985 WARN_ON(qh->qh_state != QH_STATE_IDLE); in qh_link_async()
988 qh_refresh(ehci, qh); in qh_link_async()
992 qh->qh_next = head->qh_next; in qh_link_async()
993 qh->hw->hw_next = head->hw->hw_next; in qh_link_async()
996 head->qh_next.qh = qh; in qh_link_async()
999 qh->qh_state = QH_STATE_LINKED; in qh_link_async()
1000 qh->xacterrs = 0; in qh_link_async()
1001 qh->exception = 0; in qh_link_async()
1023 struct ehci_qh *qh = NULL; in qh_append_tds() local
1026 qh = (struct ehci_qh *) *ptr; in qh_append_tds()
1027 if (unlikely (qh == NULL)) { in qh_append_tds()
1029 qh = qh_make (ehci, urb, GFP_ATOMIC); in qh_append_tds()
1030 *ptr = qh; in qh_append_tds()
1032 if (likely (qh != NULL)) { in qh_append_tds()
1046 qh->hw->hw_info1 &= ~qh_addr_mask; in qh_append_tds()
1065 dummy = qh->dummy; in qh_append_tds()
1073 list_splice_tail(qtd_list, &qh->qtd_list); in qh_append_tds()
1076 qh->dummy = qtd; in qh_append_tds()
1080 qtd = list_entry (qh->qtd_list.prev, in qh_append_tds()
1088 urb->hcpriv = qh; in qh_append_tds()
1091 return qh; in qh_append_tds()
1105 struct ehci_qh *qh = NULL; in submit_async() local
1132 qh = qh_append_tds(ehci, urb, qtd_list, epnum, &urb->ep->hcpriv); in submit_async()
1133 if (unlikely(qh == NULL)) { in submit_async()
1142 if (likely (qh->qh_state == QH_STATE_IDLE)) in submit_async()
1143 qh_link_async(ehci, qh); in submit_async()
1146 if (unlikely (qh == NULL)) in submit_async()
1256 static void single_unlink_async(struct ehci_hcd *ehci, struct ehci_qh *qh) in single_unlink_async() argument
1261 qh->qh_state = QH_STATE_UNLINK_WAIT; in single_unlink_async()
1262 list_add_tail(&qh->unlink_node, &ehci->async_unlink); in single_unlink_async()
1266 while (prev->qh_next.qh != qh) in single_unlink_async()
1267 prev = prev->qh_next.qh; in single_unlink_async()
1269 prev->hw->hw_next = qh->hw->hw_next; in single_unlink_async()
1270 prev->qh_next = qh->qh_next; in single_unlink_async()
1271 if (ehci->qh_scan_next == qh) in single_unlink_async()
1272 ehci->qh_scan_next = qh->qh_next.qh; in single_unlink_async()
1303 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_WAIT) { in end_unlink_async()
1334 qh->qh_state = QH_STATE_UNLINK; in end_unlink_async()
1340 list_move_tail(&qh->unlink_node, &ehci->async_idle); in end_unlink_async()
1356 qh = list_first_entry(&ehci->async_idle, struct ehci_qh, in end_unlink_async()
1358 list_del(&qh->unlink_node); in end_unlink_async()
1360 qh->qh_state = QH_STATE_IDLE; in end_unlink_async()
1361 qh->qh_next.qh = NULL; in end_unlink_async()
1363 if (!list_empty(&qh->qtd_list)) in end_unlink_async()
1364 qh_completions(ehci, qh); in end_unlink_async()
1365 if (!list_empty(&qh->qtd_list) && in end_unlink_async()
1367 qh_link_async(ehci, qh); in end_unlink_async()
1373 static void start_unlink_async(struct ehci_hcd *ehci, struct ehci_qh *qh);
1377 struct ehci_qh *qh; in unlink_empty_async() local
1382 for (qh = ehci->async->qh_next.qh; qh; qh = qh->qh_next.qh) { in unlink_empty_async()
1383 if (list_empty(&qh->qtd_list) && in unlink_empty_async()
1384 qh->qh_state == QH_STATE_LINKED) { in unlink_empty_async()
1386 if (qh->unlink_cycle != ehci->async_unlink_cycle) in unlink_empty_async()
1387 qh_to_unlink = qh; in unlink_empty_async()
1407 struct ehci_qh *qh; in unlink_empty_async_suspended() local
1409 while (ehci->async->qh_next.qh) { in unlink_empty_async_suspended()
1410 qh = ehci->async->qh_next.qh; in unlink_empty_async_suspended()
1411 WARN_ON(!list_empty(&qh->qtd_list)); in unlink_empty_async_suspended()
1412 single_unlink_async(ehci, qh); in unlink_empty_async_suspended()
1420 static void start_unlink_async(struct ehci_hcd *ehci, struct ehci_qh *qh) in start_unlink_async() argument
1423 if (qh->qh_state != QH_STATE_LINKED) in start_unlink_async()
1426 single_unlink_async(ehci, qh); in start_unlink_async()
1434 struct ehci_qh *qh; in scan_async() local
1437 ehci->qh_scan_next = ehci->async->qh_next.qh; in scan_async()
1439 qh = ehci->qh_scan_next; in scan_async()
1440 ehci->qh_scan_next = qh->qh_next.qh; in scan_async()
1443 if (!list_empty(&qh->qtd_list)) { in scan_async()
1453 temp = qh_completions(ehci, qh); in scan_async()
1455 start_unlink_async(ehci, qh); in scan_async()
1456 } else if (list_empty(&qh->qtd_list) in scan_async()
1457 && qh->qh_state == QH_STATE_LINKED) { in scan_async()
1458 qh->unlink_cycle = ehci->async_unlink_cycle; in scan_async()