Lines Matching refs:ehci

125 static int periodic_unlink (struct ehci_hcd *ehci, U32 frame, void *ptr)  in periodic_unlink()  argument
127 union ehci_shadow *prev_p = &ehci->pshadow [frame]; in periodic_unlink()
128 U32 *hw_p = &ehci->periodic [frame]; in periodic_unlink()
172 periodic_usecs (struct ehci_hcd *ehci, U32 frame, U32 uframe) in periodic_usecs() argument
174 U32 *hw_p = &ehci->periodic [frame]; in periodic_usecs()
175 union ehci_shadow *q = &ehci->pshadow [frame]; in periodic_usecs()
261 static int enable_periodic (struct ehci_hcd *ehci) in enable_periodic() argument
267 status = handshake (&ehci->regs->status, STS_PSS, 0, 9 * 125); in enable_periodic()
269 ehci->hcd.state = USB_STATE_HALT; in enable_periodic()
273 cmd = ehci_readl ((U32)&ehci->regs->command) | CMD_PSE; in enable_periodic()
274 ehci_writel (cmd, (U32)&ehci->regs->command); in enable_periodic()
276 ehci->hcd.state = USB_STATE_RUNNING; in enable_periodic()
279 ehci->next_uframe = ehci_readl ((U32)&ehci->regs->frame_index) in enable_periodic()
280 % (ehci->periodic_size << 3); in enable_periodic()
284 static int disable_periodic (struct ehci_hcd *ehci) in disable_periodic() argument
290 status = handshake (&ehci->regs->status, STS_PSS, STS_PSS, 9 * 125); in disable_periodic()
296 cmd = ehci_readl ((U32)&ehci->regs->command) & ~CMD_PSE; in disable_periodic()
297 ehci_writel (cmd, (U32)&ehci->regs->command); in disable_periodic()
300 ehci->next_uframe = -1; in disable_periodic()
319 struct ehci_hcd *ehci, in intr_deschedule() argument
327 periodic_unlink (ehci, frame, qh1); in intr_deschedule()
328 qh_put (ehci, qh1); in intr_deschedule()
330 } while (frame < ehci->periodic_size); in intr_deschedule()
334 ehci->periodic_sched--; in intr_deschedule()
337 if (!ehci->periodic_sched) in intr_deschedule()
338 status = disable_periodic (ehci); in intr_deschedule()
345 if (((ehci_get_frame (&ehci->hcd) - frame) % qh1->period) == 0) { in intr_deschedule()
359 hcd_to_bus (&ehci->hcd)->bandwidth_allocated -= in intr_deschedule()
365 atomic_read(&qh1->refcount), ehci->periodic_sched); in intr_deschedule()
369 struct ehci_hcd *ehci, in check_period() argument
393 if (ehci->pshadow [frame].ptr) in check_period()
396 claimed = periodic_usecs (ehci, frame, uframe); in check_period()
401 } while ((frame += period) < ehci->periodic_size); in check_period()
408 struct ehci_hcd *ehci, in check_intr_schedule() argument
417 if (!check_period (ehci, frame, uframe, qh->period, qh->usecs)) in check_intr_schedule()
429 if (!check_period (ehci, frame, uframe + qh->gap_uf + 1, in check_intr_schedule()
432 if (!check_period (ehci, frame, uframe + qh->gap_uf, in check_intr_schedule()
444 static int qh_schedule (struct ehci_hcd *ehci, struct ehci_qh *qh) in qh_schedule() argument
457 status = check_intr_schedule (ehci, frame1, --uframe1, in qh_schedule()
470 status = check_intr_schedule (ehci, in qh_schedule()
493 if (unlikely (ehci->pshadow [frame1].ptr != 0)) { in qh_schedule()
499 ehci->pshadow [frame1].qh = qh_get (qh); in qh_schedule()
500 ehci->periodic [frame1] = in qh_schedule()
505 } while (frame1 < ehci->periodic_size); in qh_schedule()
508 hcd_to_bus (&ehci->hcd)->bandwidth_allocated += in qh_schedule()
512 if (!ehci->periodic_sched++) in qh_schedule()
513 status = enable_periodic (ehci); in qh_schedule()
530 struct ehci_hcd *ehci, in intr_submit() argument
549 spin_lock_irqsave (&ehci->lock, flags); in intr_submit()
554 qh1 = qh_append_tds (ehci, urb, &empty, epnum1, &dev->ep [epnum1]); in intr_submit()
561 if ((status = qh_schedule (ehci, qh1)) != 0) in intr_submit()
566 qh1 = qh_append_tds (ehci, urb, qtd_list, epnum1, &dev->ep [epnum1]); in intr_submit()
570 hcd_to_bus (&ehci->hcd)->bandwidth_int_reqs++; in intr_submit()
578 spin_unlock_irqrestore (&ehci->lock, flags); in intr_submit()
581 qtd_list_free (ehci, urb, qtd_list); in intr_submit()
600 struct ehci_hcd *ehci, in intr_complete() argument
619 count = qh_completions (ehci, qh, regs); in intr_complete()
623 intr_deschedule (ehci, qh, 0); in intr_complete()
643 itd_free_list (struct ehci_hcd *ehci, struct urb *urb) in itd_free_list() argument
656 pci_pool_free (ehci->itd_pool, itd, itd->itd_dma); in itd_free_list()
659 pci_pool_free (ehci->itd_pool, first_itd, first_itd->itd_dma); in itd_free_list()
677 struct ehci_hcd *ehci, in itd_fill() argument
769 struct ehci_hcd *ehci, in itd_urb_transaction() argument
786 itd = (struct ehci_itd*) pci_pool_alloc (ehci->itd_pool, mem_flags, &itd_dma); in itd_urb_transaction()
795 status = itd_fill (ehci, itd, urb, frame_index, in itd_urb_transaction()
820 itd_free_list (ehci, urb); in itd_urb_transaction()
837 itd_link (struct ehci_hcd *ehci, U32 frame, struct ehci_itd *itd) in itd_link() argument
840 itd->itd_next = ehci->pshadow [frame]; in itd_link()
841 itd->hw_next = ehci->periodic [frame]; in itd_link()
842 ehci->pshadow [frame].itd = itd; in itd_link()
843 ehci->periodic [frame] = CPUToLE32 (itd->itd_dma) | Q_TYPE_ITD; in itd_link()
848 struct ehci_hcd *ehci, in get_iso_range() argument
891 now = ehci_readl ((U32)&ehci->regs->frame_index) + 1; in get_iso_range()
892 if (!ehci->periodic_sched) in get_iso_range()
897 *start = now + ehci->i_thresh + 1; in get_iso_range()
911 urb->start_frame %= ehci->periodic_size; in get_iso_range()
927 *max %= ehci->periodic_size; in get_iso_range()
945 itd_schedule (struct ehci_hcd *ehci, struct urb *urb) in itd_schedule() argument
949 U32 mod = ehci->periodic_size << 3; in itd_schedule()
956 if ((status = get_iso_range (ehci, urb, &start, &max, mod)) != 0) in itd_schedule()
973 if (periodic_usecs (ehci, uframe >> 3, uframe & 0x7) in itd_schedule()
1005 itd_link (ehci, (uframe >> 3) % ehci->periodic_size, in itd_schedule()
1028 if (!ehci->periodic_sched++) { in itd_schedule()
1029 if ((status = enable_periodic (ehci)) != 0) { in itd_schedule()
1064 static int itd_submit (struct ehci_hcd *ehci, struct urb *urb, int mem_flags) in itd_submit() argument
1072 status = itd_urb_transaction (ehci, urb, mem_flags); in itd_submit()
1078 spin_lock_irqsave (&ehci->lock, flags); in itd_submit()
1080 status = itd_schedule (ehci, urb); in itd_submit()
1086 spin_unlock_irqrestore (&ehci->lock, flags); in itd_submit()
1088 itd_free_list (ehci, urb); in itd_submit()
1115 scan_periodic (struct ehci_hcd *ehci, struct pt_regs *regs) in scan_periodic() argument
1120 mod = ehci->periodic_size << 3; in scan_periodic()
1123 frame = ehci->next_uframe >> 3; in scan_periodic()
1124 if (HCD_IS_RUNNING (ehci->hcd.state)) in scan_periodic()
1125 now_uframe = ehci_readl ((U32)&ehci->regs->frame_index); in scan_periodic()
1144 q_p = &ehci->pshadow [frame]; in scan_periodic()
1145 hw_p = &ehci->periodic [frame]; in scan_periodic()
1165 count += intr_complete (ehci, frame, in scan_periodic()
1168 qh_put (ehci, q.qh); in scan_periodic()
1201 count += itd_complete (ehci, in scan_periodic()
1222 sitd_complete (ehci, q.sitd); in scan_periodic()
1248 if (!HCD_IS_RUNNING (ehci->hcd.state)) in scan_periodic()
1251 ehci->next_uframe = now_uframe; in scan_periodic()
1253 now = ehci_readl ((U32)&ehci->regs->frame_index) % mod; in scan_periodic()
1261 frame = (frame + 1) % ehci->periodic_size; in scan_periodic()