Lines Matching refs:pEhci

81 static void ms_periodic_unlink (struct ehci_hcd *pEhci, U32 u32Frame, void *ptr)  in ms_periodic_unlink()  argument
83 union ehci_qh_shadow *prev_p = &pEhci->pshadow [u32Frame]; in ms_periodic_unlink()
84 U32 *hw_p = &pEhci->pPeriodic [u32Frame]; in ms_periodic_unlink()
112 static U16 ms_periodic_usecs (struct ehci_hcd *pEhci, U32 u32Frame, U32 u32uFrame) in ms_periodic_usecs() argument
114 U32 *phw_p = &pEhci->pPeriodic [u32Frame]; in ms_periodic_usecs()
115 union ehci_qh_shadow *pQh = &pEhci->pshadow [u32Frame]; in ms_periodic_usecs()
145 static int ms_enable_periodic (struct ehci_hcd *pEhci) in ms_enable_periodic() argument
150 if (pEhci->u32PeriodicSched++) // patch from Linux in ms_enable_periodic()
154 iStatus = ms_check_status (&pEhci->op_regs->usbsts, USBSTS_PSS, 0, 9 * 125); in ms_enable_periodic()
157 pEhci->hcd.state = HCD_STATE_HALT; in ms_enable_periodic()
162 u32Cmd = hcd_reg_readl ((U32)&pEhci->op_regs->usbcmd) | USBCMD_PSE; in ms_enable_periodic()
163 hcd_reg_writel (u32Cmd, (U32)&pEhci->op_regs->usbcmd); in ms_enable_periodic()
164 pEhci->hcd.state = HCD_STATE_RUNNING; in ms_enable_periodic()
165 pEhci->iNextUframe = hcd_reg_readl ((U32)&pEhci->op_regs->frindex) in ms_enable_periodic()
166 % (pEhci->u32PeriodicSize << 3); in ms_enable_periodic()
170 static int ms_disable_periodic (struct ehci_hcd *pEhci) in ms_disable_periodic() argument
175 if (--pEhci->u32PeriodicSched) // patch from Linux in ms_disable_periodic()
179 iStatus = ms_check_status (&pEhci->op_regs->usbsts, USBSTS_PSS, USBSTS_PSS, 9 * 125); in ms_disable_periodic()
186 u32Cmd = hcd_reg_readl ((U32)&pEhci->op_regs->usbcmd) & ~USBCMD_PSE; in ms_disable_periodic()
187 hcd_reg_writel (u32Cmd, (U32)&pEhci->op_regs->usbcmd); in ms_disable_periodic()
188 pEhci->iNextUframe = -1; in ms_disable_periodic()
193 static int ms_qh_schedule (struct ehci_hcd *pEhci, struct ehci_qh *pQh);
195 struct ehci_hcd *pEhci, in ms_intr_deschedule() argument
213 ms_periodic_unlink (pEhci, u32Frame, pQh1); in ms_intr_deschedule()
216 } while (u32Frame < pEhci->u32PeriodicSize); in ms_intr_deschedule()
221 ms_qh_put (pEhci, pQh1); // patch from Linux here in ms_intr_deschedule()
224 ms_disable_periodic(pEhci); in ms_intr_deschedule()
226 pEhci->u32PeriodicSched--; in ms_intr_deschedule()
227 if (!pEhci->u32PeriodicSched) in ms_intr_deschedule()
228 ms_disable_periodic (pEhci); in ms_intr_deschedule()
245 if (((ms_ehci_get_frame_idx (&pEhci->hcd) - u32Frame) % pQh1->u16Period) == 0) in ms_intr_deschedule()
265 osapi_atomic_read(&pQh1->tRefCnt), (int)pEhci->u32PeriodicSched); in ms_intr_deschedule()
273 ms_qh_completions(pEhci, pQh1, NULL); in ms_intr_deschedule()
275 if (!list_empty(&pQh1->qtd_list) && HCD_IS_RUNNING(pEhci->hcd.state)) in ms_intr_deschedule()
277 rc = ms_qh_schedule(pEhci, pQh1); // reschedule in ms_intr_deschedule()
286 struct ehci_hcd *pEhci, in ms_check_period() argument
300 if ( pEhci->hcd.eSpeed == USB_HIGH_SPEED ) in ms_check_period()
310 claimed = ms_periodic_usecs (pEhci, u32Frame, u32uFrame); in ms_check_period()
314 } while ((u32Frame += 1) < pEhci->u32PeriodicSize); in ms_check_period()
324 claimed = ms_periodic_usecs (pEhci, u32Frame, u32uFrame); in ms_check_period()
328 } while ((u32Frame += u32Period) < pEhci->u32PeriodicSize); in ms_check_period()
348 struct ehci_hcd *pEhci, in ms_tt_no_collision() argument
358 for (; frame < pEhci->u32PeriodicSize; frame += u32Period) { in ms_tt_no_collision()
362 here = pEhci->pshadow [frame]; in ms_tt_no_collision()
363 type = Q_NEXT_TYPE(pEhci->pPeriodic [frame]); in ms_tt_no_collision()
394 struct ehci_hcd *pEhci, in ms_check_intr_schedule() argument
408 if (!ms_check_period (pEhci, u32Frame, u32uFrame, pQh->u16Period, pQh->u8Usecs)) in ms_check_intr_schedule()
423 if (ms_tt_no_collision (pEhci, pQh->u16Period, pQh->dev, u32Frame, mask)) { in ms_check_intr_schedule()
424 if (!ms_check_period (pEhci, u32Frame, u32uFrame + pQh->u8Gap_uf + 1, in ms_check_intr_schedule()
427 if (!ms_check_period (pEhci, u32Frame, u32uFrame + pQh->u8Gap_uf, in ms_check_intr_schedule()
434 if (!ms_check_period (pEhci, u32Frame, u32uFrame + pQh->u8Gap_uf + 1, in ms_check_intr_schedule()
437 if (!ms_check_period (pEhci, u32Frame, u32uFrame + pQh->u8Gap_uf, in ms_check_intr_schedule()
509 static int ms_qh_schedule (struct ehci_hcd *pEhci, struct ehci_qh *pQh) in ms_qh_schedule() argument
522 iStatus = ms_check_intr_schedule (pEhci, u32Frame1, --u32uFrame1, in ms_qh_schedule()
543 u32Frame1 = ++pEhci->u32random_frm % pQh->u16Period; in ms_qh_schedule()
546 iStatus = ms_check_intr_schedule (pEhci, u32Frame1, u32uFrame1, pQh, &u32_C_mask1); in ms_qh_schedule()
558 iStatus = ms_check_intr_schedule (pEhci, 0, 0, pQh, &u32_C_mask1); in ms_qh_schedule()
584 if (pEhci->pshadow [u32Frame1].ptr != 0) in ms_qh_schedule()
590 pEhci->pshadow [u32Frame1].qh = ms_qh_get (pQh); in ms_qh_schedule()
591 pEhci->pPeriodic [u32Frame1] = QH_NEXT (pQh->qh_dma_addr); in ms_qh_schedule()
595 } while (u32Frame1 < pEhci->u32PeriodicSize); in ms_qh_schedule()
597 if (!pEhci->u32PeriodicSched++) in ms_qh_schedule()
598 iStatus = ms_enable_periodic (pEhci); in ms_qh_schedule()
605 struct ehci_hcd *pEhci, in ms_intr_submit() argument
623 osapi_spin_lock_irqsave (&pEhci->tHcdLock, u32Flags); in ms_intr_submit()
629 pQh1 = ms_qh_append_tds (pEhci, pUrb, &stEmpty, epnum1, &dev->ep [epnum1]); in ms_intr_submit()
637 if ((status = ms_qh_schedule (pEhci, pQh1)) != 0) in ms_intr_submit()
641 pQh1 = ms_qh_append_tds (pEhci, pUrb, qtd_list, epnum1, &dev->ep [epnum1]); in ms_intr_submit()
648 ms_qh_refresh(pEhci, pQh1); in ms_intr_submit()
649 ms_qh_link_periodic(pEhci, pQh1); in ms_intr_submit()
655 osapi_spin_unlock_irqrestore (&pEhci->tHcdLock, u32Flags); in ms_intr_submit()
657 ms_qtd_register_free (pEhci, qtd_list); in ms_intr_submit()
663 struct ehci_hcd *pEhci, in ms_intr_complete() argument
678 u32Count = ms_qh_completions (pEhci, pQh, pRegs); in ms_intr_complete()
680 ms_intr_deschedule (pEhci, pQh); in ms_intr_complete()
686 static void ms_scan_periodic (struct ehci_hcd *pEhci, struct stPtRegs *pRegs) in ms_scan_periodic() argument
691 u32Mod = pEhci->u32PeriodicSize << 3; in ms_scan_periodic()
692 u32Frame = pEhci->iNextUframe >> 3; in ms_scan_periodic()
693 if (HCD_IS_RUNNING (pEhci->hcd.state)) in ms_scan_periodic()
694 u32clock_uframe = hcd_reg_readl ((U32)&pEhci->op_regs->frindex); in ms_scan_periodic()
697 u32clock_uframe = pEhci->iNextUframe + u32Mod - 1; in ms_scan_periodic()
707 q_p = &pEhci->pshadow [u32Frame]; in ms_scan_periodic()
708 hw_p = &pEhci->pPeriodic [u32Frame]; in ms_scan_periodic()
723 u32Count = ms_intr_complete (pEhci, ms_qh_get (q.qh), pRegs); in ms_scan_periodic()
724 ms_qh_put (pEhci, q.qh); in ms_scan_periodic()
739 if (pEhci->u32PeriodicSched > 0) in ms_scan_periodic()
750 if (!HCD_IS_RUNNING (pEhci->hcd.state) || pEhci->u32PeriodicSched == 0) in ms_scan_periodic()
753 pEhci->iNextUframe = u32clock_uframe; in ms_scan_periodic()
754 now = hcd_reg_readl ((U32)&pEhci->op_regs->frindex) % u32Mod; in ms_scan_periodic()
762 u32Frame = (u32Frame + 1) % pEhci->u32PeriodicSize; in ms_scan_periodic()