Lines Matching refs:oxu
334 struct oxu_hcd *oxu; member
482 #define oxu_dbg(oxu, fmt, args...) \ argument
483 dev_dbg(oxu_to_hcd(oxu)->self.controller , fmt , ## args)
484 #define oxu_err(oxu, fmt, args...) \ argument
485 dev_err(oxu_to_hcd(oxu)->self.controller , fmt , ## args)
486 #define oxu_info(oxu, fmt, args...) \ argument
487 dev_info(oxu_to_hcd(oxu)->self.controller , fmt , ## args)
493 static inline struct usb_hcd *oxu_to_hcd(struct oxu_hcd *oxu) in oxu_to_hcd() argument
495 return container_of((void *) oxu, struct usb_hcd, hcd_priv); in oxu_to_hcd()
513 #define oxu_vdbg(oxu, fmt, args...) /* Nop */ argument
632 #define dbg_status(oxu, label, status) { \ argument
635 oxu_dbg(oxu, "%s\n", _buf); \
638 #define dbg_cmd(oxu, label, command) { \ argument
641 oxu_dbg(oxu, "%s\n", _buf); \
644 #define dbg_port(oxu, label, port, status) { \ argument
647 oxu_dbg(oxu, "%s\n", _buf); \
670 static void ehci_work(struct oxu_hcd *oxu);
690 static inline void timer_action_done(struct oxu_hcd *oxu, in timer_action_done() argument
693 clear_bit(action, &oxu->actions); in timer_action_done()
696 static inline void timer_action(struct oxu_hcd *oxu, in timer_action() argument
699 if (!test_and_set_bit(action, &oxu->actions)) { in timer_action()
724 && t > oxu->watchdog.expires in timer_action()
725 && timer_pending(&oxu->watchdog)) in timer_action()
727 mod_timer(&oxu->watchdog, t); in timer_action()
748 static int handshake(struct oxu_hcd *oxu, void __iomem *ptr, in handshake() argument
765 static int ehci_halt(struct oxu_hcd *oxu) in ehci_halt() argument
767 u32 temp = readl(&oxu->regs->status); in ehci_halt()
770 writel(0, &oxu->regs->intr_enable); in ehci_halt()
775 temp = readl(&oxu->regs->command); in ehci_halt()
777 writel(temp, &oxu->regs->command); in ehci_halt()
778 return handshake(oxu, &oxu->regs->status, in ehci_halt()
783 static void tdi_reset(struct oxu_hcd *oxu) in tdi_reset() argument
788 reg_ptr = (u32 __iomem *)(((u8 __iomem *)oxu->regs) + 0x68); in tdi_reset()
795 static int ehci_reset(struct oxu_hcd *oxu) in ehci_reset() argument
798 u32 command = readl(&oxu->regs->command); in ehci_reset()
801 dbg_cmd(oxu, "reset", command); in ehci_reset()
802 writel(command, &oxu->regs->command); in ehci_reset()
803 oxu_to_hcd(oxu)->state = HC_STATE_HALT; in ehci_reset()
804 oxu->next_statechange = jiffies; in ehci_reset()
805 retval = handshake(oxu, &oxu->regs->command, in ehci_reset()
811 tdi_reset(oxu); in ehci_reset()
817 static void ehci_quiesce(struct oxu_hcd *oxu) in ehci_quiesce() argument
822 BUG_ON(!HC_IS_RUNNING(oxu_to_hcd(oxu)->state)); in ehci_quiesce()
826 temp = readl(&oxu->regs->command) << 10; in ehci_quiesce()
828 if (handshake(oxu, &oxu->regs->status, STS_ASS | STS_PSS, in ehci_quiesce()
830 oxu_to_hcd(oxu)->state = HC_STATE_HALT; in ehci_quiesce()
835 temp = readl(&oxu->regs->command); in ehci_quiesce()
837 writel(temp, &oxu->regs->command); in ehci_quiesce()
840 if (handshake(oxu, &oxu->regs->status, STS_ASS | STS_PSS, in ehci_quiesce()
842 oxu_to_hcd(oxu)->state = HC_STATE_HALT; in ehci_quiesce()
847 static int check_reset_complete(struct oxu_hcd *oxu, int index, in check_reset_complete() argument
851 oxu->reset_done[index] = 0; in check_reset_complete()
857 oxu_dbg(oxu, "Failed to enable port %d on root hub TT\n", in check_reset_complete()
861 oxu_dbg(oxu, "port %d high speed\n", index + 1); in check_reset_complete()
866 static void ehci_hub_descriptor(struct oxu_hcd *oxu, in ehci_hub_descriptor() argument
869 int ports = HCS_N_PORTS(oxu->hcs_params); in ehci_hub_descriptor()
885 if (HCS_PPC(oxu->hcs_params)) in ehci_hub_descriptor()
907 static int oxu_buf_alloc(struct oxu_hcd *oxu, struct ehci_qtd *qtd, int len) in oxu_buf_alloc() argument
915 oxu_err(oxu, "buffer too big (%d)\n", len); in oxu_buf_alloc()
919 spin_lock(&oxu->mem_lock); in oxu_buf_alloc()
930 i += max(a_blocks, (int)oxu->db_used[i])) { in oxu_buf_alloc()
934 if (oxu->db_used[i + j]) in oxu_buf_alloc()
941 qtd->buffer = (void *) &oxu->mem->db_pool[i]; in oxu_buf_alloc()
945 oxu->db_used[i] = a_blocks; in oxu_buf_alloc()
947 spin_unlock(&oxu->mem_lock); in oxu_buf_alloc()
954 spin_unlock(&oxu->mem_lock); in oxu_buf_alloc()
959 static void oxu_buf_free(struct oxu_hcd *oxu, struct ehci_qtd *qtd) in oxu_buf_free() argument
963 spin_lock(&oxu->mem_lock); in oxu_buf_free()
965 index = (qtd->buffer - (void *) &oxu->mem->db_pool[0]) in oxu_buf_free()
967 oxu->db_used[index] = 0; in oxu_buf_free()
972 spin_unlock(&oxu->mem_lock); in oxu_buf_free()
985 static inline void oxu_qtd_free(struct oxu_hcd *oxu, struct ehci_qtd *qtd) in oxu_qtd_free() argument
990 oxu_buf_free(oxu, qtd); in oxu_qtd_free()
992 spin_lock(&oxu->mem_lock); in oxu_qtd_free()
994 index = qtd - &oxu->mem->qtd_pool[0]; in oxu_qtd_free()
995 oxu->qtd_used[index] = 0; in oxu_qtd_free()
997 spin_unlock(&oxu->mem_lock); in oxu_qtd_free()
1000 static struct ehci_qtd *ehci_qtd_alloc(struct oxu_hcd *oxu) in ehci_qtd_alloc() argument
1005 spin_lock(&oxu->mem_lock); in ehci_qtd_alloc()
1008 if (!oxu->qtd_used[i]) in ehci_qtd_alloc()
1012 qtd = (struct ehci_qtd *) &oxu->mem->qtd_pool[i]; in ehci_qtd_alloc()
1022 oxu->qtd_used[i] = 1; in ehci_qtd_alloc()
1025 spin_unlock(&oxu->mem_lock); in ehci_qtd_alloc()
1030 static void oxu_qh_free(struct oxu_hcd *oxu, struct ehci_qh *qh) in oxu_qh_free() argument
1034 spin_lock(&oxu->mem_lock); in oxu_qh_free()
1036 index = qh - &oxu->mem->qh_pool[0]; in oxu_qh_free()
1037 oxu->qh_used[index] = 0; in oxu_qh_free()
1039 spin_unlock(&oxu->mem_lock); in oxu_qh_free()
1045 struct oxu_hcd *oxu = qh->oxu; in qh_destroy() local
1049 oxu_dbg(oxu, "unused qh not empty!\n"); in qh_destroy()
1053 oxu_qtd_free(oxu, qh->dummy); in qh_destroy()
1054 oxu_qh_free(oxu, qh); in qh_destroy()
1057 static struct ehci_qh *oxu_qh_alloc(struct oxu_hcd *oxu) in oxu_qh_alloc() argument
1062 spin_lock(&oxu->mem_lock); in oxu_qh_alloc()
1065 if (!oxu->qh_used[i]) in oxu_qh_alloc()
1069 qh = (struct ehci_qh *) &oxu->mem->qh_pool[i]; in oxu_qh_alloc()
1073 qh->oxu = oxu; in oxu_qh_alloc()
1078 qh->dummy = ehci_qtd_alloc(oxu); in oxu_qh_alloc()
1080 oxu_dbg(oxu, "no dummy td\n"); in oxu_qh_alloc()
1081 oxu->qh_used[i] = 0; in oxu_qh_alloc()
1086 oxu->qh_used[i] = 1; in oxu_qh_alloc()
1089 spin_unlock(&oxu->mem_lock); in oxu_qh_alloc()
1106 static void oxu_murb_free(struct oxu_hcd *oxu, struct oxu_murb *murb) in oxu_murb_free() argument
1110 spin_lock(&oxu->mem_lock); in oxu_murb_free()
1112 index = murb - &oxu->murb_pool[0]; in oxu_murb_free()
1113 oxu->murb_used[index] = 0; in oxu_murb_free()
1115 spin_unlock(&oxu->mem_lock); in oxu_murb_free()
1118 static struct oxu_murb *oxu_murb_alloc(struct oxu_hcd *oxu) in oxu_murb_alloc() argument
1124 spin_lock(&oxu->mem_lock); in oxu_murb_alloc()
1127 if (!oxu->murb_used[i]) in oxu_murb_alloc()
1131 murb = &(oxu->murb_pool)[i]; in oxu_murb_alloc()
1133 oxu->murb_used[i] = 1; in oxu_murb_alloc()
1136 spin_unlock(&oxu->mem_lock); in oxu_murb_alloc()
1145 static void ehci_mem_cleanup(struct oxu_hcd *oxu) in ehci_mem_cleanup() argument
1147 kfree(oxu->murb_pool); in ehci_mem_cleanup()
1148 oxu->murb_pool = NULL; in ehci_mem_cleanup()
1150 if (oxu->async) in ehci_mem_cleanup()
1151 qh_put(oxu->async); in ehci_mem_cleanup()
1152 oxu->async = NULL; in ehci_mem_cleanup()
1154 del_timer(&oxu->urb_timer); in ehci_mem_cleanup()
1156 oxu->periodic = NULL; in ehci_mem_cleanup()
1159 kfree(oxu->pshadow); in ehci_mem_cleanup()
1160 oxu->pshadow = NULL; in ehci_mem_cleanup()
1165 static int ehci_mem_init(struct oxu_hcd *oxu, gfp_t flags) in ehci_mem_init() argument
1169 for (i = 0; i < oxu->periodic_size; i++) in ehci_mem_init()
1170 oxu->mem->frame_list[i] = EHCI_LIST_END; in ehci_mem_init()
1172 oxu->qh_used[i] = 0; in ehci_mem_init()
1174 oxu->qtd_used[i] = 0; in ehci_mem_init()
1176 oxu->murb_pool = kcalloc(MURB_NUM, sizeof(struct oxu_murb), flags); in ehci_mem_init()
1177 if (!oxu->murb_pool) in ehci_mem_init()
1181 oxu->murb_used[i] = 0; in ehci_mem_init()
1183 oxu->async = oxu_qh_alloc(oxu); in ehci_mem_init()
1184 if (!oxu->async) in ehci_mem_init()
1187 oxu->periodic = (__le32 *) &oxu->mem->frame_list; in ehci_mem_init()
1188 oxu->periodic_dma = virt_to_phys(oxu->periodic); in ehci_mem_init()
1190 for (i = 0; i < oxu->periodic_size; i++) in ehci_mem_init()
1191 oxu->periodic[i] = EHCI_LIST_END; in ehci_mem_init()
1194 oxu->pshadow = kcalloc(oxu->periodic_size, sizeof(void *), flags); in ehci_mem_init()
1195 if (oxu->pshadow != NULL) in ehci_mem_init()
1199 oxu_dbg(oxu, "couldn't init memory\n"); in ehci_mem_init()
1200 ehci_mem_cleanup(oxu); in ehci_mem_init()
1244 static inline void qh_update(struct oxu_hcd *oxu, in qh_update() argument
1278 static void qh_refresh(struct oxu_hcd *oxu, struct ehci_qh *qh) in qh_refresh() argument
1293 qh_update(oxu, qh, qtd); in qh_refresh()
1296 static void qtd_copy_status(struct oxu_hcd *oxu, struct urb *urb, in qtd_copy_status() argument
1328 oxu_dbg(oxu, "devpath %s ep%d%s 3strikes\n", in qtd_copy_status()
1340 oxu_vdbg(oxu, "dev%d ep%d%s qtd token %08x --> status %d\n", in qtd_copy_status()
1348 static void ehci_urb_done(struct oxu_hcd *oxu, struct urb *urb) in ehci_urb_done() argument
1349 __releases(oxu->lock) in ehci_urb_done()
1350 __acquires(oxu->lock) in ehci_urb_done()
1359 oxu_to_hcd(oxu)->self.bandwidth_int_reqs--; in ehci_urb_done()
1380 oxu_dbg(oxu, "%s %s urb %p ep%d%s status %d len %d/%d\n", in ehci_urb_done()
1389 spin_unlock(&oxu->lock); in ehci_urb_done()
1390 usb_hcd_giveback_urb(oxu_to_hcd(oxu), urb, urb->status); in ehci_urb_done()
1391 spin_lock(&oxu->lock); in ehci_urb_done()
1394 static void start_unlink_async(struct oxu_hcd *oxu, struct ehci_qh *qh);
1395 static void unlink_async(struct oxu_hcd *oxu, struct ehci_qh *qh);
1397 static void intr_deschedule(struct oxu_hcd *oxu, struct ehci_qh *qh);
1398 static int qh_schedule(struct oxu_hcd *oxu, struct ehci_qh *qh);
1406 static unsigned qh_completions(struct oxu_hcd *oxu, struct ehci_qh *qh) in qh_completions() argument
1447 ehci_urb_done(oxu, last->urb); in qh_completions()
1450 oxu_murb_free(oxu, murb); in qh_completions()
1452 ehci_urb_done(oxu, last->urb); in qh_completions()
1456 oxu_qtd_free(oxu, last); in qh_completions()
1485 HC_IS_RUNNING(oxu_to_hcd(oxu)->state))) { in qh_completions()
1491 if (unlikely(!HC_IS_RUNNING(oxu_to_hcd(oxu)->state))) in qh_completions()
1526 qtd_copy_status(oxu, urb->complete ? in qh_completions()
1550 ehci_urb_done(oxu, last->urb); in qh_completions()
1553 oxu_murb_free(oxu, murb); in qh_completions()
1555 ehci_urb_done(oxu, last->urb); in qh_completions()
1558 oxu_qtd_free(oxu, last); in qh_completions()
1571 qh_refresh(oxu, qh); in qh_completions()
1579 intr_deschedule(oxu, qh); in qh_completions()
1580 (void) qh_schedule(oxu, qh); in qh_completions()
1582 unlink_async(oxu, qh); in qh_completions()
1599 static void qtd_list_free(struct oxu_hcd *oxu, in qtd_list_free() argument
1606 oxu_qtd_free(oxu, qtd); in qtd_list_free()
1612 static struct list_head *qh_urb_transaction(struct oxu_hcd *oxu, in qh_urb_transaction() argument
1628 qtd = ehci_qtd_alloc(oxu); in qh_urb_transaction()
1645 ret = oxu_buf_alloc(oxu, qtd, sizeof(struct usb_ctrlrequest)); in qh_urb_transaction()
1657 qtd = ehci_qtd_alloc(oxu); in qh_urb_transaction()
1673 ret = oxu_buf_alloc(oxu, qtd, len); in qh_urb_transaction()
1703 qtd->hw_alt_next = oxu->async->hw_alt_next; in qh_urb_transaction()
1713 qtd = ehci_qtd_alloc(oxu); in qh_urb_transaction()
1717 ret = oxu_buf_alloc(oxu, qtd, len); in qh_urb_transaction()
1751 qtd = ehci_qtd_alloc(oxu); in qh_urb_transaction()
1768 qtd_list_free(oxu, urb, head); in qh_urb_transaction()
1779 static struct ehci_qh *qh_make(struct oxu_hcd *oxu, in qh_make() argument
1782 struct ehci_qh *qh = oxu_qh_alloc(oxu); in qh_make()
1824 oxu_dbg(oxu, "intr period %d uframes, NYET!\n", in qh_make()
1896 oxu_dbg(oxu, "bogus dev %p speed %d\n", urb->dev, urb->dev->speed); in qh_make()
1909 qh_refresh(oxu, qh); in qh_make()
1915 static void qh_link_async(struct oxu_hcd *oxu, struct ehci_qh *qh) in qh_link_async() argument
1921 head = oxu->async; in qh_link_async()
1922 timer_action_done(oxu, TIMER_ASYNC_OFF); in qh_link_async()
1924 u32 cmd = readl(&oxu->regs->command); in qh_link_async()
1928 (void)handshake(oxu, &oxu->regs->status, in qh_link_async()
1931 writel(cmd, &oxu->regs->command); in qh_link_async()
1932 oxu_to_hcd(oxu)->state = HC_STATE_RUNNING; in qh_link_async()
1939 qh_refresh(oxu, qh); in qh_link_async()
1961 static struct ehci_qh *qh_append_tds(struct oxu_hcd *oxu, in qh_append_tds() argument
1970 qh = qh_make(oxu, urb, GFP_ATOMIC); in qh_append_tds()
2036 static int submit_async(struct oxu_hcd *oxu, struct urb *urb, in submit_async() argument
2048 oxu_dbg(oxu, "%s %s urb %p ep%d%s len %d, qtd %p [qh %p]\n", in submit_async()
2055 spin_lock_irqsave(&oxu->lock, flags); in submit_async()
2056 if (unlikely(!HCD_HW_ACCESSIBLE(oxu_to_hcd(oxu)))) { in submit_async()
2061 qh = qh_append_tds(oxu, urb, qtd_list, epnum, &urb->ep->hcpriv); in submit_async()
2071 qh_link_async(oxu, qh_get(qh)); in submit_async()
2073 spin_unlock_irqrestore(&oxu->lock, flags); in submit_async()
2075 qtd_list_free(oxu, urb, qtd_list); in submit_async()
2081 static void end_unlink_async(struct oxu_hcd *oxu) in end_unlink_async() argument
2083 struct ehci_qh *qh = oxu->reclaim; in end_unlink_async()
2086 timer_action_done(oxu, TIMER_IAA_WATCHDOG); in end_unlink_async()
2094 oxu->reclaim = next; in end_unlink_async()
2095 oxu->reclaim_ready = 0; in end_unlink_async()
2098 qh_completions(oxu, qh); in end_unlink_async()
2101 && HC_IS_RUNNING(oxu_to_hcd(oxu)->state)) in end_unlink_async()
2102 qh_link_async(oxu, qh); in end_unlink_async()
2109 if (HC_IS_RUNNING(oxu_to_hcd(oxu)->state) in end_unlink_async()
2110 && oxu->async->qh_next.qh == NULL) in end_unlink_async()
2111 timer_action(oxu, TIMER_ASYNC_OFF); in end_unlink_async()
2115 oxu->reclaim = NULL; in end_unlink_async()
2116 start_unlink_async(oxu, next); in end_unlink_async()
2123 static void start_unlink_async(struct oxu_hcd *oxu, struct ehci_qh *qh) in start_unlink_async() argument
2125 int cmd = readl(&oxu->regs->command); in start_unlink_async()
2129 assert_spin_locked(&oxu->lock); in start_unlink_async()
2130 BUG_ON(oxu->reclaim || (qh->qh_state != QH_STATE_LINKED in start_unlink_async()
2135 if (unlikely(qh == oxu->async)) { in start_unlink_async()
2137 if (oxu_to_hcd(oxu)->state != HC_STATE_HALT in start_unlink_async()
2138 && !oxu->reclaim) { in start_unlink_async()
2140 writel(cmd & ~CMD_ASE, &oxu->regs->command); in start_unlink_async()
2143 timer_action_done(oxu, TIMER_ASYNC_OFF); in start_unlink_async()
2149 oxu->reclaim = qh = qh_get(qh); in start_unlink_async()
2151 prev = oxu->async; in start_unlink_async()
2159 if (unlikely(oxu_to_hcd(oxu)->state == HC_STATE_HALT)) { in start_unlink_async()
2163 end_unlink_async(oxu); in start_unlink_async()
2167 oxu->reclaim_ready = 0; in start_unlink_async()
2169 writel(cmd, &oxu->regs->command); in start_unlink_async()
2170 (void) readl(&oxu->regs->command); in start_unlink_async()
2171 timer_action(oxu, TIMER_IAA_WATCHDOG); in start_unlink_async()
2174 static void scan_async(struct oxu_hcd *oxu) in scan_async() argument
2179 if (!++(oxu->stamp)) in scan_async()
2180 oxu->stamp++; in scan_async()
2181 timer_action_done(oxu, TIMER_ASYNC_SHRINK); in scan_async()
2183 qh = oxu->async->qh_next.qh; in scan_async()
2188 && qh->stamp != oxu->stamp) { in scan_async()
2197 qh->stamp = oxu->stamp; in scan_async()
2198 temp = qh_completions(oxu, qh); in scan_async()
2211 if (qh->stamp == oxu->stamp) in scan_async()
2213 else if (!oxu->reclaim in scan_async()
2215 start_unlink_async(oxu, qh); in scan_async()
2222 timer_action(oxu, TIMER_ASYNC_SHRINK); in scan_async()
2241 static void periodic_unlink(struct oxu_hcd *oxu, unsigned frame, void *ptr) in periodic_unlink() argument
2243 union ehci_shadow *prev_p = &oxu->pshadow[frame]; in periodic_unlink()
2244 __le32 *hw_p = &oxu->periodic[frame]; in periodic_unlink()
2265 static unsigned short periodic_usecs(struct oxu_hcd *oxu, in periodic_usecs() argument
2268 __le32 *hw_p = &oxu->periodic[frame]; in periodic_usecs()
2269 union ehci_shadow *q = &oxu->pshadow[frame]; in periodic_usecs()
2289 oxu_err(oxu, "uframe %d sched overrun: %d usecs\n", in periodic_usecs()
2295 static int enable_periodic(struct oxu_hcd *oxu) in enable_periodic() argument
2303 status = handshake(oxu, &oxu->regs->status, STS_PSS, 0, 9 * 125); in enable_periodic()
2305 oxu_to_hcd(oxu)->state = HC_STATE_HALT; in enable_periodic()
2306 usb_hc_died(oxu_to_hcd(oxu)); in enable_periodic()
2310 cmd = readl(&oxu->regs->command) | CMD_PSE; in enable_periodic()
2311 writel(cmd, &oxu->regs->command); in enable_periodic()
2313 oxu_to_hcd(oxu)->state = HC_STATE_RUNNING; in enable_periodic()
2316 oxu->next_uframe = readl(&oxu->regs->frame_index) in enable_periodic()
2317 % (oxu->periodic_size << 3); in enable_periodic()
2321 static int disable_periodic(struct oxu_hcd *oxu) in disable_periodic() argument
2329 status = handshake(oxu, &oxu->regs->status, STS_PSS, STS_PSS, 9 * 125); in disable_periodic()
2331 oxu_to_hcd(oxu)->state = HC_STATE_HALT; in disable_periodic()
2332 usb_hc_died(oxu_to_hcd(oxu)); in disable_periodic()
2336 cmd = readl(&oxu->regs->command) & ~CMD_PSE; in disable_periodic()
2337 writel(cmd, &oxu->regs->command); in disable_periodic()
2340 oxu->next_uframe = -1; in disable_periodic()
2350 static int qh_link_periodic(struct oxu_hcd *oxu, struct ehci_qh *qh) in qh_link_periodic() argument
2364 for (i = qh->start; i < oxu->periodic_size; i += period) { in qh_link_periodic()
2365 union ehci_shadow *prev = &oxu->pshadow[i]; in qh_link_periodic()
2366 __le32 *hw_p = &oxu->periodic[i]; in qh_link_periodic()
2404 oxu_to_hcd(oxu)->self.bandwidth_allocated += qh->period in qh_link_periodic()
2409 if (!oxu->periodic_sched++) in qh_link_periodic()
2410 return enable_periodic(oxu); in qh_link_periodic()
2415 static void qh_unlink_periodic(struct oxu_hcd *oxu, struct ehci_qh *qh) in qh_unlink_periodic() argument
2433 for (i = qh->start; i < oxu->periodic_size; i += period) in qh_unlink_periodic()
2434 periodic_unlink(oxu, i, qh); in qh_unlink_periodic()
2437 oxu_to_hcd(oxu)->self.bandwidth_allocated -= qh->period in qh_unlink_periodic()
2453 oxu->periodic_sched--; in qh_unlink_periodic()
2454 if (!oxu->periodic_sched) in qh_unlink_periodic()
2455 (void) disable_periodic(oxu); in qh_unlink_periodic()
2458 static void intr_deschedule(struct oxu_hcd *oxu, struct ehci_qh *qh) in intr_deschedule() argument
2462 qh_unlink_periodic(oxu, qh); in intr_deschedule()
2481 static int check_period(struct oxu_hcd *oxu, in check_period() argument
2505 claimed = periodic_usecs(oxu, frame, uframe); in check_period()
2509 } while ((frame += 1) < oxu->periodic_size); in check_period()
2514 claimed = periodic_usecs(oxu, frame, uframe); in check_period()
2517 } while ((frame += period) < oxu->periodic_size); in check_period()
2523 static int check_intr_schedule(struct oxu_hcd *oxu, in check_intr_schedule() argument
2532 if (!check_period(oxu, frame, uframe, qh->period, qh->usecs)) in check_intr_schedule()
2547 static int qh_schedule(struct oxu_hcd *oxu, struct ehci_qh *qh) in qh_schedule() argument
2554 qh_refresh(oxu, qh); in qh_schedule()
2561 status = check_intr_schedule(oxu, frame, --uframe, in qh_schedule()
2578 status = check_intr_schedule(oxu, in qh_schedule()
2589 status = check_intr_schedule(oxu, 0, 0, qh, &c_mask); in qh_schedule()
2602 oxu_dbg(oxu, "reused qh %p schedule\n", qh); in qh_schedule()
2605 status = qh_link_periodic(oxu, qh); in qh_schedule()
2610 static int intr_submit(struct oxu_hcd *oxu, struct urb *urb, in intr_submit() argument
2622 spin_lock_irqsave(&oxu->lock, flags); in intr_submit()
2624 if (unlikely(!HCD_HW_ACCESSIBLE(oxu_to_hcd(oxu)))) { in intr_submit()
2631 qh = qh_append_tds(oxu, urb, &empty, epnum, &urb->ep->hcpriv); in intr_submit()
2637 status = qh_schedule(oxu, qh); in intr_submit()
2643 qh = qh_append_tds(oxu, urb, qtd_list, epnum, &urb->ep->hcpriv); in intr_submit()
2647 oxu_to_hcd(oxu)->self.bandwidth_int_reqs++; in intr_submit()
2650 spin_unlock_irqrestore(&oxu->lock, flags); in intr_submit()
2652 qtd_list_free(oxu, urb, qtd_list); in intr_submit()
2657 static inline int itd_submit(struct oxu_hcd *oxu, struct urb *urb, in itd_submit() argument
2660 oxu_dbg(oxu, "iso support is missing!\n"); in itd_submit()
2664 static inline int sitd_submit(struct oxu_hcd *oxu, struct urb *urb, in sitd_submit() argument
2667 oxu_dbg(oxu, "split iso support is missing!\n"); in sitd_submit()
2671 static void scan_periodic(struct oxu_hcd *oxu) in scan_periodic() argument
2676 mod = oxu->periodic_size << 3; in scan_periodic()
2683 now_uframe = oxu->next_uframe; in scan_periodic()
2684 if (HC_IS_RUNNING(oxu_to_hcd(oxu)->state)) in scan_periodic()
2685 clock = readl(&oxu->regs->frame_index); in scan_periodic()
2703 q_p = &oxu->pshadow[frame]; in scan_periodic()
2704 hw_p = &oxu->periodic[frame]; in scan_periodic()
2718 modified = qh_completions(oxu, temp.qh); in scan_periodic()
2720 intr_deschedule(oxu, temp.qh); in scan_periodic()
2724 oxu_dbg(oxu, "corrupt type %d frame %d shadow %p\n", in scan_periodic()
2748 if (!HC_IS_RUNNING(oxu_to_hcd(oxu)->state)) in scan_periodic()
2750 oxu->next_uframe = now_uframe; in scan_periodic()
2751 now = readl(&oxu->regs->frame_index) % mod; in scan_periodic()
2768 static void ehci_turn_off_all_ports(struct oxu_hcd *oxu) in ehci_turn_off_all_ports() argument
2770 int port = HCS_N_PORTS(oxu->hcs_params); in ehci_turn_off_all_ports()
2773 writel(PORT_RWC_BITS, &oxu->regs->port_status[port]); in ehci_turn_off_all_ports()
2776 static void ehci_port_power(struct oxu_hcd *oxu, int is_on) in ehci_port_power() argument
2780 if (!HCS_PPC(oxu->hcs_params)) in ehci_port_power()
2783 oxu_dbg(oxu, "...power%s ports...\n", is_on ? "up" : "down"); in ehci_port_power()
2784 for (port = HCS_N_PORTS(oxu->hcs_params); port > 0; ) { in ehci_port_power()
2786 oxu_hub_control(oxu_to_hcd(oxu), SetPortFeature, in ehci_port_power()
2789 oxu_hub_control(oxu_to_hcd(oxu), ClearPortFeature, in ehci_port_power()
2799 static void ehci_work(struct oxu_hcd *oxu) in ehci_work() argument
2801 timer_action_done(oxu, TIMER_IO_WATCHDOG); in ehci_work()
2802 if (oxu->reclaim_ready) in ehci_work()
2803 end_unlink_async(oxu); in ehci_work()
2809 if (oxu->scanning) in ehci_work()
2811 oxu->scanning = 1; in ehci_work()
2812 scan_async(oxu); in ehci_work()
2813 if (oxu->next_uframe != -1) in ehci_work()
2814 scan_periodic(oxu); in ehci_work()
2815 oxu->scanning = 0; in ehci_work()
2821 if (HC_IS_RUNNING(oxu_to_hcd(oxu)->state) && in ehci_work()
2822 (oxu->async->qh_next.ptr != NULL || in ehci_work()
2823 oxu->periodic_sched != 0)) in ehci_work()
2824 timer_action(oxu, TIMER_IO_WATCHDOG); in ehci_work()
2827 static void unlink_async(struct oxu_hcd *oxu, struct ehci_qh *qh) in unlink_async() argument
2831 && oxu->reclaim in unlink_async()
2832 && HC_IS_RUNNING(oxu_to_hcd(oxu)->state)) { in unlink_async()
2835 for (last = oxu->reclaim; in unlink_async()
2843 } else if (!HC_IS_RUNNING(oxu_to_hcd(oxu)->state) && oxu->reclaim) in unlink_async()
2844 end_unlink_async(oxu); in unlink_async()
2848 start_unlink_async(oxu, qh); in unlink_async()
2857 struct oxu_hcd *oxu = hcd_to_oxu(hcd); in oxu210_hcd_irq() local
2861 spin_lock(&oxu->lock); in oxu210_hcd_irq()
2863 status = readl(&oxu->regs->status); in oxu210_hcd_irq()
2867 oxu_dbg(oxu, "device removed\n"); in oxu210_hcd_irq()
2874 spin_unlock(&oxu->lock); in oxu210_hcd_irq()
2879 writel(status, &oxu->regs->status); in oxu210_hcd_irq()
2880 readl(&oxu->regs->command); /* unblock posted write */ in oxu210_hcd_irq()
2885 dbg_status(oxu, "irq", status); in oxu210_hcd_irq()
2896 oxu->reclaim_ready = 1; in oxu210_hcd_irq()
2902 unsigned i = HCS_N_PORTS(oxu->hcs_params); in oxu210_hcd_irq()
2906 if (!(readl(&oxu->regs->command) & CMD_RUN)) in oxu210_hcd_irq()
2910 int pstatus = readl(&oxu->regs->port_status[i]); in oxu210_hcd_irq()
2915 || oxu->reset_done[i] != 0) in oxu210_hcd_irq()
2922 oxu->reset_done[i] = jiffies + in oxu210_hcd_irq()
2924 oxu_dbg(oxu, "port %d remote wakeup\n", i + 1); in oxu210_hcd_irq()
2925 mod_timer(&hcd->rh_timer, oxu->reset_done[i]); in oxu210_hcd_irq()
2932 status = readl(&oxu->regs->status); in oxu210_hcd_irq()
2933 dbg_cmd(oxu, "fatal", readl(&oxu->regs->command)); in oxu210_hcd_irq()
2934 dbg_status(oxu, "fatal", status); in oxu210_hcd_irq()
2936 oxu_err(oxu, "fatal error\n"); in oxu210_hcd_irq()
2938 ehci_reset(oxu); in oxu210_hcd_irq()
2939 writel(0, &oxu->regs->configured_flag); in oxu210_hcd_irq()
2949 ehci_work(oxu); in oxu210_hcd_irq()
2950 spin_unlock(&oxu->lock); in oxu210_hcd_irq()
2958 struct oxu_hcd *oxu = hcd_to_oxu(hcd); in oxu_irq() local
2967 if ((oxu->is_otg && (status & OXU_USBOTGI)) || in oxu_irq()
2968 (!oxu->is_otg && (status & OXU_USBSPHI))) in oxu_irq()
2981 struct oxu_hcd *oxu = from_timer(oxu, t, watchdog); in oxu_watchdog() local
2984 spin_lock_irqsave(&oxu->lock, flags); in oxu_watchdog()
2987 if (oxu->reclaim) { in oxu_watchdog()
2988 u32 status = readl(&oxu->regs->status); in oxu_watchdog()
2990 oxu_vdbg(oxu, "lost IAA\n"); in oxu_watchdog()
2991 writel(STS_IAA, &oxu->regs->status); in oxu_watchdog()
2992 oxu->reclaim_ready = 1; in oxu_watchdog()
2997 if (test_bit(TIMER_ASYNC_OFF, &oxu->actions)) in oxu_watchdog()
2998 start_unlink_async(oxu, oxu->async); in oxu_watchdog()
3001 ehci_work(oxu); in oxu_watchdog()
3003 spin_unlock_irqrestore(&oxu->lock, flags); in oxu_watchdog()
3010 struct oxu_hcd *oxu = hcd_to_oxu(hcd); in oxu_hcd_init() local
3015 spin_lock_init(&oxu->lock); in oxu_hcd_init()
3017 timer_setup(&oxu->watchdog, oxu_watchdog, 0); in oxu_hcd_init()
3023 oxu->periodic_size = DEFAULT_I_TDPS; in oxu_hcd_init()
3024 retval = ehci_mem_init(oxu, GFP_KERNEL); in oxu_hcd_init()
3029 hcc_params = readl(&oxu->caps->hcc_params); in oxu_hcd_init()
3031 oxu->i_thresh = 8; in oxu_hcd_init()
3033 oxu->i_thresh = 2 + HCC_ISOC_THRES(hcc_params); in oxu_hcd_init()
3035 oxu->reclaim = NULL; in oxu_hcd_init()
3036 oxu->reclaim_ready = 0; in oxu_hcd_init()
3037 oxu->next_uframe = -1; in oxu_hcd_init()
3046 oxu->async->qh_next.qh = NULL; in oxu_hcd_init()
3047 oxu->async->hw_next = QH_NEXT(oxu->async->qh_dma); in oxu_hcd_init()
3048 oxu->async->hw_info1 = cpu_to_le32(QH_HEAD); in oxu_hcd_init()
3049 oxu->async->hw_token = cpu_to_le32(QTD_STS_HALT); in oxu_hcd_init()
3050 oxu->async->hw_qtd_next = EHCI_LIST_END; in oxu_hcd_init()
3051 oxu->async->qh_state = QH_STATE_LINKED; in oxu_hcd_init()
3052 oxu->async->hw_alt_next = QTD_NEXT(oxu->async->dummy->qtd_dma); in oxu_hcd_init()
3071 oxu_dbg(oxu, "park %d\n", park); in oxu_hcd_init()
3078 oxu->command = temp; in oxu_hcd_init()
3087 struct oxu_hcd *oxu = hcd_to_oxu(hcd); in oxu_reset() local
3089 spin_lock_init(&oxu->mem_lock); in oxu_reset()
3090 INIT_LIST_HEAD(&oxu->urb_list); in oxu_reset()
3091 oxu->urb_len = 0; in oxu_reset()
3093 if (oxu->is_otg) { in oxu_reset()
3094 oxu->caps = hcd->regs + OXU_OTG_CAP_OFFSET; in oxu_reset()
3095 oxu->regs = hcd->regs + OXU_OTG_CAP_OFFSET + \ in oxu_reset()
3096 HC_LENGTH(readl(&oxu->caps->hc_capbase)); in oxu_reset()
3098 oxu->mem = hcd->regs + OXU_SPH_MEM; in oxu_reset()
3100 oxu->caps = hcd->regs + OXU_SPH_CAP_OFFSET; in oxu_reset()
3101 oxu->regs = hcd->regs + OXU_SPH_CAP_OFFSET + \ in oxu_reset()
3102 HC_LENGTH(readl(&oxu->caps->hc_capbase)); in oxu_reset()
3104 oxu->mem = hcd->regs + OXU_OTG_MEM; in oxu_reset()
3107 oxu->hcs_params = readl(&oxu->caps->hcs_params); in oxu_reset()
3108 oxu->sbrn = 0x20; in oxu_reset()
3115 struct oxu_hcd *oxu = hcd_to_oxu(hcd); in oxu_run() local
3122 retval = ehci_reset(oxu); in oxu_run()
3124 ehci_mem_cleanup(oxu); in oxu_run()
3127 writel(oxu->periodic_dma, &oxu->regs->frame_list); in oxu_run()
3128 writel((u32) oxu->async->qh_dma, &oxu->regs->async_next); in oxu_run()
3141 hcc_params = readl(&oxu->caps->hcc_params); in oxu_run()
3143 writel(0, &oxu->regs->segment); in oxu_run()
3145 oxu->command &= ~(CMD_LRESET | CMD_IAAD | CMD_PSE | in oxu_run()
3147 oxu->command |= CMD_RUN; in oxu_run()
3148 writel(oxu->command, &oxu->regs->command); in oxu_run()
3149 dbg_cmd(oxu, "init", oxu->command); in oxu_run()
3158 writel(FLAG_CF, &oxu->regs->configured_flag); in oxu_run()
3159 readl(&oxu->regs->command); /* unblock posted writes */ in oxu_run()
3161 temp = HC_VERSION(readl(&oxu->caps->hc_capbase)); in oxu_run()
3162 oxu_info(oxu, "USB %x.%x started, quasi-EHCI %x.%02x, driver %s%s\n", in oxu_run()
3163 ((oxu->sbrn & 0xf0)>>4), (oxu->sbrn & 0x0f), in oxu_run()
3167 writel(INTR_MASK, &oxu->regs->intr_enable); /* Turn On Interrupts */ in oxu_run()
3174 struct oxu_hcd *oxu = hcd_to_oxu(hcd); in oxu_stop() local
3177 ehci_port_power(oxu, 0); in oxu_stop()
3180 del_timer_sync(&oxu->watchdog); in oxu_stop()
3182 spin_lock_irq(&oxu->lock); in oxu_stop()
3184 ehci_quiesce(oxu); in oxu_stop()
3186 ehci_reset(oxu); in oxu_stop()
3187 writel(0, &oxu->regs->intr_enable); in oxu_stop()
3188 spin_unlock_irq(&oxu->lock); in oxu_stop()
3191 writel(0, &oxu->regs->configured_flag); in oxu_stop()
3194 spin_lock_irq(&oxu->lock); in oxu_stop()
3195 if (oxu->async) in oxu_stop()
3196 ehci_work(oxu); in oxu_stop()
3197 spin_unlock_irq(&oxu->lock); in oxu_stop()
3198 ehci_mem_cleanup(oxu); in oxu_stop()
3200 dbg_status(oxu, "oxu_stop completed", readl(&oxu->regs->status)); in oxu_stop()
3209 struct oxu_hcd *oxu = hcd_to_oxu(hcd); in oxu_shutdown() local
3211 (void) ehci_halt(oxu); in oxu_shutdown()
3212 ehci_turn_off_all_ports(oxu); in oxu_shutdown()
3215 writel(0, &oxu->regs->configured_flag); in oxu_shutdown()
3218 readl(&oxu->regs->configured_flag); in oxu_shutdown()
3235 struct oxu_hcd *oxu = hcd_to_oxu(hcd); in __oxu_urb_enqueue() local
3244 if (!qh_urb_transaction(oxu, urb, &qtd_list, mem_flags)) in __oxu_urb_enqueue()
3246 return submit_async(oxu, urb, &qtd_list, mem_flags); in __oxu_urb_enqueue()
3249 if (!qh_urb_transaction(oxu, urb, &qtd_list, mem_flags)) in __oxu_urb_enqueue()
3251 return intr_submit(oxu, urb, &qtd_list, mem_flags); in __oxu_urb_enqueue()
3255 return itd_submit(oxu, urb, mem_flags); in __oxu_urb_enqueue()
3257 return sitd_submit(oxu, urb, mem_flags); in __oxu_urb_enqueue()
3267 struct oxu_hcd *oxu = hcd_to_oxu(hcd); in oxu_urb_enqueue() local
3295 murb = (struct urb *) oxu_murb_alloc(oxu); in oxu_urb_enqueue()
3326 murb = (struct urb *) oxu_murb_alloc(oxu); in oxu_urb_enqueue()
3357 struct oxu_hcd *oxu = hcd_to_oxu(hcd); in oxu_urb_dequeue() local
3361 spin_lock_irqsave(&oxu->lock, flags); in oxu_urb_dequeue()
3369 unlink_async(oxu, qh); in oxu_urb_dequeue()
3378 intr_deschedule(oxu, qh); in oxu_urb_dequeue()
3381 qh_completions(oxu, qh); in oxu_urb_dequeue()
3384 oxu_dbg(oxu, "bogus qh %p state %d\n", in oxu_urb_dequeue()
3394 status = qh_schedule(oxu, qh); in oxu_urb_dequeue()
3395 spin_unlock_irqrestore(&oxu->lock, flags); in oxu_urb_dequeue()
3410 spin_unlock_irqrestore(&oxu->lock, flags); in oxu_urb_dequeue()
3418 struct oxu_hcd *oxu = hcd_to_oxu(hcd); in oxu_endpoint_disable() local
3426 spin_lock_irqsave(&oxu->lock, flags); in oxu_endpoint_disable()
3435 oxu_vdbg(oxu, "iso delay\n"); in oxu_endpoint_disable()
3443 for (tmp = oxu->async->qh_next.qh; in oxu_endpoint_disable()
3450 unlink_async(oxu, qh); in oxu_endpoint_disable()
3454 spin_unlock_irqrestore(&oxu->lock, flags); in oxu_endpoint_disable()
3468 oxu_err(oxu, "qh %p (#%02x) state %d%s\n", in oxu_endpoint_disable()
3475 spin_unlock_irqrestore(&oxu->lock, flags); in oxu_endpoint_disable()
3480 struct oxu_hcd *oxu = hcd_to_oxu(hcd); in oxu_get_frame() local
3482 return (readl(&oxu->regs->frame_index) >> 3) % in oxu_get_frame()
3483 oxu->periodic_size; in oxu_get_frame()
3489 struct oxu_hcd *oxu = hcd_to_oxu(hcd); in oxu_hub_status_data() local
3500 ports = HCS_N_PORTS(oxu->hcs_params); in oxu_hub_status_data()
3520 spin_lock_irqsave(&oxu->lock, flags); in oxu_hub_status_data()
3522 temp = readl(&oxu->regs->port_status[i]); in oxu_hub_status_data()
3532 oxu->reset_done[i] = 0; in oxu_hub_status_data()
3534 time_after_eq(jiffies, oxu->reset_done[i]))) { in oxu_hub_status_data()
3543 spin_unlock_irqrestore(&oxu->lock, flags); in oxu_hub_status_data()
3548 static inline unsigned int oxu_port_speed(struct oxu_hcd *oxu, in oxu_port_speed() argument
3566 struct oxu_hcd *oxu = hcd_to_oxu(hcd); in oxu_hub_control() local
3567 int ports = HCS_N_PORTS(oxu->hcs_params); in oxu_hub_control()
3568 u32 __iomem *status_reg = &oxu->regs->port_status[wIndex - 1]; in oxu_hub_control()
3581 spin_lock_irqsave(&oxu->lock, flags); in oxu_hub_control()
3622 oxu->reset_done[wIndex] = jiffies in oxu_hub_control()
3630 if (HCS_PPC(oxu->hcs_params)) in oxu_hub_control()
3646 readl(&oxu->regs->command); /* unblock posted write */ in oxu_hub_control()
3649 ehci_hub_descriptor(oxu, (struct usb_hub_descriptor *) in oxu_hub_control()
3675 if (!oxu->reset_done[wIndex]) { in oxu_hub_control()
3677 oxu->reset_done[wIndex] = jiffies in oxu_hub_control()
3680 mod_timer(&oxu_to_hcd(oxu)->rh_timer, in oxu_hub_control()
3681 oxu->reset_done[wIndex]); in oxu_hub_control()
3686 oxu->reset_done[wIndex])) { in oxu_hub_control()
3688 oxu->reset_done[wIndex] = 0; in oxu_hub_control()
3694 retval = handshake(oxu, status_reg, in oxu_hub_control()
3697 oxu_err(oxu, in oxu_hub_control()
3709 oxu->reset_done[wIndex])) { in oxu_hub_control()
3711 oxu->reset_done[wIndex] = 0; in oxu_hub_control()
3719 retval = handshake(oxu, status_reg, in oxu_hub_control()
3722 oxu_err(oxu, "port %d reset error %d\n", in oxu_hub_control()
3728 temp = check_reset_complete(oxu, wIndex, status_reg, in oxu_hub_control()
3734 test_bit(wIndex, &oxu->companion_ports)) { in oxu_hub_control()
3738 oxu_dbg(oxu, "port %d --> companion\n", wIndex + 1); in oxu_hub_control()
3751 status |= oxu_port_speed(oxu, temp); in oxu_hub_control()
3767 dbg_port(oxu, "GetStatus", wIndex + 1, temp); in oxu_hub_control()
3801 if (HCS_PPC(oxu->hcs_params)) in oxu_hub_control()
3811 oxu_vdbg(oxu, "port %d reset\n", wIndex + 1); in oxu_hub_control()
3819 oxu->reset_done[wIndex] = jiffies in oxu_hub_control()
3833 ehci_quiesce(oxu); in oxu_hub_control()
3834 ehci_halt(oxu); in oxu_hub_control()
3842 readl(&oxu->regs->command); /* unblock posted writes */ in oxu_hub_control()
3850 spin_unlock_irqrestore(&oxu->lock, flags); in oxu_hub_control()
3858 struct oxu_hcd *oxu = hcd_to_oxu(hcd); in oxu_bus_suspend() local
3862 oxu_dbg(oxu, "suspend root hub\n"); in oxu_bus_suspend()
3864 if (time_before(jiffies, oxu->next_statechange)) in oxu_bus_suspend()
3867 port = HCS_N_PORTS(oxu->hcs_params); in oxu_bus_suspend()
3868 spin_lock_irq(&oxu->lock); in oxu_bus_suspend()
3872 ehci_quiesce(oxu); in oxu_bus_suspend()
3875 oxu->command = readl(&oxu->regs->command); in oxu_bus_suspend()
3876 if (oxu->reclaim) in oxu_bus_suspend()
3877 oxu->reclaim_ready = 1; in oxu_bus_suspend()
3878 ehci_work(oxu); in oxu_bus_suspend()
3885 oxu->bus_suspended = 0; in oxu_bus_suspend()
3887 u32 __iomem *reg = &oxu->regs->port_status[port]; in oxu_bus_suspend()
3895 set_bit(port, &oxu->bus_suspended); in oxu_bus_suspend()
3905 oxu_vdbg(oxu, "port %d, %08x -> %08x\n", in oxu_bus_suspend()
3911 spin_unlock_irq(&oxu->lock); in oxu_bus_suspend()
3913 del_timer_sync(&oxu->watchdog); in oxu_bus_suspend()
3914 spin_lock_irq(&oxu->lock); in oxu_bus_suspend()
3915 ehci_halt(oxu); in oxu_bus_suspend()
3922 writel(mask, &oxu->regs->intr_enable); in oxu_bus_suspend()
3923 readl(&oxu->regs->intr_enable); in oxu_bus_suspend()
3925 oxu->next_statechange = jiffies + msecs_to_jiffies(10); in oxu_bus_suspend()
3926 spin_unlock_irq(&oxu->lock); in oxu_bus_suspend()
3933 struct oxu_hcd *oxu = hcd_to_oxu(hcd); in oxu_bus_resume() local
3937 if (time_before(jiffies, oxu->next_statechange)) in oxu_bus_resume()
3939 spin_lock_irq(&oxu->lock); in oxu_bus_resume()
3947 temp = readl(&oxu->regs->intr_enable); in oxu_bus_resume()
3948 oxu_dbg(oxu, "resume root hub%s\n", temp ? "" : " after power loss"); in oxu_bus_resume()
3953 writel(0, &oxu->regs->intr_enable); in oxu_bus_resume()
3956 writel(0, &oxu->regs->segment); in oxu_bus_resume()
3957 writel(oxu->periodic_dma, &oxu->regs->frame_list); in oxu_bus_resume()
3958 writel((u32) oxu->async->qh_dma, &oxu->regs->async_next); in oxu_bus_resume()
3961 writel(oxu->command, &oxu->regs->command); in oxu_bus_resume()
3968 i = HCS_N_PORTS(oxu->hcs_params); in oxu_bus_resume()
3970 temp = readl(&oxu->regs->port_status[i]); in oxu_bus_resume()
3973 if (test_bit(i, &oxu->bus_suspended) && (temp & PORT_SUSPEND)) { in oxu_bus_resume()
3974 oxu->reset_done[i] = jiffies + msecs_to_jiffies(20); in oxu_bus_resume()
3977 writel(temp, &oxu->regs->port_status[i]); in oxu_bus_resume()
3979 i = HCS_N_PORTS(oxu->hcs_params); in oxu_bus_resume()
3982 temp = readl(&oxu->regs->port_status[i]); in oxu_bus_resume()
3983 if (test_bit(i, &oxu->bus_suspended) && (temp & PORT_SUSPEND)) { in oxu_bus_resume()
3985 writel(temp, &oxu->regs->port_status[i]); in oxu_bus_resume()
3986 oxu_vdbg(oxu, "resumed port %d\n", i + 1); in oxu_bus_resume()
3989 (void) readl(&oxu->regs->command); in oxu_bus_resume()
3993 if (oxu->async->qh_next.qh) in oxu_bus_resume()
3995 if (oxu->periodic_sched) in oxu_bus_resume()
3998 oxu->command |= temp; in oxu_bus_resume()
3999 writel(oxu->command, &oxu->regs->command); in oxu_bus_resume()
4002 oxu->next_statechange = jiffies + msecs_to_jiffies(5); in oxu_bus_resume()
4006 writel(INTR_MASK, &oxu->regs->intr_enable); in oxu_bus_resume()
4008 spin_unlock_irq(&oxu->lock); in oxu_bus_resume()
4133 struct oxu_hcd *oxu; in oxu_create() local
4152 oxu = hcd_to_oxu(hcd); in oxu_create()
4153 oxu->is_otg = otg; in oxu_create()