Lines Matching refs:oxu
55 #define oxu_dbg(oxu, fmt, args...) \ argument
56 dev_dbg(oxu_to_hcd(oxu)->self.controller , fmt , ## args)
57 #define oxu_err(oxu, fmt, args...) \ argument
58 dev_err(oxu_to_hcd(oxu)->self.controller , fmt , ## args)
59 #define oxu_info(oxu, fmt, args...) \ argument
60 dev_info(oxu_to_hcd(oxu)->self.controller , fmt , ## args)
66 static inline struct usb_hcd *oxu_to_hcd(struct oxu_hcd *oxu) in oxu_to_hcd() argument
68 return container_of((void *) oxu, struct usb_hcd, hcd_priv); in oxu_to_hcd()
86 #define oxu_vdbg(oxu, fmt, args...) /* Nop */ argument
205 #define dbg_status(oxu, label, status) { \ argument
208 oxu_dbg(oxu, "%s\n", _buf); \
211 #define dbg_cmd(oxu, label, command) { \ argument
214 oxu_dbg(oxu, "%s\n", _buf); \
217 #define dbg_port(oxu, label, port, status) { \ argument
220 oxu_dbg(oxu, "%s\n", _buf); \
243 static void ehci_work(struct oxu_hcd *oxu);
263 static inline void timer_action_done(struct oxu_hcd *oxu, in timer_action_done() argument
266 clear_bit(action, &oxu->actions); in timer_action_done()
269 static inline void timer_action(struct oxu_hcd *oxu, in timer_action() argument
272 if (!test_and_set_bit(action, &oxu->actions)) { in timer_action()
297 && t > oxu->watchdog.expires in timer_action()
298 && timer_pending(&oxu->watchdog)) in timer_action()
300 mod_timer(&oxu->watchdog, t); in timer_action()
321 static int handshake(struct oxu_hcd *oxu, void __iomem *ptr, in handshake() argument
340 static int ehci_halt(struct oxu_hcd *oxu) in ehci_halt() argument
342 u32 temp = readl(&oxu->regs->status); in ehci_halt()
345 writel(0, &oxu->regs->intr_enable); in ehci_halt()
350 temp = readl(&oxu->regs->command); in ehci_halt()
352 writel(temp, &oxu->regs->command); in ehci_halt()
353 return handshake(oxu, &oxu->regs->status, in ehci_halt()
358 static void tdi_reset(struct oxu_hcd *oxu) in tdi_reset() argument
363 reg_ptr = (u32 __iomem *)(((u8 __iomem *)oxu->regs) + 0x68); in tdi_reset()
370 static int ehci_reset(struct oxu_hcd *oxu) in ehci_reset() argument
373 u32 command = readl(&oxu->regs->command); in ehci_reset()
376 dbg_cmd(oxu, "reset", command); in ehci_reset()
377 writel(command, &oxu->regs->command); in ehci_reset()
378 oxu_to_hcd(oxu)->state = HC_STATE_HALT; in ehci_reset()
379 oxu->next_statechange = jiffies; in ehci_reset()
380 retval = handshake(oxu, &oxu->regs->command, in ehci_reset()
386 tdi_reset(oxu); in ehci_reset()
392 static void ehci_quiesce(struct oxu_hcd *oxu) in ehci_quiesce() argument
397 if (!HC_IS_RUNNING(oxu_to_hcd(oxu)->state)) in ehci_quiesce()
402 temp = readl(&oxu->regs->command) << 10; in ehci_quiesce()
404 if (handshake(oxu, &oxu->regs->status, STS_ASS | STS_PSS, in ehci_quiesce()
406 oxu_to_hcd(oxu)->state = HC_STATE_HALT; in ehci_quiesce()
411 temp = readl(&oxu->regs->command); in ehci_quiesce()
413 writel(temp, &oxu->regs->command); in ehci_quiesce()
416 if (handshake(oxu, &oxu->regs->status, STS_ASS | STS_PSS, in ehci_quiesce()
418 oxu_to_hcd(oxu)->state = HC_STATE_HALT; in ehci_quiesce()
423 static int check_reset_complete(struct oxu_hcd *oxu, int index, in check_reset_complete() argument
427 oxu->reset_done[index] = 0; in check_reset_complete()
433 oxu_dbg(oxu, "Failed to enable port %d on root hub TT\n", in check_reset_complete()
437 oxu_dbg(oxu, "port %d high speed\n", index + 1); in check_reset_complete()
442 static void ehci_hub_descriptor(struct oxu_hcd *oxu, in ehci_hub_descriptor() argument
445 int ports = HCS_N_PORTS(oxu->hcs_params); in ehci_hub_descriptor()
461 if (HCS_PPC(oxu->hcs_params)) in ehci_hub_descriptor()
483 static int oxu_buf_alloc(struct oxu_hcd *oxu, struct ehci_qtd *qtd, int len) in oxu_buf_alloc() argument
491 oxu_err(oxu, "buffer too big (%d)\n", len); in oxu_buf_alloc()
495 spin_lock(&oxu->mem_lock); in oxu_buf_alloc()
506 i += max(a_blocks, (int)oxu->db_used[i])) { in oxu_buf_alloc()
510 if (oxu->db_used[i + j]) in oxu_buf_alloc()
517 qtd->buffer = (void *) &oxu->mem->db_pool[i]; in oxu_buf_alloc()
521 oxu->db_used[i] = a_blocks; in oxu_buf_alloc()
523 spin_unlock(&oxu->mem_lock); in oxu_buf_alloc()
530 spin_unlock(&oxu->mem_lock); in oxu_buf_alloc()
535 static void oxu_buf_free(struct oxu_hcd *oxu, struct ehci_qtd *qtd) in oxu_buf_free() argument
539 spin_lock(&oxu->mem_lock); in oxu_buf_free()
541 index = (qtd->buffer - (void *) &oxu->mem->db_pool[0]) in oxu_buf_free()
543 oxu->db_used[index] = 0; in oxu_buf_free()
548 spin_unlock(&oxu->mem_lock); in oxu_buf_free()
561 static inline void oxu_qtd_free(struct oxu_hcd *oxu, struct ehci_qtd *qtd) in oxu_qtd_free() argument
566 oxu_buf_free(oxu, qtd); in oxu_qtd_free()
568 spin_lock(&oxu->mem_lock); in oxu_qtd_free()
570 index = qtd - &oxu->mem->qtd_pool[0]; in oxu_qtd_free()
571 oxu->qtd_used[index] = 0; in oxu_qtd_free()
573 spin_unlock(&oxu->mem_lock); in oxu_qtd_free()
576 static struct ehci_qtd *ehci_qtd_alloc(struct oxu_hcd *oxu) in ehci_qtd_alloc() argument
581 spin_lock(&oxu->mem_lock); in ehci_qtd_alloc()
584 if (!oxu->qtd_used[i]) in ehci_qtd_alloc()
588 qtd = (struct ehci_qtd *) &oxu->mem->qtd_pool[i]; in ehci_qtd_alloc()
598 oxu->qtd_used[i] = 1; in ehci_qtd_alloc()
601 spin_unlock(&oxu->mem_lock); in ehci_qtd_alloc()
606 static void oxu_qh_free(struct oxu_hcd *oxu, struct ehci_qh *qh) in oxu_qh_free() argument
610 spin_lock(&oxu->mem_lock); in oxu_qh_free()
612 index = qh - &oxu->mem->qh_pool[0]; in oxu_qh_free()
613 oxu->qh_used[index] = 0; in oxu_qh_free()
615 spin_unlock(&oxu->mem_lock); in oxu_qh_free()
621 struct oxu_hcd *oxu = qh->oxu; in qh_destroy() local
625 oxu_dbg(oxu, "unused qh not empty!\n"); in qh_destroy()
629 oxu_qtd_free(oxu, qh->dummy); in qh_destroy()
630 oxu_qh_free(oxu, qh); in qh_destroy()
633 static struct ehci_qh *oxu_qh_alloc(struct oxu_hcd *oxu) in oxu_qh_alloc() argument
638 spin_lock(&oxu->mem_lock); in oxu_qh_alloc()
641 if (!oxu->qh_used[i]) in oxu_qh_alloc()
645 qh = (struct ehci_qh *) &oxu->mem->qh_pool[i]; in oxu_qh_alloc()
649 qh->oxu = oxu; in oxu_qh_alloc()
654 qh->dummy = ehci_qtd_alloc(oxu); in oxu_qh_alloc()
656 oxu_dbg(oxu, "no dummy td\n"); in oxu_qh_alloc()
657 oxu->qh_used[i] = 0; in oxu_qh_alloc()
662 oxu->qh_used[i] = 1; in oxu_qh_alloc()
665 spin_unlock(&oxu->mem_lock); in oxu_qh_alloc()
682 static void oxu_murb_free(struct oxu_hcd *oxu, struct oxu_murb *murb) in oxu_murb_free() argument
686 spin_lock(&oxu->mem_lock); in oxu_murb_free()
688 index = murb - &oxu->murb_pool[0]; in oxu_murb_free()
689 oxu->murb_used[index] = 0; in oxu_murb_free()
691 spin_unlock(&oxu->mem_lock); in oxu_murb_free()
694 static struct oxu_murb *oxu_murb_alloc(struct oxu_hcd *oxu) in oxu_murb_alloc() argument
700 spin_lock(&oxu->mem_lock); in oxu_murb_alloc()
703 if (!oxu->murb_used[i]) in oxu_murb_alloc()
707 murb = &(oxu->murb_pool)[i]; in oxu_murb_alloc()
709 oxu->murb_used[i] = 1; in oxu_murb_alloc()
712 spin_unlock(&oxu->mem_lock); in oxu_murb_alloc()
721 static void ehci_mem_cleanup(struct oxu_hcd *oxu) in ehci_mem_cleanup() argument
723 kfree(oxu->murb_pool); in ehci_mem_cleanup()
724 oxu->murb_pool = NULL; in ehci_mem_cleanup()
726 if (oxu->async) in ehci_mem_cleanup()
727 qh_put(oxu->async); in ehci_mem_cleanup()
728 oxu->async = NULL; in ehci_mem_cleanup()
730 del_timer(&oxu->urb_timer); in ehci_mem_cleanup()
732 oxu->periodic = NULL; in ehci_mem_cleanup()
735 kfree(oxu->pshadow); in ehci_mem_cleanup()
736 oxu->pshadow = NULL; in ehci_mem_cleanup()
741 static int ehci_mem_init(struct oxu_hcd *oxu, gfp_t flags) in ehci_mem_init() argument
745 for (i = 0; i < oxu->periodic_size; i++) in ehci_mem_init()
746 oxu->mem->frame_list[i] = EHCI_LIST_END; in ehci_mem_init()
748 oxu->qh_used[i] = 0; in ehci_mem_init()
750 oxu->qtd_used[i] = 0; in ehci_mem_init()
752 oxu->murb_pool = kcalloc(MURB_NUM, sizeof(struct oxu_murb), flags); in ehci_mem_init()
753 if (!oxu->murb_pool) in ehci_mem_init()
757 oxu->murb_used[i] = 0; in ehci_mem_init()
759 oxu->async = oxu_qh_alloc(oxu); in ehci_mem_init()
760 if (!oxu->async) in ehci_mem_init()
763 oxu->periodic = (__le32 *) &oxu->mem->frame_list; in ehci_mem_init()
764 oxu->periodic_dma = virt_to_phys(oxu->periodic); in ehci_mem_init()
766 for (i = 0; i < oxu->periodic_size; i++) in ehci_mem_init()
767 oxu->periodic[i] = EHCI_LIST_END; in ehci_mem_init()
770 oxu->pshadow = kcalloc(oxu->periodic_size, sizeof(void *), flags); in ehci_mem_init()
771 if (oxu->pshadow != NULL) in ehci_mem_init()
775 oxu_dbg(oxu, "couldn't init memory\n"); in ehci_mem_init()
776 ehci_mem_cleanup(oxu); in ehci_mem_init()
820 static inline void qh_update(struct oxu_hcd *oxu, in qh_update() argument
854 static void qh_refresh(struct oxu_hcd *oxu, struct ehci_qh *qh) in qh_refresh() argument
869 qh_update(oxu, qh, qtd); in qh_refresh()
872 static void qtd_copy_status(struct oxu_hcd *oxu, struct urb *urb, in qtd_copy_status() argument
904 oxu_dbg(oxu, "devpath %s ep%d%s 3strikes\n", in qtd_copy_status()
916 oxu_vdbg(oxu, "dev%d ep%d%s qtd token %08x --> status %d\n", in qtd_copy_status()
924 static void ehci_urb_done(struct oxu_hcd *oxu, struct urb *urb) in ehci_urb_done() argument
925 __releases(oxu->lock) in ehci_urb_done()
926 __acquires(oxu->lock) in ehci_urb_done()
935 oxu_to_hcd(oxu)->self.bandwidth_int_reqs--; in ehci_urb_done()
956 oxu_dbg(oxu, "%s %s urb %p ep%d%s status %d len %d/%d\n", in ehci_urb_done()
965 spin_unlock(&oxu->lock); in ehci_urb_done()
966 usb_hcd_giveback_urb(oxu_to_hcd(oxu), urb, urb->status); in ehci_urb_done()
967 spin_lock(&oxu->lock); in ehci_urb_done()
970 static void start_unlink_async(struct oxu_hcd *oxu, struct ehci_qh *qh);
971 static void unlink_async(struct oxu_hcd *oxu, struct ehci_qh *qh);
973 static void intr_deschedule(struct oxu_hcd *oxu, struct ehci_qh *qh);
974 static int qh_schedule(struct oxu_hcd *oxu, struct ehci_qh *qh);
982 static unsigned qh_completions(struct oxu_hcd *oxu, struct ehci_qh *qh) in qh_completions() argument
1025 ehci_urb_done(oxu, last->urb); in qh_completions()
1028 oxu_murb_free(oxu, murb); in qh_completions()
1030 ehci_urb_done(oxu, last->urb); in qh_completions()
1034 oxu_qtd_free(oxu, last); in qh_completions()
1063 HC_IS_RUNNING(oxu_to_hcd(oxu)->state))) { in qh_completions()
1069 if (unlikely(!HC_IS_RUNNING(oxu_to_hcd(oxu)->state))) in qh_completions()
1104 qtd_copy_status(oxu, urb->complete ? in qh_completions()
1128 ehci_urb_done(oxu, last->urb); in qh_completions()
1131 oxu_murb_free(oxu, murb); in qh_completions()
1133 ehci_urb_done(oxu, last->urb); in qh_completions()
1136 oxu_qtd_free(oxu, last); in qh_completions()
1149 qh_refresh(oxu, qh); in qh_completions()
1157 intr_deschedule(oxu, qh); in qh_completions()
1158 (void) qh_schedule(oxu, qh); in qh_completions()
1160 unlink_async(oxu, qh); in qh_completions()
1177 static void qtd_list_free(struct oxu_hcd *oxu, in qtd_list_free() argument
1187 oxu_qtd_free(oxu, qtd); in qtd_list_free()
1193 static struct list_head *qh_urb_transaction(struct oxu_hcd *oxu, in qh_urb_transaction() argument
1209 qtd = ehci_qtd_alloc(oxu); in qh_urb_transaction()
1226 ret = oxu_buf_alloc(oxu, qtd, sizeof(struct usb_ctrlrequest)); in qh_urb_transaction()
1238 qtd = ehci_qtd_alloc(oxu); in qh_urb_transaction()
1254 ret = oxu_buf_alloc(oxu, qtd, len); in qh_urb_transaction()
1284 qtd->hw_alt_next = oxu->async->hw_alt_next; in qh_urb_transaction()
1294 qtd = ehci_qtd_alloc(oxu); in qh_urb_transaction()
1298 ret = oxu_buf_alloc(oxu, qtd, len); in qh_urb_transaction()
1332 qtd = ehci_qtd_alloc(oxu); in qh_urb_transaction()
1349 qtd_list_free(oxu, urb, head); in qh_urb_transaction()
1360 static struct ehci_qh *qh_make(struct oxu_hcd *oxu, in qh_make() argument
1363 struct ehci_qh *qh = oxu_qh_alloc(oxu); in qh_make()
1405 oxu_dbg(oxu, "intr period %d uframes, NYET!\n", in qh_make()
1477 oxu_dbg(oxu, "bogus dev %p speed %d\n", urb->dev, urb->dev->speed); in qh_make()
1490 qh_refresh(oxu, qh); in qh_make()
1496 static void qh_link_async(struct oxu_hcd *oxu, struct ehci_qh *qh) in qh_link_async() argument
1502 head = oxu->async; in qh_link_async()
1503 timer_action_done(oxu, TIMER_ASYNC_OFF); in qh_link_async()
1505 u32 cmd = readl(&oxu->regs->command); in qh_link_async()
1509 (void)handshake(oxu, &oxu->regs->status, in qh_link_async()
1512 writel(cmd, &oxu->regs->command); in qh_link_async()
1513 oxu_to_hcd(oxu)->state = HC_STATE_RUNNING; in qh_link_async()
1520 qh_refresh(oxu, qh); in qh_link_async()
1542 static struct ehci_qh *qh_append_tds(struct oxu_hcd *oxu, in qh_append_tds() argument
1551 qh = qh_make(oxu, urb, GFP_ATOMIC); in qh_append_tds()
1617 static int submit_async(struct oxu_hcd *oxu, struct urb *urb, in submit_async() argument
1630 oxu_dbg(oxu, "%s %s urb %p ep%d%s len %d, qtd %p [qh %p]\n", in submit_async()
1637 spin_lock_irqsave(&oxu->lock, flags); in submit_async()
1638 if (unlikely(!HCD_HW_ACCESSIBLE(oxu_to_hcd(oxu)))) { in submit_async()
1643 qh = qh_append_tds(oxu, urb, qtd_list, epnum, &urb->ep->hcpriv); in submit_async()
1653 qh_link_async(oxu, qh_get(qh)); in submit_async()
1655 spin_unlock_irqrestore(&oxu->lock, flags); in submit_async()
1657 qtd_list_free(oxu, urb, qtd_list); in submit_async()
1663 static void end_unlink_async(struct oxu_hcd *oxu) in end_unlink_async() argument
1665 struct ehci_qh *qh = oxu->reclaim; in end_unlink_async()
1668 timer_action_done(oxu, TIMER_IAA_WATCHDOG); in end_unlink_async()
1676 oxu->reclaim = next; in end_unlink_async()
1677 oxu->reclaim_ready = 0; in end_unlink_async()
1680 qh_completions(oxu, qh); in end_unlink_async()
1683 && HC_IS_RUNNING(oxu_to_hcd(oxu)->state)) in end_unlink_async()
1684 qh_link_async(oxu, qh); in end_unlink_async()
1691 if (HC_IS_RUNNING(oxu_to_hcd(oxu)->state) in end_unlink_async()
1692 && oxu->async->qh_next.qh == NULL) in end_unlink_async()
1693 timer_action(oxu, TIMER_ASYNC_OFF); in end_unlink_async()
1697 oxu->reclaim = NULL; in end_unlink_async()
1698 start_unlink_async(oxu, next); in end_unlink_async()
1705 static void start_unlink_async(struct oxu_hcd *oxu, struct ehci_qh *qh) in start_unlink_async() argument
1707 int cmd = readl(&oxu->regs->command); in start_unlink_async()
1711 assert_spin_locked(&oxu->lock); in start_unlink_async()
1712 if (oxu->reclaim || (qh->qh_state != QH_STATE_LINKED in start_unlink_async()
1718 if (unlikely(qh == oxu->async)) { in start_unlink_async()
1720 if (oxu_to_hcd(oxu)->state != HC_STATE_HALT in start_unlink_async()
1721 && !oxu->reclaim) { in start_unlink_async()
1723 writel(cmd & ~CMD_ASE, &oxu->regs->command); in start_unlink_async()
1726 timer_action_done(oxu, TIMER_ASYNC_OFF); in start_unlink_async()
1732 oxu->reclaim = qh = qh_get(qh); in start_unlink_async()
1734 prev = oxu->async; in start_unlink_async()
1742 if (unlikely(oxu_to_hcd(oxu)->state == HC_STATE_HALT)) { in start_unlink_async()
1746 end_unlink_async(oxu); in start_unlink_async()
1750 oxu->reclaim_ready = 0; in start_unlink_async()
1752 writel(cmd, &oxu->regs->command); in start_unlink_async()
1753 (void) readl(&oxu->regs->command); in start_unlink_async()
1754 timer_action(oxu, TIMER_IAA_WATCHDOG); in start_unlink_async()
1757 static void scan_async(struct oxu_hcd *oxu) in scan_async() argument
1762 if (!++(oxu->stamp)) in scan_async()
1763 oxu->stamp++; in scan_async()
1764 timer_action_done(oxu, TIMER_ASYNC_SHRINK); in scan_async()
1766 qh = oxu->async->qh_next.qh; in scan_async()
1771 && qh->stamp != oxu->stamp) { in scan_async()
1780 qh->stamp = oxu->stamp; in scan_async()
1781 temp = qh_completions(oxu, qh); in scan_async()
1794 if (qh->stamp == oxu->stamp) in scan_async()
1796 else if (!oxu->reclaim in scan_async()
1798 start_unlink_async(oxu, qh); in scan_async()
1805 timer_action(oxu, TIMER_ASYNC_SHRINK); in scan_async()
1824 static void periodic_unlink(struct oxu_hcd *oxu, unsigned frame, void *ptr) in periodic_unlink() argument
1826 union ehci_shadow *prev_p = &oxu->pshadow[frame]; in periodic_unlink()
1827 __le32 *hw_p = &oxu->periodic[frame]; in periodic_unlink()
1848 static unsigned short periodic_usecs(struct oxu_hcd *oxu, in periodic_usecs() argument
1851 __le32 *hw_p = &oxu->periodic[frame]; in periodic_usecs()
1852 union ehci_shadow *q = &oxu->pshadow[frame]; in periodic_usecs()
1872 oxu_err(oxu, "uframe %d sched overrun: %d usecs\n", in periodic_usecs()
1878 static int enable_periodic(struct oxu_hcd *oxu) in enable_periodic() argument
1886 status = handshake(oxu, &oxu->regs->status, STS_PSS, 0, 9 * 125); in enable_periodic()
1888 oxu_to_hcd(oxu)->state = HC_STATE_HALT; in enable_periodic()
1889 usb_hc_died(oxu_to_hcd(oxu)); in enable_periodic()
1893 cmd = readl(&oxu->regs->command) | CMD_PSE; in enable_periodic()
1894 writel(cmd, &oxu->regs->command); in enable_periodic()
1896 oxu_to_hcd(oxu)->state = HC_STATE_RUNNING; in enable_periodic()
1899 oxu->next_uframe = readl(&oxu->regs->frame_index) in enable_periodic()
1900 % (oxu->periodic_size << 3); in enable_periodic()
1904 static int disable_periodic(struct oxu_hcd *oxu) in disable_periodic() argument
1912 status = handshake(oxu, &oxu->regs->status, STS_PSS, STS_PSS, 9 * 125); in disable_periodic()
1914 oxu_to_hcd(oxu)->state = HC_STATE_HALT; in disable_periodic()
1915 usb_hc_died(oxu_to_hcd(oxu)); in disable_periodic()
1919 cmd = readl(&oxu->regs->command) & ~CMD_PSE; in disable_periodic()
1920 writel(cmd, &oxu->regs->command); in disable_periodic()
1923 oxu->next_uframe = -1; in disable_periodic()
1933 static int qh_link_periodic(struct oxu_hcd *oxu, struct ehci_qh *qh) in qh_link_periodic() argument
1947 for (i = qh->start; i < oxu->periodic_size; i += period) { in qh_link_periodic()
1948 union ehci_shadow *prev = &oxu->pshadow[i]; in qh_link_periodic()
1949 __le32 *hw_p = &oxu->periodic[i]; in qh_link_periodic()
1987 oxu_to_hcd(oxu)->self.bandwidth_allocated += qh->period in qh_link_periodic()
1992 if (!oxu->periodic_sched++) in qh_link_periodic()
1993 return enable_periodic(oxu); in qh_link_periodic()
1998 static void qh_unlink_periodic(struct oxu_hcd *oxu, struct ehci_qh *qh) in qh_unlink_periodic() argument
2016 for (i = qh->start; i < oxu->periodic_size; i += period) in qh_unlink_periodic()
2017 periodic_unlink(oxu, i, qh); in qh_unlink_periodic()
2020 oxu_to_hcd(oxu)->self.bandwidth_allocated -= qh->period in qh_unlink_periodic()
2036 oxu->periodic_sched--; in qh_unlink_periodic()
2037 if (!oxu->periodic_sched) in qh_unlink_periodic()
2038 (void) disable_periodic(oxu); in qh_unlink_periodic()
2041 static void intr_deschedule(struct oxu_hcd *oxu, struct ehci_qh *qh) in intr_deschedule() argument
2045 qh_unlink_periodic(oxu, qh); in intr_deschedule()
2064 static int check_period(struct oxu_hcd *oxu, in check_period() argument
2088 claimed = periodic_usecs(oxu, frame, uframe); in check_period()
2092 } while ((frame += 1) < oxu->periodic_size); in check_period()
2097 claimed = periodic_usecs(oxu, frame, uframe); in check_period()
2100 } while ((frame += period) < oxu->periodic_size); in check_period()
2106 static int check_intr_schedule(struct oxu_hcd *oxu, in check_intr_schedule() argument
2115 if (!check_period(oxu, frame, uframe, qh->period, qh->usecs)) in check_intr_schedule()
2130 static int qh_schedule(struct oxu_hcd *oxu, struct ehci_qh *qh) in qh_schedule() argument
2137 qh_refresh(oxu, qh); in qh_schedule()
2144 status = check_intr_schedule(oxu, frame, --uframe, in qh_schedule()
2161 status = check_intr_schedule(oxu, in qh_schedule()
2172 status = check_intr_schedule(oxu, 0, 0, qh, &c_mask); in qh_schedule()
2185 oxu_dbg(oxu, "reused qh %p schedule\n", qh); in qh_schedule()
2188 status = qh_link_periodic(oxu, qh); in qh_schedule()
2193 static int intr_submit(struct oxu_hcd *oxu, struct urb *urb, in intr_submit() argument
2205 spin_lock_irqsave(&oxu->lock, flags); in intr_submit()
2207 if (unlikely(!HCD_HW_ACCESSIBLE(oxu_to_hcd(oxu)))) { in intr_submit()
2214 qh = qh_append_tds(oxu, urb, &empty, epnum, &urb->ep->hcpriv); in intr_submit()
2220 status = qh_schedule(oxu, qh); in intr_submit()
2226 qh = qh_append_tds(oxu, urb, qtd_list, epnum, &urb->ep->hcpriv); in intr_submit()
2230 oxu_to_hcd(oxu)->self.bandwidth_int_reqs++; in intr_submit()
2233 spin_unlock_irqrestore(&oxu->lock, flags); in intr_submit()
2235 qtd_list_free(oxu, urb, qtd_list); in intr_submit()
2240 static inline int itd_submit(struct oxu_hcd *oxu, struct urb *urb, in itd_submit() argument
2243 oxu_dbg(oxu, "iso support is missing!\n"); in itd_submit()
2247 static inline int sitd_submit(struct oxu_hcd *oxu, struct urb *urb, in sitd_submit() argument
2250 oxu_dbg(oxu, "split iso support is missing!\n"); in sitd_submit()
2254 static void scan_periodic(struct oxu_hcd *oxu) in scan_periodic() argument
2259 mod = oxu->periodic_size << 3; in scan_periodic()
2266 now_uframe = oxu->next_uframe; in scan_periodic()
2267 if (HC_IS_RUNNING(oxu_to_hcd(oxu)->state)) in scan_periodic()
2268 clock = readl(&oxu->regs->frame_index); in scan_periodic()
2290 q_p = &oxu->pshadow[frame]; in scan_periodic()
2291 hw_p = &oxu->periodic[frame]; in scan_periodic()
2300 live = HC_IS_RUNNING(oxu_to_hcd(oxu)->state); in scan_periodic()
2307 modified = qh_completions(oxu, temp.qh); in scan_periodic()
2309 intr_deschedule(oxu, temp.qh); in scan_periodic()
2313 oxu_dbg(oxu, "corrupt type %d frame %d shadow %p\n", in scan_periodic()
2337 if (!HC_IS_RUNNING(oxu_to_hcd(oxu)->state)) in scan_periodic()
2339 oxu->next_uframe = now_uframe; in scan_periodic()
2340 now = readl(&oxu->regs->frame_index) % mod; in scan_periodic()
2357 static void ehci_turn_off_all_ports(struct oxu_hcd *oxu) in ehci_turn_off_all_ports() argument
2359 int port = HCS_N_PORTS(oxu->hcs_params); in ehci_turn_off_all_ports()
2362 writel(PORT_RWC_BITS, &oxu->regs->port_status[port]); in ehci_turn_off_all_ports()
2365 static void ehci_port_power(struct oxu_hcd *oxu, int is_on) in ehci_port_power() argument
2369 if (!HCS_PPC(oxu->hcs_params)) in ehci_port_power()
2372 oxu_dbg(oxu, "...power%s ports...\n", is_on ? "up" : "down"); in ehci_port_power()
2373 for (port = HCS_N_PORTS(oxu->hcs_params); port > 0; ) in ehci_port_power()
2374 (void) oxu_hub_control(oxu_to_hcd(oxu), in ehci_port_power()
2384 static void ehci_work(struct oxu_hcd *oxu) in ehci_work() argument
2386 timer_action_done(oxu, TIMER_IO_WATCHDOG); in ehci_work()
2387 if (oxu->reclaim_ready) in ehci_work()
2388 end_unlink_async(oxu); in ehci_work()
2394 if (oxu->scanning) in ehci_work()
2396 oxu->scanning = 1; in ehci_work()
2397 scan_async(oxu); in ehci_work()
2398 if (oxu->next_uframe != -1) in ehci_work()
2399 scan_periodic(oxu); in ehci_work()
2400 oxu->scanning = 0; in ehci_work()
2406 if (HC_IS_RUNNING(oxu_to_hcd(oxu)->state) && in ehci_work()
2407 (oxu->async->qh_next.ptr != NULL || in ehci_work()
2408 oxu->periodic_sched != 0)) in ehci_work()
2409 timer_action(oxu, TIMER_IO_WATCHDOG); in ehci_work()
2412 static void unlink_async(struct oxu_hcd *oxu, struct ehci_qh *qh) in unlink_async() argument
2416 && oxu->reclaim in unlink_async()
2417 && HC_IS_RUNNING(oxu_to_hcd(oxu)->state)) { in unlink_async()
2420 for (last = oxu->reclaim; in unlink_async()
2428 } else if (!HC_IS_RUNNING(oxu_to_hcd(oxu)->state) && oxu->reclaim) in unlink_async()
2429 end_unlink_async(oxu); in unlink_async()
2433 start_unlink_async(oxu, qh); in unlink_async()
2442 struct oxu_hcd *oxu = hcd_to_oxu(hcd); in oxu210_hcd_irq() local
2446 spin_lock(&oxu->lock); in oxu210_hcd_irq()
2448 status = readl(&oxu->regs->status); in oxu210_hcd_irq()
2452 oxu_dbg(oxu, "device removed\n"); in oxu210_hcd_irq()
2459 spin_unlock(&oxu->lock); in oxu210_hcd_irq()
2464 writel(status, &oxu->regs->status); in oxu210_hcd_irq()
2465 readl(&oxu->regs->command); /* unblock posted write */ in oxu210_hcd_irq()
2470 dbg_status(oxu, "irq", status); in oxu210_hcd_irq()
2481 oxu->reclaim_ready = 1; in oxu210_hcd_irq()
2487 unsigned i = HCS_N_PORTS(oxu->hcs_params); in oxu210_hcd_irq()
2491 if (!(readl(&oxu->regs->command) & CMD_RUN)) in oxu210_hcd_irq()
2495 int pstatus = readl(&oxu->regs->port_status[i]); in oxu210_hcd_irq()
2500 || oxu->reset_done[i] != 0) in oxu210_hcd_irq()
2507 oxu->reset_done[i] = jiffies + in oxu210_hcd_irq()
2509 oxu_dbg(oxu, "port %d remote wakeup\n", i + 1); in oxu210_hcd_irq()
2510 mod_timer(&hcd->rh_timer, oxu->reset_done[i]); in oxu210_hcd_irq()
2517 status = readl(&oxu->regs->status); in oxu210_hcd_irq()
2518 dbg_cmd(oxu, "fatal", readl(&oxu->regs->command)); in oxu210_hcd_irq()
2519 dbg_status(oxu, "fatal", status); in oxu210_hcd_irq()
2521 oxu_err(oxu, "fatal error\n"); in oxu210_hcd_irq()
2523 ehci_reset(oxu); in oxu210_hcd_irq()
2524 writel(0, &oxu->regs->configured_flag); in oxu210_hcd_irq()
2534 ehci_work(oxu); in oxu210_hcd_irq()
2535 spin_unlock(&oxu->lock); in oxu210_hcd_irq()
2543 struct oxu_hcd *oxu = hcd_to_oxu(hcd); in oxu_irq() local
2552 if ((oxu->is_otg && (status & OXU_USBOTGI)) || in oxu_irq()
2553 (!oxu->is_otg && (status & OXU_USBSPHI))) in oxu_irq()
2566 struct oxu_hcd *oxu = (struct oxu_hcd *) param; in oxu_watchdog() local
2569 spin_lock_irqsave(&oxu->lock, flags); in oxu_watchdog()
2572 if (oxu->reclaim) { in oxu_watchdog()
2573 u32 status = readl(&oxu->regs->status); in oxu_watchdog()
2575 oxu_vdbg(oxu, "lost IAA\n"); in oxu_watchdog()
2576 writel(STS_IAA, &oxu->regs->status); in oxu_watchdog()
2577 oxu->reclaim_ready = 1; in oxu_watchdog()
2582 if (test_bit(TIMER_ASYNC_OFF, &oxu->actions)) in oxu_watchdog()
2583 start_unlink_async(oxu, oxu->async); in oxu_watchdog()
2586 ehci_work(oxu); in oxu_watchdog()
2588 spin_unlock_irqrestore(&oxu->lock, flags); in oxu_watchdog()
2595 struct oxu_hcd *oxu = hcd_to_oxu(hcd); in oxu_hcd_init() local
2600 spin_lock_init(&oxu->lock); in oxu_hcd_init()
2602 setup_timer(&oxu->watchdog, oxu_watchdog, (unsigned long)oxu); in oxu_hcd_init()
2608 oxu->periodic_size = DEFAULT_I_TDPS; in oxu_hcd_init()
2609 retval = ehci_mem_init(oxu, GFP_KERNEL); in oxu_hcd_init()
2614 hcc_params = readl(&oxu->caps->hcc_params); in oxu_hcd_init()
2616 oxu->i_thresh = 8; in oxu_hcd_init()
2618 oxu->i_thresh = 2 + HCC_ISOC_THRES(hcc_params); in oxu_hcd_init()
2620 oxu->reclaim = NULL; in oxu_hcd_init()
2621 oxu->reclaim_ready = 0; in oxu_hcd_init()
2622 oxu->next_uframe = -1; in oxu_hcd_init()
2631 oxu->async->qh_next.qh = NULL; in oxu_hcd_init()
2632 oxu->async->hw_next = QH_NEXT(oxu->async->qh_dma); in oxu_hcd_init()
2633 oxu->async->hw_info1 = cpu_to_le32(QH_HEAD); in oxu_hcd_init()
2634 oxu->async->hw_token = cpu_to_le32(QTD_STS_HALT); in oxu_hcd_init()
2635 oxu->async->hw_qtd_next = EHCI_LIST_END; in oxu_hcd_init()
2636 oxu->async->qh_state = QH_STATE_LINKED; in oxu_hcd_init()
2637 oxu->async->hw_alt_next = QTD_NEXT(oxu->async->dummy->qtd_dma); in oxu_hcd_init()
2656 oxu_dbg(oxu, "park %d\n", park); in oxu_hcd_init()
2663 oxu->command = temp; in oxu_hcd_init()
2672 struct oxu_hcd *oxu = hcd_to_oxu(hcd); in oxu_reset() local
2674 spin_lock_init(&oxu->mem_lock); in oxu_reset()
2675 INIT_LIST_HEAD(&oxu->urb_list); in oxu_reset()
2676 oxu->urb_len = 0; in oxu_reset()
2681 if (oxu->is_otg) { in oxu_reset()
2682 oxu->caps = hcd->regs + OXU_OTG_CAP_OFFSET; in oxu_reset()
2683 oxu->regs = hcd->regs + OXU_OTG_CAP_OFFSET + \ in oxu_reset()
2684 HC_LENGTH(readl(&oxu->caps->hc_capbase)); in oxu_reset()
2686 oxu->mem = hcd->regs + OXU_SPH_MEM; in oxu_reset()
2688 oxu->caps = hcd->regs + OXU_SPH_CAP_OFFSET; in oxu_reset()
2689 oxu->regs = hcd->regs + OXU_SPH_CAP_OFFSET + \ in oxu_reset()
2690 HC_LENGTH(readl(&oxu->caps->hc_capbase)); in oxu_reset()
2692 oxu->mem = hcd->regs + OXU_OTG_MEM; in oxu_reset()
2695 oxu->hcs_params = readl(&oxu->caps->hcs_params); in oxu_reset()
2696 oxu->sbrn = 0x20; in oxu_reset()
2703 struct oxu_hcd *oxu = hcd_to_oxu(hcd); in oxu_run() local
2710 retval = ehci_reset(oxu); in oxu_run()
2712 ehci_mem_cleanup(oxu); in oxu_run()
2715 writel(oxu->periodic_dma, &oxu->regs->frame_list); in oxu_run()
2716 writel((u32) oxu->async->qh_dma, &oxu->regs->async_next); in oxu_run()
2729 hcc_params = readl(&oxu->caps->hcc_params); in oxu_run()
2731 writel(0, &oxu->regs->segment); in oxu_run()
2733 oxu->command &= ~(CMD_LRESET | CMD_IAAD | CMD_PSE | in oxu_run()
2735 oxu->command |= CMD_RUN; in oxu_run()
2736 writel(oxu->command, &oxu->regs->command); in oxu_run()
2737 dbg_cmd(oxu, "init", oxu->command); in oxu_run()
2746 writel(FLAG_CF, &oxu->regs->configured_flag); in oxu_run()
2747 readl(&oxu->regs->command); /* unblock posted writes */ in oxu_run()
2749 temp = HC_VERSION(readl(&oxu->caps->hc_capbase)); in oxu_run()
2750 oxu_info(oxu, "USB %x.%x started, quasi-EHCI %x.%02x, driver %s%s\n", in oxu_run()
2751 ((oxu->sbrn & 0xf0)>>4), (oxu->sbrn & 0x0f), in oxu_run()
2755 writel(INTR_MASK, &oxu->regs->intr_enable); /* Turn On Interrupts */ in oxu_run()
2762 struct oxu_hcd *oxu = hcd_to_oxu(hcd); in oxu_stop() local
2765 ehci_port_power(oxu, 0); in oxu_stop()
2768 del_timer_sync(&oxu->watchdog); in oxu_stop()
2770 spin_lock_irq(&oxu->lock); in oxu_stop()
2772 ehci_quiesce(oxu); in oxu_stop()
2774 ehci_reset(oxu); in oxu_stop()
2775 writel(0, &oxu->regs->intr_enable); in oxu_stop()
2776 spin_unlock_irq(&oxu->lock); in oxu_stop()
2779 writel(0, &oxu->regs->configured_flag); in oxu_stop()
2782 spin_lock_irq(&oxu->lock); in oxu_stop()
2783 if (oxu->async) in oxu_stop()
2784 ehci_work(oxu); in oxu_stop()
2785 spin_unlock_irq(&oxu->lock); in oxu_stop()
2786 ehci_mem_cleanup(oxu); in oxu_stop()
2788 dbg_status(oxu, "oxu_stop completed", readl(&oxu->regs->status)); in oxu_stop()
2797 struct oxu_hcd *oxu = hcd_to_oxu(hcd); in oxu_shutdown() local
2799 (void) ehci_halt(oxu); in oxu_shutdown()
2800 ehci_turn_off_all_ports(oxu); in oxu_shutdown()
2803 writel(0, &oxu->regs->configured_flag); in oxu_shutdown()
2806 readl(&oxu->regs->configured_flag); in oxu_shutdown()
2823 struct oxu_hcd *oxu = hcd_to_oxu(hcd); in __oxu_urb_enqueue() local
2832 if (!qh_urb_transaction(oxu, urb, &qtd_list, mem_flags)) in __oxu_urb_enqueue()
2834 return submit_async(oxu, urb, &qtd_list, mem_flags); in __oxu_urb_enqueue()
2837 if (!qh_urb_transaction(oxu, urb, &qtd_list, mem_flags)) in __oxu_urb_enqueue()
2839 return intr_submit(oxu, urb, &qtd_list, mem_flags); in __oxu_urb_enqueue()
2843 return itd_submit(oxu, urb, mem_flags); in __oxu_urb_enqueue()
2845 return sitd_submit(oxu, urb, mem_flags); in __oxu_urb_enqueue()
2855 struct oxu_hcd *oxu = hcd_to_oxu(hcd); in oxu_urb_enqueue() local
2885 murb = (struct urb *) oxu_murb_alloc(oxu); in oxu_urb_enqueue()
2916 murb = (struct urb *) oxu_murb_alloc(oxu); in oxu_urb_enqueue()
2947 struct oxu_hcd *oxu = hcd_to_oxu(hcd); in oxu_urb_dequeue() local
2951 spin_lock_irqsave(&oxu->lock, flags); in oxu_urb_dequeue()
2959 unlink_async(oxu, qh); in oxu_urb_dequeue()
2968 intr_deschedule(oxu, qh); in oxu_urb_dequeue()
2971 qh_completions(oxu, qh); in oxu_urb_dequeue()
2974 oxu_dbg(oxu, "bogus qh %p state %d\n", in oxu_urb_dequeue()
2984 status = qh_schedule(oxu, qh); in oxu_urb_dequeue()
2985 spin_unlock_irqrestore(&oxu->lock, flags); in oxu_urb_dequeue()
3000 spin_unlock_irqrestore(&oxu->lock, flags); in oxu_urb_dequeue()
3008 struct oxu_hcd *oxu = hcd_to_oxu(hcd); in oxu_endpoint_disable() local
3016 spin_lock_irqsave(&oxu->lock, flags); in oxu_endpoint_disable()
3025 oxu_vdbg(oxu, "iso delay\n"); in oxu_endpoint_disable()
3033 for (tmp = oxu->async->qh_next.qh; in oxu_endpoint_disable()
3040 unlink_async(oxu, qh); in oxu_endpoint_disable()
3044 spin_unlock_irqrestore(&oxu->lock, flags); in oxu_endpoint_disable()
3058 oxu_err(oxu, "qh %p (#%02x) state %d%s\n", in oxu_endpoint_disable()
3065 spin_unlock_irqrestore(&oxu->lock, flags); in oxu_endpoint_disable()
3070 struct oxu_hcd *oxu = hcd_to_oxu(hcd); in oxu_get_frame() local
3072 return (readl(&oxu->regs->frame_index) >> 3) % in oxu_get_frame()
3073 oxu->periodic_size; in oxu_get_frame()
3079 struct oxu_hcd *oxu = hcd_to_oxu(hcd); in oxu_hub_status_data() local
3090 ports = HCS_N_PORTS(oxu->hcs_params); in oxu_hub_status_data()
3110 spin_lock_irqsave(&oxu->lock, flags); in oxu_hub_status_data()
3112 temp = readl(&oxu->regs->port_status[i]); in oxu_hub_status_data()
3122 oxu->reset_done[i] = 0; in oxu_hub_status_data()
3124 time_after_eq(jiffies, oxu->reset_done[i]))) { in oxu_hub_status_data()
3133 spin_unlock_irqrestore(&oxu->lock, flags); in oxu_hub_status_data()
3138 static inline unsigned int oxu_port_speed(struct oxu_hcd *oxu, in oxu_port_speed() argument
3156 struct oxu_hcd *oxu = hcd_to_oxu(hcd); in oxu_hub_control() local
3157 int ports = HCS_N_PORTS(oxu->hcs_params); in oxu_hub_control()
3158 u32 __iomem *status_reg = &oxu->regs->port_status[wIndex - 1]; in oxu_hub_control()
3171 spin_lock_irqsave(&oxu->lock, flags); in oxu_hub_control()
3212 oxu->reset_done[wIndex] = jiffies in oxu_hub_control()
3220 if (HCS_PPC(oxu->hcs_params)) in oxu_hub_control()
3236 readl(&oxu->regs->command); /* unblock posted write */ in oxu_hub_control()
3239 ehci_hub_descriptor(oxu, (struct usb_hub_descriptor *) in oxu_hub_control()
3265 if (!oxu->reset_done[wIndex]) { in oxu_hub_control()
3267 oxu->reset_done[wIndex] = jiffies in oxu_hub_control()
3270 mod_timer(&oxu_to_hcd(oxu)->rh_timer, in oxu_hub_control()
3271 oxu->reset_done[wIndex]); in oxu_hub_control()
3276 oxu->reset_done[wIndex])) { in oxu_hub_control()
3278 oxu->reset_done[wIndex] = 0; in oxu_hub_control()
3284 retval = handshake(oxu, status_reg, in oxu_hub_control()
3287 oxu_err(oxu, in oxu_hub_control()
3299 oxu->reset_done[wIndex])) { in oxu_hub_control()
3301 oxu->reset_done[wIndex] = 0; in oxu_hub_control()
3309 retval = handshake(oxu, status_reg, in oxu_hub_control()
3312 oxu_err(oxu, "port %d reset error %d\n", in oxu_hub_control()
3318 temp = check_reset_complete(oxu, wIndex, status_reg, in oxu_hub_control()
3324 test_bit(wIndex, &oxu->companion_ports)) { in oxu_hub_control()
3328 oxu_dbg(oxu, "port %d --> companion\n", wIndex + 1); in oxu_hub_control()
3341 status |= oxu_port_speed(oxu, temp); in oxu_hub_control()
3357 dbg_port(oxu, "GetStatus", wIndex + 1, temp); in oxu_hub_control()
3391 if (HCS_PPC(oxu->hcs_params)) in oxu_hub_control()
3401 oxu_vdbg(oxu, "port %d reset\n", wIndex + 1); in oxu_hub_control()
3409 oxu->reset_done[wIndex] = jiffies in oxu_hub_control()
3423 ehci_quiesce(oxu); in oxu_hub_control()
3424 ehci_halt(oxu); in oxu_hub_control()
3432 readl(&oxu->regs->command); /* unblock posted writes */ in oxu_hub_control()
3440 spin_unlock_irqrestore(&oxu->lock, flags); in oxu_hub_control()
3448 struct oxu_hcd *oxu = hcd_to_oxu(hcd); in oxu_bus_suspend() local
3452 oxu_dbg(oxu, "suspend root hub\n"); in oxu_bus_suspend()
3454 if (time_before(jiffies, oxu->next_statechange)) in oxu_bus_suspend()
3457 port = HCS_N_PORTS(oxu->hcs_params); in oxu_bus_suspend()
3458 spin_lock_irq(&oxu->lock); in oxu_bus_suspend()
3462 ehci_quiesce(oxu); in oxu_bus_suspend()
3465 oxu->command = readl(&oxu->regs->command); in oxu_bus_suspend()
3466 if (oxu->reclaim) in oxu_bus_suspend()
3467 oxu->reclaim_ready = 1; in oxu_bus_suspend()
3468 ehci_work(oxu); in oxu_bus_suspend()
3475 oxu->bus_suspended = 0; in oxu_bus_suspend()
3477 u32 __iomem *reg = &oxu->regs->port_status[port]; in oxu_bus_suspend()
3485 set_bit(port, &oxu->bus_suspended); in oxu_bus_suspend()
3495 oxu_vdbg(oxu, "port %d, %08x -> %08x\n", in oxu_bus_suspend()
3502 del_timer_sync(&oxu->watchdog); in oxu_bus_suspend()
3503 ehci_halt(oxu); in oxu_bus_suspend()
3510 writel(mask, &oxu->regs->intr_enable); in oxu_bus_suspend()
3511 readl(&oxu->regs->intr_enable); in oxu_bus_suspend()
3513 oxu->next_statechange = jiffies + msecs_to_jiffies(10); in oxu_bus_suspend()
3514 spin_unlock_irq(&oxu->lock); in oxu_bus_suspend()
3521 struct oxu_hcd *oxu = hcd_to_oxu(hcd); in oxu_bus_resume() local
3525 if (time_before(jiffies, oxu->next_statechange)) in oxu_bus_resume()
3527 spin_lock_irq(&oxu->lock); in oxu_bus_resume()
3535 temp = readl(&oxu->regs->intr_enable); in oxu_bus_resume()
3536 oxu_dbg(oxu, "resume root hub%s\n", temp ? "" : " after power loss"); in oxu_bus_resume()
3541 writel(0, &oxu->regs->intr_enable); in oxu_bus_resume()
3544 writel(0, &oxu->regs->segment); in oxu_bus_resume()
3545 writel(oxu->periodic_dma, &oxu->regs->frame_list); in oxu_bus_resume()
3546 writel((u32) oxu->async->qh_dma, &oxu->regs->async_next); in oxu_bus_resume()
3549 writel(oxu->command, &oxu->regs->command); in oxu_bus_resume()
3556 i = HCS_N_PORTS(oxu->hcs_params); in oxu_bus_resume()
3558 temp = readl(&oxu->regs->port_status[i]); in oxu_bus_resume()
3561 if (test_bit(i, &oxu->bus_suspended) && (temp & PORT_SUSPEND)) { in oxu_bus_resume()
3562 oxu->reset_done[i] = jiffies + msecs_to_jiffies(20); in oxu_bus_resume()
3565 writel(temp, &oxu->regs->port_status[i]); in oxu_bus_resume()
3567 i = HCS_N_PORTS(oxu->hcs_params); in oxu_bus_resume()
3570 temp = readl(&oxu->regs->port_status[i]); in oxu_bus_resume()
3571 if (test_bit(i, &oxu->bus_suspended) && (temp & PORT_SUSPEND)) { in oxu_bus_resume()
3573 writel(temp, &oxu->regs->port_status[i]); in oxu_bus_resume()
3574 oxu_vdbg(oxu, "resumed port %d\n", i + 1); in oxu_bus_resume()
3577 (void) readl(&oxu->regs->command); in oxu_bus_resume()
3581 if (oxu->async->qh_next.qh) in oxu_bus_resume()
3583 if (oxu->periodic_sched) in oxu_bus_resume()
3586 oxu->command |= temp; in oxu_bus_resume()
3587 writel(oxu->command, &oxu->regs->command); in oxu_bus_resume()
3590 oxu->next_statechange = jiffies + msecs_to_jiffies(5); in oxu_bus_resume()
3594 writel(INTR_MASK, &oxu->regs->intr_enable); in oxu_bus_resume()
3596 spin_unlock_irq(&oxu->lock); in oxu_bus_resume()
3721 struct oxu_hcd *oxu; in oxu_create() local
3740 oxu = hcd_to_oxu(hcd); in oxu_create()
3741 oxu->is_otg = otg; in oxu_create()