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()
1381 oxu_dbg(oxu, "%s %s urb %p ep%d%s status %d len %d/%d\n", in ehci_urb_done()
1390 spin_unlock(&oxu->lock); in ehci_urb_done()
1391 usb_hcd_giveback_urb(oxu_to_hcd(oxu), urb, urb->status); in ehci_urb_done()
1392 spin_lock(&oxu->lock); in ehci_urb_done()
1395 static void start_unlink_async(struct oxu_hcd *oxu, struct ehci_qh *qh);
1396 static void unlink_async(struct oxu_hcd *oxu, struct ehci_qh *qh);
1398 static void intr_deschedule(struct oxu_hcd *oxu, struct ehci_qh *qh);
1399 static int qh_schedule(struct oxu_hcd *oxu, struct ehci_qh *qh);
1407 static unsigned qh_completions(struct oxu_hcd *oxu, struct ehci_qh *qh) in qh_completions() argument
1448 ehci_urb_done(oxu, last->urb); in qh_completions()
1451 oxu_murb_free(oxu, murb); in qh_completions()
1453 ehci_urb_done(oxu, last->urb); in qh_completions()
1457 oxu_qtd_free(oxu, last); in qh_completions()
1486 HC_IS_RUNNING(oxu_to_hcd(oxu)->state))) { in qh_completions()
1492 if (unlikely(!HC_IS_RUNNING(oxu_to_hcd(oxu)->state))) in qh_completions()
1527 qtd_copy_status(oxu, urb->complete ? in qh_completions()
1551 ehci_urb_done(oxu, last->urb); in qh_completions()
1554 oxu_murb_free(oxu, murb); in qh_completions()
1556 ehci_urb_done(oxu, last->urb); in qh_completions()
1559 oxu_qtd_free(oxu, last); in qh_completions()
1572 qh_refresh(oxu, qh); in qh_completions()
1580 intr_deschedule(oxu, qh); in qh_completions()
1581 (void) qh_schedule(oxu, qh); in qh_completions()
1583 unlink_async(oxu, qh); in qh_completions()
1600 static void qtd_list_free(struct oxu_hcd *oxu, in qtd_list_free() argument
1607 oxu_qtd_free(oxu, qtd); in qtd_list_free()
1613 static struct list_head *qh_urb_transaction(struct oxu_hcd *oxu, in qh_urb_transaction() argument
1629 qtd = ehci_qtd_alloc(oxu); in qh_urb_transaction()
1646 ret = oxu_buf_alloc(oxu, qtd, sizeof(struct usb_ctrlrequest)); in qh_urb_transaction()
1658 qtd = ehci_qtd_alloc(oxu); in qh_urb_transaction()
1674 ret = oxu_buf_alloc(oxu, qtd, len); in qh_urb_transaction()
1704 qtd->hw_alt_next = oxu->async->hw_alt_next; in qh_urb_transaction()
1714 qtd = ehci_qtd_alloc(oxu); in qh_urb_transaction()
1718 ret = oxu_buf_alloc(oxu, qtd, len); in qh_urb_transaction()
1752 qtd = ehci_qtd_alloc(oxu); in qh_urb_transaction()
1769 qtd_list_free(oxu, urb, head); in qh_urb_transaction()
1780 static struct ehci_qh *qh_make(struct oxu_hcd *oxu, in qh_make() argument
1783 struct ehci_qh *qh = oxu_qh_alloc(oxu); in qh_make()
1825 oxu_dbg(oxu, "intr period %d uframes, NYET!\n", in qh_make()
1897 oxu_dbg(oxu, "bogus dev %p speed %d\n", urb->dev, urb->dev->speed); in qh_make()
1910 qh_refresh(oxu, qh); in qh_make()
1916 static void qh_link_async(struct oxu_hcd *oxu, struct ehci_qh *qh) in qh_link_async() argument
1922 head = oxu->async; in qh_link_async()
1923 timer_action_done(oxu, TIMER_ASYNC_OFF); in qh_link_async()
1925 u32 cmd = readl(&oxu->regs->command); in qh_link_async()
1929 (void)handshake(oxu, &oxu->regs->status, in qh_link_async()
1932 writel(cmd, &oxu->regs->command); in qh_link_async()
1933 oxu_to_hcd(oxu)->state = HC_STATE_RUNNING; in qh_link_async()
1940 qh_refresh(oxu, qh); in qh_link_async()
1962 static struct ehci_qh *qh_append_tds(struct oxu_hcd *oxu, in qh_append_tds() argument
1971 qh = qh_make(oxu, urb, GFP_ATOMIC); in qh_append_tds()
2037 static int submit_async(struct oxu_hcd *oxu, struct urb *urb, in submit_async() argument
2049 oxu_dbg(oxu, "%s %s urb %p ep%d%s len %d, qtd %p [qh %p]\n", in submit_async()
2056 spin_lock_irqsave(&oxu->lock, flags); in submit_async()
2057 if (unlikely(!HCD_HW_ACCESSIBLE(oxu_to_hcd(oxu)))) { in submit_async()
2062 qh = qh_append_tds(oxu, urb, qtd_list, epnum, &urb->ep->hcpriv); in submit_async()
2072 qh_link_async(oxu, qh_get(qh)); in submit_async()
2074 spin_unlock_irqrestore(&oxu->lock, flags); in submit_async()
2076 qtd_list_free(oxu, urb, qtd_list); in submit_async()
2082 static void end_unlink_async(struct oxu_hcd *oxu) in end_unlink_async() argument
2084 struct ehci_qh *qh = oxu->reclaim; in end_unlink_async()
2087 timer_action_done(oxu, TIMER_IAA_WATCHDOG); in end_unlink_async()
2095 oxu->reclaim = next; in end_unlink_async()
2096 oxu->reclaim_ready = 0; in end_unlink_async()
2099 qh_completions(oxu, qh); in end_unlink_async()
2102 && HC_IS_RUNNING(oxu_to_hcd(oxu)->state)) in end_unlink_async()
2103 qh_link_async(oxu, qh); in end_unlink_async()
2110 if (HC_IS_RUNNING(oxu_to_hcd(oxu)->state) in end_unlink_async()
2111 && oxu->async->qh_next.qh == NULL) in end_unlink_async()
2112 timer_action(oxu, TIMER_ASYNC_OFF); in end_unlink_async()
2116 oxu->reclaim = NULL; in end_unlink_async()
2117 start_unlink_async(oxu, next); in end_unlink_async()
2124 static void start_unlink_async(struct oxu_hcd *oxu, struct ehci_qh *qh) in start_unlink_async() argument
2126 int cmd = readl(&oxu->regs->command); in start_unlink_async()
2130 assert_spin_locked(&oxu->lock); in start_unlink_async()
2131 BUG_ON(oxu->reclaim || (qh->qh_state != QH_STATE_LINKED in start_unlink_async()
2136 if (unlikely(qh == oxu->async)) { in start_unlink_async()
2138 if (oxu_to_hcd(oxu)->state != HC_STATE_HALT in start_unlink_async()
2139 && !oxu->reclaim) { in start_unlink_async()
2141 writel(cmd & ~CMD_ASE, &oxu->regs->command); in start_unlink_async()
2144 timer_action_done(oxu, TIMER_ASYNC_OFF); in start_unlink_async()
2150 oxu->reclaim = qh = qh_get(qh); in start_unlink_async()
2152 prev = oxu->async; in start_unlink_async()
2160 if (unlikely(oxu_to_hcd(oxu)->state == HC_STATE_HALT)) { in start_unlink_async()
2164 end_unlink_async(oxu); in start_unlink_async()
2168 oxu->reclaim_ready = 0; in start_unlink_async()
2170 writel(cmd, &oxu->regs->command); in start_unlink_async()
2171 (void) readl(&oxu->regs->command); in start_unlink_async()
2172 timer_action(oxu, TIMER_IAA_WATCHDOG); in start_unlink_async()
2175 static void scan_async(struct oxu_hcd *oxu) in scan_async() argument
2180 if (!++(oxu->stamp)) in scan_async()
2181 oxu->stamp++; in scan_async()
2182 timer_action_done(oxu, TIMER_ASYNC_SHRINK); in scan_async()
2184 qh = oxu->async->qh_next.qh; in scan_async()
2189 && qh->stamp != oxu->stamp) { in scan_async()
2198 qh->stamp = oxu->stamp; in scan_async()
2199 temp = qh_completions(oxu, qh); in scan_async()
2212 if (qh->stamp == oxu->stamp) in scan_async()
2214 else if (!oxu->reclaim in scan_async()
2216 start_unlink_async(oxu, qh); in scan_async()
2223 timer_action(oxu, TIMER_ASYNC_SHRINK); in scan_async()
2242 static void periodic_unlink(struct oxu_hcd *oxu, unsigned frame, void *ptr) in periodic_unlink() argument
2244 union ehci_shadow *prev_p = &oxu->pshadow[frame]; in periodic_unlink()
2245 __le32 *hw_p = &oxu->periodic[frame]; in periodic_unlink()
2266 static unsigned short periodic_usecs(struct oxu_hcd *oxu, in periodic_usecs() argument
2269 __le32 *hw_p = &oxu->periodic[frame]; in periodic_usecs()
2270 union ehci_shadow *q = &oxu->pshadow[frame]; in periodic_usecs()
2290 oxu_err(oxu, "uframe %d sched overrun: %d usecs\n", in periodic_usecs()
2296 static int enable_periodic(struct oxu_hcd *oxu) in enable_periodic() argument
2304 status = handshake(oxu, &oxu->regs->status, STS_PSS, 0, 9 * 125); in enable_periodic()
2306 oxu_to_hcd(oxu)->state = HC_STATE_HALT; in enable_periodic()
2307 usb_hc_died(oxu_to_hcd(oxu)); in enable_periodic()
2311 cmd = readl(&oxu->regs->command) | CMD_PSE; in enable_periodic()
2312 writel(cmd, &oxu->regs->command); in enable_periodic()
2314 oxu_to_hcd(oxu)->state = HC_STATE_RUNNING; in enable_periodic()
2317 oxu->next_uframe = readl(&oxu->regs->frame_index) in enable_periodic()
2318 % (oxu->periodic_size << 3); in enable_periodic()
2322 static int disable_periodic(struct oxu_hcd *oxu) in disable_periodic() argument
2330 status = handshake(oxu, &oxu->regs->status, STS_PSS, STS_PSS, 9 * 125); in disable_periodic()
2332 oxu_to_hcd(oxu)->state = HC_STATE_HALT; in disable_periodic()
2333 usb_hc_died(oxu_to_hcd(oxu)); in disable_periodic()
2337 cmd = readl(&oxu->regs->command) & ~CMD_PSE; in disable_periodic()
2338 writel(cmd, &oxu->regs->command); in disable_periodic()
2341 oxu->next_uframe = -1; in disable_periodic()
2351 static int qh_link_periodic(struct oxu_hcd *oxu, struct ehci_qh *qh) in qh_link_periodic() argument
2365 for (i = qh->start; i < oxu->periodic_size; i += period) { in qh_link_periodic()
2366 union ehci_shadow *prev = &oxu->pshadow[i]; in qh_link_periodic()
2367 __le32 *hw_p = &oxu->periodic[i]; in qh_link_periodic()
2405 oxu_to_hcd(oxu)->self.bandwidth_allocated += qh->period in qh_link_periodic()
2410 if (!oxu->periodic_sched++) in qh_link_periodic()
2411 return enable_periodic(oxu); in qh_link_periodic()
2416 static void qh_unlink_periodic(struct oxu_hcd *oxu, struct ehci_qh *qh) in qh_unlink_periodic() argument
2434 for (i = qh->start; i < oxu->periodic_size; i += period) in qh_unlink_periodic()
2435 periodic_unlink(oxu, i, qh); in qh_unlink_periodic()
2438 oxu_to_hcd(oxu)->self.bandwidth_allocated -= qh->period in qh_unlink_periodic()
2454 oxu->periodic_sched--; in qh_unlink_periodic()
2455 if (!oxu->periodic_sched) in qh_unlink_periodic()
2456 (void) disable_periodic(oxu); in qh_unlink_periodic()
2459 static void intr_deschedule(struct oxu_hcd *oxu, struct ehci_qh *qh) in intr_deschedule() argument
2463 qh_unlink_periodic(oxu, qh); in intr_deschedule()
2482 static int check_period(struct oxu_hcd *oxu, in check_period() argument
2506 claimed = periodic_usecs(oxu, frame, uframe); in check_period()
2510 } while ((frame += 1) < oxu->periodic_size); in check_period()
2515 claimed = periodic_usecs(oxu, frame, uframe); in check_period()
2518 } while ((frame += period) < oxu->periodic_size); in check_period()
2524 static int check_intr_schedule(struct oxu_hcd *oxu, in check_intr_schedule() argument
2533 if (!check_period(oxu, frame, uframe, qh->period, qh->usecs)) in check_intr_schedule()
2548 static int qh_schedule(struct oxu_hcd *oxu, struct ehci_qh *qh) in qh_schedule() argument
2555 qh_refresh(oxu, qh); in qh_schedule()
2562 status = check_intr_schedule(oxu, frame, --uframe, in qh_schedule()
2579 status = check_intr_schedule(oxu, in qh_schedule()
2590 status = check_intr_schedule(oxu, 0, 0, qh, &c_mask); in qh_schedule()
2603 oxu_dbg(oxu, "reused qh %p schedule\n", qh); in qh_schedule()
2606 status = qh_link_periodic(oxu, qh); in qh_schedule()
2611 static int intr_submit(struct oxu_hcd *oxu, struct urb *urb, in intr_submit() argument
2623 spin_lock_irqsave(&oxu->lock, flags); in intr_submit()
2625 if (unlikely(!HCD_HW_ACCESSIBLE(oxu_to_hcd(oxu)))) { in intr_submit()
2632 qh = qh_append_tds(oxu, urb, &empty, epnum, &urb->ep->hcpriv); in intr_submit()
2638 status = qh_schedule(oxu, qh); in intr_submit()
2644 qh = qh_append_tds(oxu, urb, qtd_list, epnum, &urb->ep->hcpriv); in intr_submit()
2648 oxu_to_hcd(oxu)->self.bandwidth_int_reqs++; in intr_submit()
2651 spin_unlock_irqrestore(&oxu->lock, flags); in intr_submit()
2653 qtd_list_free(oxu, urb, qtd_list); in intr_submit()
2658 static inline int itd_submit(struct oxu_hcd *oxu, struct urb *urb, in itd_submit() argument
2661 oxu_dbg(oxu, "iso support is missing!\n"); in itd_submit()
2665 static inline int sitd_submit(struct oxu_hcd *oxu, struct urb *urb, in sitd_submit() argument
2668 oxu_dbg(oxu, "split iso support is missing!\n"); in sitd_submit()
2672 static void scan_periodic(struct oxu_hcd *oxu) in scan_periodic() argument
2677 mod = oxu->periodic_size << 3; in scan_periodic()
2684 now_uframe = oxu->next_uframe; in scan_periodic()
2685 if (HC_IS_RUNNING(oxu_to_hcd(oxu)->state)) in scan_periodic()
2686 clock = readl(&oxu->regs->frame_index); in scan_periodic()
2704 q_p = &oxu->pshadow[frame]; in scan_periodic()
2705 hw_p = &oxu->periodic[frame]; in scan_periodic()
2719 modified = qh_completions(oxu, temp.qh); in scan_periodic()
2721 intr_deschedule(oxu, temp.qh); in scan_periodic()
2725 oxu_dbg(oxu, "corrupt type %d frame %d shadow %p\n", in scan_periodic()
2749 if (!HC_IS_RUNNING(oxu_to_hcd(oxu)->state)) in scan_periodic()
2751 oxu->next_uframe = now_uframe; in scan_periodic()
2752 now = readl(&oxu->regs->frame_index) % mod; in scan_periodic()
2769 static void ehci_turn_off_all_ports(struct oxu_hcd *oxu) in ehci_turn_off_all_ports() argument
2771 int port = HCS_N_PORTS(oxu->hcs_params); in ehci_turn_off_all_ports()
2774 writel(PORT_RWC_BITS, &oxu->regs->port_status[port]); in ehci_turn_off_all_ports()
2777 static void ehci_port_power(struct oxu_hcd *oxu, int is_on) in ehci_port_power() argument
2781 if (!HCS_PPC(oxu->hcs_params)) in ehci_port_power()
2784 oxu_dbg(oxu, "...power%s ports...\n", is_on ? "up" : "down"); in ehci_port_power()
2785 for (port = HCS_N_PORTS(oxu->hcs_params); port > 0; ) { in ehci_port_power()
2787 oxu_hub_control(oxu_to_hcd(oxu), SetPortFeature, in ehci_port_power()
2790 oxu_hub_control(oxu_to_hcd(oxu), ClearPortFeature, in ehci_port_power()
2800 static void ehci_work(struct oxu_hcd *oxu) in ehci_work() argument
2802 timer_action_done(oxu, TIMER_IO_WATCHDOG); in ehci_work()
2803 if (oxu->reclaim_ready) in ehci_work()
2804 end_unlink_async(oxu); in ehci_work()
2810 if (oxu->scanning) in ehci_work()
2812 oxu->scanning = 1; in ehci_work()
2813 scan_async(oxu); in ehci_work()
2814 if (oxu->next_uframe != -1) in ehci_work()
2815 scan_periodic(oxu); in ehci_work()
2816 oxu->scanning = 0; in ehci_work()
2822 if (HC_IS_RUNNING(oxu_to_hcd(oxu)->state) && in ehci_work()
2823 (oxu->async->qh_next.ptr != NULL || in ehci_work()
2824 oxu->periodic_sched != 0)) in ehci_work()
2825 timer_action(oxu, TIMER_IO_WATCHDOG); in ehci_work()
2828 static void unlink_async(struct oxu_hcd *oxu, struct ehci_qh *qh) in unlink_async() argument
2832 && oxu->reclaim in unlink_async()
2833 && HC_IS_RUNNING(oxu_to_hcd(oxu)->state)) { in unlink_async()
2836 for (last = oxu->reclaim; in unlink_async()
2844 } else if (!HC_IS_RUNNING(oxu_to_hcd(oxu)->state) && oxu->reclaim) in unlink_async()
2845 end_unlink_async(oxu); in unlink_async()
2849 start_unlink_async(oxu, qh); in unlink_async()
2858 struct oxu_hcd *oxu = hcd_to_oxu(hcd); in oxu210_hcd_irq() local
2862 spin_lock(&oxu->lock); in oxu210_hcd_irq()
2864 status = readl(&oxu->regs->status); in oxu210_hcd_irq()
2868 oxu_dbg(oxu, "device removed\n"); in oxu210_hcd_irq()
2875 spin_unlock(&oxu->lock); in oxu210_hcd_irq()
2880 writel(status, &oxu->regs->status); in oxu210_hcd_irq()
2881 readl(&oxu->regs->command); /* unblock posted write */ in oxu210_hcd_irq()
2886 dbg_status(oxu, "irq", status); in oxu210_hcd_irq()
2897 oxu->reclaim_ready = 1; in oxu210_hcd_irq()
2903 unsigned i = HCS_N_PORTS(oxu->hcs_params); in oxu210_hcd_irq()
2907 if (!(readl(&oxu->regs->command) & CMD_RUN)) in oxu210_hcd_irq()
2911 int pstatus = readl(&oxu->regs->port_status[i]); in oxu210_hcd_irq()
2916 || oxu->reset_done[i] != 0) in oxu210_hcd_irq()
2923 oxu->reset_done[i] = jiffies + in oxu210_hcd_irq()
2925 oxu_dbg(oxu, "port %d remote wakeup\n", i + 1); in oxu210_hcd_irq()
2926 mod_timer(&hcd->rh_timer, oxu->reset_done[i]); in oxu210_hcd_irq()
2933 status = readl(&oxu->regs->status); in oxu210_hcd_irq()
2934 dbg_cmd(oxu, "fatal", readl(&oxu->regs->command)); in oxu210_hcd_irq()
2935 dbg_status(oxu, "fatal", status); in oxu210_hcd_irq()
2937 oxu_err(oxu, "fatal error\n"); in oxu210_hcd_irq()
2939 ehci_reset(oxu); in oxu210_hcd_irq()
2940 writel(0, &oxu->regs->configured_flag); in oxu210_hcd_irq()
2950 ehci_work(oxu); in oxu210_hcd_irq()
2951 spin_unlock(&oxu->lock); in oxu210_hcd_irq()
2959 struct oxu_hcd *oxu = hcd_to_oxu(hcd); in oxu_irq() local
2968 if ((oxu->is_otg && (status & OXU_USBOTGI)) || in oxu_irq()
2969 (!oxu->is_otg && (status & OXU_USBSPHI))) in oxu_irq()
2982 struct oxu_hcd *oxu = from_timer(oxu, t, watchdog); in oxu_watchdog() local
2985 spin_lock_irqsave(&oxu->lock, flags); in oxu_watchdog()
2988 if (oxu->reclaim) { in oxu_watchdog()
2989 u32 status = readl(&oxu->regs->status); in oxu_watchdog()
2991 oxu_vdbg(oxu, "lost IAA\n"); in oxu_watchdog()
2992 writel(STS_IAA, &oxu->regs->status); in oxu_watchdog()
2993 oxu->reclaim_ready = 1; in oxu_watchdog()
2998 if (test_bit(TIMER_ASYNC_OFF, &oxu->actions)) in oxu_watchdog()
2999 start_unlink_async(oxu, oxu->async); in oxu_watchdog()
3002 ehci_work(oxu); in oxu_watchdog()
3004 spin_unlock_irqrestore(&oxu->lock, flags); in oxu_watchdog()
3011 struct oxu_hcd *oxu = hcd_to_oxu(hcd); in oxu_hcd_init() local
3016 spin_lock_init(&oxu->lock); in oxu_hcd_init()
3018 timer_setup(&oxu->watchdog, oxu_watchdog, 0); in oxu_hcd_init()
3024 oxu->periodic_size = DEFAULT_I_TDPS; in oxu_hcd_init()
3025 retval = ehci_mem_init(oxu, GFP_KERNEL); in oxu_hcd_init()
3030 hcc_params = readl(&oxu->caps->hcc_params); in oxu_hcd_init()
3032 oxu->i_thresh = 8; in oxu_hcd_init()
3034 oxu->i_thresh = 2 + HCC_ISOC_THRES(hcc_params); in oxu_hcd_init()
3036 oxu->reclaim = NULL; in oxu_hcd_init()
3037 oxu->reclaim_ready = 0; in oxu_hcd_init()
3038 oxu->next_uframe = -1; in oxu_hcd_init()
3047 oxu->async->qh_next.qh = NULL; in oxu_hcd_init()
3048 oxu->async->hw_next = QH_NEXT(oxu->async->qh_dma); in oxu_hcd_init()
3049 oxu->async->hw_info1 = cpu_to_le32(QH_HEAD); in oxu_hcd_init()
3050 oxu->async->hw_token = cpu_to_le32(QTD_STS_HALT); in oxu_hcd_init()
3051 oxu->async->hw_qtd_next = EHCI_LIST_END; in oxu_hcd_init()
3052 oxu->async->qh_state = QH_STATE_LINKED; in oxu_hcd_init()
3053 oxu->async->hw_alt_next = QTD_NEXT(oxu->async->dummy->qtd_dma); in oxu_hcd_init()
3072 oxu_dbg(oxu, "park %d\n", park); in oxu_hcd_init()
3079 oxu->command = temp; in oxu_hcd_init()
3088 struct oxu_hcd *oxu = hcd_to_oxu(hcd); in oxu_reset() local
3090 spin_lock_init(&oxu->mem_lock); in oxu_reset()
3091 INIT_LIST_HEAD(&oxu->urb_list); in oxu_reset()
3092 oxu->urb_len = 0; in oxu_reset()
3094 if (oxu->is_otg) { in oxu_reset()
3095 oxu->caps = hcd->regs + OXU_OTG_CAP_OFFSET; in oxu_reset()
3096 oxu->regs = hcd->regs + OXU_OTG_CAP_OFFSET + \ in oxu_reset()
3097 HC_LENGTH(readl(&oxu->caps->hc_capbase)); in oxu_reset()
3099 oxu->mem = hcd->regs + OXU_SPH_MEM; in oxu_reset()
3101 oxu->caps = hcd->regs + OXU_SPH_CAP_OFFSET; in oxu_reset()
3102 oxu->regs = hcd->regs + OXU_SPH_CAP_OFFSET + \ in oxu_reset()
3103 HC_LENGTH(readl(&oxu->caps->hc_capbase)); in oxu_reset()
3105 oxu->mem = hcd->regs + OXU_OTG_MEM; in oxu_reset()
3108 oxu->hcs_params = readl(&oxu->caps->hcs_params); in oxu_reset()
3109 oxu->sbrn = 0x20; in oxu_reset()
3116 struct oxu_hcd *oxu = hcd_to_oxu(hcd); in oxu_run() local
3123 retval = ehci_reset(oxu); in oxu_run()
3125 ehci_mem_cleanup(oxu); in oxu_run()
3128 writel(oxu->periodic_dma, &oxu->regs->frame_list); in oxu_run()
3129 writel((u32) oxu->async->qh_dma, &oxu->regs->async_next); in oxu_run()
3142 hcc_params = readl(&oxu->caps->hcc_params); in oxu_run()
3144 writel(0, &oxu->regs->segment); in oxu_run()
3146 oxu->command &= ~(CMD_LRESET | CMD_IAAD | CMD_PSE | in oxu_run()
3148 oxu->command |= CMD_RUN; in oxu_run()
3149 writel(oxu->command, &oxu->regs->command); in oxu_run()
3150 dbg_cmd(oxu, "init", oxu->command); in oxu_run()
3159 writel(FLAG_CF, &oxu->regs->configured_flag); in oxu_run()
3160 readl(&oxu->regs->command); /* unblock posted writes */ in oxu_run()
3162 temp = HC_VERSION(readl(&oxu->caps->hc_capbase)); in oxu_run()
3163 oxu_info(oxu, "USB %x.%x started, quasi-EHCI %x.%02x, driver %s%s\n", in oxu_run()
3164 ((oxu->sbrn & 0xf0)>>4), (oxu->sbrn & 0x0f), in oxu_run()
3168 writel(INTR_MASK, &oxu->regs->intr_enable); /* Turn On Interrupts */ in oxu_run()
3175 struct oxu_hcd *oxu = hcd_to_oxu(hcd); in oxu_stop() local
3178 ehci_port_power(oxu, 0); in oxu_stop()
3181 del_timer_sync(&oxu->watchdog); in oxu_stop()
3183 spin_lock_irq(&oxu->lock); in oxu_stop()
3185 ehci_quiesce(oxu); in oxu_stop()
3187 ehci_reset(oxu); in oxu_stop()
3188 writel(0, &oxu->regs->intr_enable); in oxu_stop()
3189 spin_unlock_irq(&oxu->lock); in oxu_stop()
3192 writel(0, &oxu->regs->configured_flag); in oxu_stop()
3195 spin_lock_irq(&oxu->lock); in oxu_stop()
3196 if (oxu->async) in oxu_stop()
3197 ehci_work(oxu); in oxu_stop()
3198 spin_unlock_irq(&oxu->lock); in oxu_stop()
3199 ehci_mem_cleanup(oxu); in oxu_stop()
3201 dbg_status(oxu, "oxu_stop completed", readl(&oxu->regs->status)); in oxu_stop()
3210 struct oxu_hcd *oxu = hcd_to_oxu(hcd); in oxu_shutdown() local
3212 (void) ehci_halt(oxu); in oxu_shutdown()
3213 ehci_turn_off_all_ports(oxu); in oxu_shutdown()
3216 writel(0, &oxu->regs->configured_flag); in oxu_shutdown()
3219 readl(&oxu->regs->configured_flag); in oxu_shutdown()
3236 struct oxu_hcd *oxu = hcd_to_oxu(hcd); in __oxu_urb_enqueue() local
3245 if (!qh_urb_transaction(oxu, urb, &qtd_list, mem_flags)) in __oxu_urb_enqueue()
3247 return submit_async(oxu, urb, &qtd_list, mem_flags); in __oxu_urb_enqueue()
3250 if (!qh_urb_transaction(oxu, urb, &qtd_list, mem_flags)) in __oxu_urb_enqueue()
3252 return intr_submit(oxu, urb, &qtd_list, mem_flags); in __oxu_urb_enqueue()
3256 return itd_submit(oxu, urb, mem_flags); in __oxu_urb_enqueue()
3258 return sitd_submit(oxu, urb, mem_flags); in __oxu_urb_enqueue()
3268 struct oxu_hcd *oxu = hcd_to_oxu(hcd); in oxu_urb_enqueue() local
3296 murb = (struct urb *) oxu_murb_alloc(oxu); in oxu_urb_enqueue()
3327 murb = (struct urb *) oxu_murb_alloc(oxu); in oxu_urb_enqueue()
3358 struct oxu_hcd *oxu = hcd_to_oxu(hcd); in oxu_urb_dequeue() local
3362 spin_lock_irqsave(&oxu->lock, flags); in oxu_urb_dequeue()
3370 unlink_async(oxu, qh); in oxu_urb_dequeue()
3379 intr_deschedule(oxu, qh); in oxu_urb_dequeue()
3382 qh_completions(oxu, qh); in oxu_urb_dequeue()
3385 oxu_dbg(oxu, "bogus qh %p state %d\n", in oxu_urb_dequeue()
3395 status = qh_schedule(oxu, qh); in oxu_urb_dequeue()
3396 spin_unlock_irqrestore(&oxu->lock, flags); in oxu_urb_dequeue()
3411 spin_unlock_irqrestore(&oxu->lock, flags); in oxu_urb_dequeue()
3419 struct oxu_hcd *oxu = hcd_to_oxu(hcd); in oxu_endpoint_disable() local
3427 spin_lock_irqsave(&oxu->lock, flags); in oxu_endpoint_disable()
3436 oxu_vdbg(oxu, "iso delay\n"); in oxu_endpoint_disable()
3444 for (tmp = oxu->async->qh_next.qh; in oxu_endpoint_disable()
3451 unlink_async(oxu, qh); in oxu_endpoint_disable()
3455 spin_unlock_irqrestore(&oxu->lock, flags); in oxu_endpoint_disable()
3469 oxu_err(oxu, "qh %p (#%02x) state %d%s\n", in oxu_endpoint_disable()
3476 spin_unlock_irqrestore(&oxu->lock, flags); in oxu_endpoint_disable()
3481 struct oxu_hcd *oxu = hcd_to_oxu(hcd); in oxu_get_frame() local
3483 return (readl(&oxu->regs->frame_index) >> 3) % in oxu_get_frame()
3484 oxu->periodic_size; in oxu_get_frame()
3490 struct oxu_hcd *oxu = hcd_to_oxu(hcd); in oxu_hub_status_data() local
3501 ports = HCS_N_PORTS(oxu->hcs_params); in oxu_hub_status_data()
3521 spin_lock_irqsave(&oxu->lock, flags); in oxu_hub_status_data()
3523 temp = readl(&oxu->regs->port_status[i]); in oxu_hub_status_data()
3533 oxu->reset_done[i] = 0; in oxu_hub_status_data()
3535 time_after_eq(jiffies, oxu->reset_done[i]))) { in oxu_hub_status_data()
3544 spin_unlock_irqrestore(&oxu->lock, flags); in oxu_hub_status_data()
3549 static inline unsigned int oxu_port_speed(struct oxu_hcd *oxu, in oxu_port_speed() argument
3567 struct oxu_hcd *oxu = hcd_to_oxu(hcd); in oxu_hub_control() local
3568 int ports = HCS_N_PORTS(oxu->hcs_params); in oxu_hub_control()
3569 u32 __iomem *status_reg = &oxu->regs->port_status[wIndex - 1]; in oxu_hub_control()
3582 spin_lock_irqsave(&oxu->lock, flags); in oxu_hub_control()
3623 oxu->reset_done[wIndex] = jiffies in oxu_hub_control()
3631 if (HCS_PPC(oxu->hcs_params)) in oxu_hub_control()
3647 readl(&oxu->regs->command); /* unblock posted write */ in oxu_hub_control()
3650 ehci_hub_descriptor(oxu, (struct usb_hub_descriptor *) in oxu_hub_control()
3676 if (!oxu->reset_done[wIndex]) { in oxu_hub_control()
3678 oxu->reset_done[wIndex] = jiffies in oxu_hub_control()
3681 mod_timer(&oxu_to_hcd(oxu)->rh_timer, in oxu_hub_control()
3682 oxu->reset_done[wIndex]); in oxu_hub_control()
3687 oxu->reset_done[wIndex])) { in oxu_hub_control()
3689 oxu->reset_done[wIndex] = 0; in oxu_hub_control()
3695 retval = handshake(oxu, status_reg, in oxu_hub_control()
3698 oxu_err(oxu, in oxu_hub_control()
3710 oxu->reset_done[wIndex])) { in oxu_hub_control()
3712 oxu->reset_done[wIndex] = 0; in oxu_hub_control()
3720 retval = handshake(oxu, status_reg, in oxu_hub_control()
3723 oxu_err(oxu, "port %d reset error %d\n", in oxu_hub_control()
3729 temp = check_reset_complete(oxu, wIndex, status_reg, in oxu_hub_control()
3735 test_bit(wIndex, &oxu->companion_ports)) { in oxu_hub_control()
3739 oxu_dbg(oxu, "port %d --> companion\n", wIndex + 1); in oxu_hub_control()
3752 status |= oxu_port_speed(oxu, temp); in oxu_hub_control()
3768 dbg_port(oxu, "GetStatus", wIndex + 1, temp); in oxu_hub_control()
3802 if (HCS_PPC(oxu->hcs_params)) in oxu_hub_control()
3812 oxu_vdbg(oxu, "port %d reset\n", wIndex + 1); in oxu_hub_control()
3820 oxu->reset_done[wIndex] = jiffies in oxu_hub_control()
3834 ehci_quiesce(oxu); in oxu_hub_control()
3835 ehci_halt(oxu); in oxu_hub_control()
3843 readl(&oxu->regs->command); /* unblock posted writes */ in oxu_hub_control()
3851 spin_unlock_irqrestore(&oxu->lock, flags); in oxu_hub_control()
3859 struct oxu_hcd *oxu = hcd_to_oxu(hcd); in oxu_bus_suspend() local
3863 oxu_dbg(oxu, "suspend root hub\n"); in oxu_bus_suspend()
3865 if (time_before(jiffies, oxu->next_statechange)) in oxu_bus_suspend()
3868 port = HCS_N_PORTS(oxu->hcs_params); in oxu_bus_suspend()
3869 spin_lock_irq(&oxu->lock); in oxu_bus_suspend()
3873 ehci_quiesce(oxu); in oxu_bus_suspend()
3876 oxu->command = readl(&oxu->regs->command); in oxu_bus_suspend()
3877 if (oxu->reclaim) in oxu_bus_suspend()
3878 oxu->reclaim_ready = 1; in oxu_bus_suspend()
3879 ehci_work(oxu); in oxu_bus_suspend()
3886 oxu->bus_suspended = 0; in oxu_bus_suspend()
3888 u32 __iomem *reg = &oxu->regs->port_status[port]; in oxu_bus_suspend()
3896 set_bit(port, &oxu->bus_suspended); in oxu_bus_suspend()
3906 oxu_vdbg(oxu, "port %d, %08x -> %08x\n", in oxu_bus_suspend()
3912 spin_unlock_irq(&oxu->lock); in oxu_bus_suspend()
3914 del_timer_sync(&oxu->watchdog); in oxu_bus_suspend()
3915 spin_lock_irq(&oxu->lock); in oxu_bus_suspend()
3916 ehci_halt(oxu); in oxu_bus_suspend()
3923 writel(mask, &oxu->regs->intr_enable); in oxu_bus_suspend()
3924 readl(&oxu->regs->intr_enable); in oxu_bus_suspend()
3926 oxu->next_statechange = jiffies + msecs_to_jiffies(10); in oxu_bus_suspend()
3927 spin_unlock_irq(&oxu->lock); in oxu_bus_suspend()
3934 struct oxu_hcd *oxu = hcd_to_oxu(hcd); in oxu_bus_resume() local
3938 if (time_before(jiffies, oxu->next_statechange)) in oxu_bus_resume()
3940 spin_lock_irq(&oxu->lock); in oxu_bus_resume()
3948 temp = readl(&oxu->regs->intr_enable); in oxu_bus_resume()
3949 oxu_dbg(oxu, "resume root hub%s\n", temp ? "" : " after power loss"); in oxu_bus_resume()
3954 writel(0, &oxu->regs->intr_enable); in oxu_bus_resume()
3957 writel(0, &oxu->regs->segment); in oxu_bus_resume()
3958 writel(oxu->periodic_dma, &oxu->regs->frame_list); in oxu_bus_resume()
3959 writel((u32) oxu->async->qh_dma, &oxu->regs->async_next); in oxu_bus_resume()
3962 writel(oxu->command, &oxu->regs->command); in oxu_bus_resume()
3969 i = HCS_N_PORTS(oxu->hcs_params); in oxu_bus_resume()
3971 temp = readl(&oxu->regs->port_status[i]); in oxu_bus_resume()
3974 if (test_bit(i, &oxu->bus_suspended) && (temp & PORT_SUSPEND)) { in oxu_bus_resume()
3975 oxu->reset_done[i] = jiffies + msecs_to_jiffies(20); in oxu_bus_resume()
3978 writel(temp, &oxu->regs->port_status[i]); in oxu_bus_resume()
3980 i = HCS_N_PORTS(oxu->hcs_params); in oxu_bus_resume()
3983 temp = readl(&oxu->regs->port_status[i]); in oxu_bus_resume()
3984 if (test_bit(i, &oxu->bus_suspended) && (temp & PORT_SUSPEND)) { in oxu_bus_resume()
3986 writel(temp, &oxu->regs->port_status[i]); in oxu_bus_resume()
3987 oxu_vdbg(oxu, "resumed port %d\n", i + 1); in oxu_bus_resume()
3990 (void) readl(&oxu->regs->command); in oxu_bus_resume()
3994 if (oxu->async->qh_next.qh) in oxu_bus_resume()
3996 if (oxu->periodic_sched) in oxu_bus_resume()
3999 oxu->command |= temp; in oxu_bus_resume()
4000 writel(oxu->command, &oxu->regs->command); in oxu_bus_resume()
4003 oxu->next_statechange = jiffies + msecs_to_jiffies(5); in oxu_bus_resume()
4007 writel(INTR_MASK, &oxu->regs->intr_enable); in oxu_bus_resume()
4009 spin_unlock_irq(&oxu->lock); in oxu_bus_resume()
4134 struct oxu_hcd *oxu; in oxu_create() local
4153 oxu = hcd_to_oxu(hcd); in oxu_create()
4154 oxu->is_otg = otg; in oxu_create()