Searched refs:fusbh200 (Results 1 - 3 of 3) sorted by relevance

/linux-4.1.27/drivers/usb/host/
H A Dfusbh200-hcd.c93 #include "fusbh200.h"
97 #define fusbh200_dbg(fusbh200, fmt, args...) \
98 dev_dbg (fusbh200_to_hcd(fusbh200)->self.controller , fmt , ## args )
99 #define fusbh200_err(fusbh200, fmt, args...) \
100 dev_err (fusbh200_to_hcd(fusbh200)->self.controller , fmt , ## args )
101 #define fusbh200_info(fusbh200, fmt, args...) \
102 dev_info (fusbh200_to_hcd(fusbh200)->self.controller , fmt , ## args )
103 #define fusbh200_warn(fusbh200, fmt, args...) \
104 dev_warn (fusbh200_to_hcd(fusbh200)->self.controller , fmt , ## args )
110 static void dbg_hcs_params (struct fusbh200_hcd *fusbh200, char *label) dbg_hcs_params() argument
112 u32 params = fusbh200_readl(fusbh200, &fusbh200->caps->hcs_params); dbg_hcs_params()
114 fusbh200_dbg (fusbh200, dbg_hcs_params()
125 static void dbg_hcc_params (struct fusbh200_hcd *fusbh200, char *label) dbg_hcc_params() argument
127 u32 params = fusbh200_readl(fusbh200, &fusbh200->caps->hcc_params); dbg_hcc_params()
129 fusbh200_dbg (fusbh200, dbg_hcc_params()
138 dbg_qtd (const char *label, struct fusbh200_hcd *fusbh200, struct fusbh200_qtd *qtd) dbg_qtd() argument
140 fusbh200_dbg(fusbh200, "%s td %p n%08x %08x t%08x p0=%08x\n", label, qtd, dbg_qtd()
141 hc32_to_cpup(fusbh200, &qtd->hw_next), dbg_qtd()
142 hc32_to_cpup(fusbh200, &qtd->hw_alt_next), dbg_qtd()
143 hc32_to_cpup(fusbh200, &qtd->hw_token), dbg_qtd()
144 hc32_to_cpup(fusbh200, &qtd->hw_buf [0])); dbg_qtd()
146 fusbh200_dbg(fusbh200, " p1=%08x p2=%08x p3=%08x p4=%08x\n", dbg_qtd()
147 hc32_to_cpup(fusbh200, &qtd->hw_buf[1]), dbg_qtd()
148 hc32_to_cpup(fusbh200, &qtd->hw_buf[2]), dbg_qtd()
149 hc32_to_cpup(fusbh200, &qtd->hw_buf[3]), dbg_qtd()
150 hc32_to_cpup(fusbh200, &qtd->hw_buf[4])); dbg_qtd()
154 dbg_qh (const char *label, struct fusbh200_hcd *fusbh200, struct fusbh200_qh *qh) dbg_qh() argument
158 fusbh200_dbg (fusbh200, "%s qh %p n%08x info %x %x qtd %x\n", label, dbg_qh()
160 dbg_qtd("overlay", fusbh200, (struct fusbh200_qtd *) &hw->hw_qtd_next); dbg_qh()
164 dbg_itd (const char *label, struct fusbh200_hcd *fusbh200, struct fusbh200_itd *itd) dbg_itd() argument
166 fusbh200_dbg (fusbh200, "%s [%d] itd %p, next %08x, urb %p\n", dbg_itd()
167 label, itd->frame, itd, hc32_to_cpu(fusbh200, itd->hw_next), dbg_itd()
169 fusbh200_dbg (fusbh200, dbg_itd()
171 hc32_to_cpu(fusbh200, itd->hw_transaction[0]), dbg_itd()
172 hc32_to_cpu(fusbh200, itd->hw_transaction[1]), dbg_itd()
173 hc32_to_cpu(fusbh200, itd->hw_transaction[2]), dbg_itd()
174 hc32_to_cpu(fusbh200, itd->hw_transaction[3]), dbg_itd()
175 hc32_to_cpu(fusbh200, itd->hw_transaction[4]), dbg_itd()
176 hc32_to_cpu(fusbh200, itd->hw_transaction[5]), dbg_itd()
177 hc32_to_cpu(fusbh200, itd->hw_transaction[6]), dbg_itd()
178 hc32_to_cpu(fusbh200, itd->hw_transaction[7])); dbg_itd()
179 fusbh200_dbg (fusbh200, dbg_itd()
181 hc32_to_cpu(fusbh200, itd->hw_bufp[0]), dbg_itd()
182 hc32_to_cpu(fusbh200, itd->hw_bufp[1]), dbg_itd()
183 hc32_to_cpu(fusbh200, itd->hw_bufp[2]), dbg_itd()
184 hc32_to_cpu(fusbh200, itd->hw_bufp[3]), dbg_itd()
185 hc32_to_cpu(fusbh200, itd->hw_bufp[4]), dbg_itd()
186 hc32_to_cpu(fusbh200, itd->hw_bufp[5]), dbg_itd()
187 hc32_to_cpu(fusbh200, itd->hw_bufp[6])); dbg_itd()
188 fusbh200_dbg (fusbh200, " index: %d %d %d %d %d %d %d %d\n", dbg_itd()
279 #define dbg_status(fusbh200, label, status) { \
282 fusbh200_dbg (fusbh200, "%s\n", _buf); \
285 #define dbg_cmd(fusbh200, label, command) { \
288 fusbh200_dbg (fusbh200, "%s\n", _buf); \
291 #define dbg_port(fusbh200, label, port, status) { \
294 fusbh200_dbg (fusbh200, "%s\n", _buf); \
350 static inline char token_mark(struct fusbh200_hcd *fusbh200, __hc32 token) token_mark() argument
352 __u32 v = hc32_to_cpu(fusbh200, token); token_mark()
365 struct fusbh200_hcd *fusbh200, qh_lines()
378 __le32 list_end = FUSBH200_LIST_END(fusbh200); qh_lines()
384 mark = token_mark(fusbh200, hw->hw_token); qh_lines()
386 if ((hw->hw_alt_next & QTD_MASK(fusbh200)) qh_lines()
387 == fusbh200->async->hw->hw_alt_next) qh_lines()
393 scratch = hc32_to_cpup(fusbh200, &hw->hw_info1); qh_lines()
394 hw_curr = (mark == '*') ? hc32_to_cpup(fusbh200, &hw->hw_current) : 0; qh_lines()
400 scratch, hc32_to_cpup(fusbh200, &hw->hw_info2), qh_lines()
401 hc32_to_cpup(fusbh200, &hw->hw_token), mark, qh_lines()
402 (cpu_to_hc32(fusbh200, QTD_TOGGLE) & hw->hw_token) qh_lines()
404 (hc32_to_cpup(fusbh200, &hw->hw_alt_next) >> 1) & 0x0f); qh_lines()
410 scratch = hc32_to_cpup(fusbh200, &td->hw_token); qh_lines()
414 else if (hw->hw_qtd_next == cpu_to_hc32(fusbh200, td->qtd_dma)) qh_lines()
417 if (td->hw_alt_next == fusbh200->async->hw->hw_alt_next) qh_lines()
456 struct fusbh200_hcd *fusbh200; fill_async_buffer() local
463 fusbh200 = hcd_to_fusbh200 (hcd); fill_async_buffer()
473 spin_lock_irqsave (&fusbh200->lock, flags); fill_async_buffer()
474 for (qh = fusbh200->async->qh_next.qh; size > 0 && qh; qh = qh->qh_next.qh) fill_async_buffer()
475 qh_lines (fusbh200, qh, &next, &size); fill_async_buffer()
476 if (fusbh200->async_unlink && size > 0) { fill_async_buffer()
481 for (qh = fusbh200->async_unlink; size > 0 && qh; fill_async_buffer()
483 qh_lines (fusbh200, qh, &next, &size); fill_async_buffer()
485 spin_unlock_irqrestore (&fusbh200->lock, flags); fill_async_buffer()
494 struct fusbh200_hcd *fusbh200; fill_periodic_buffer() local
507 fusbh200 = hcd_to_fusbh200 (hcd); fill_periodic_buffer()
511 temp = scnprintf (next, size, "size = %d\n", fusbh200->periodic_size); fill_periodic_buffer()
518 spin_lock_irqsave (&fusbh200->lock, flags); fill_periodic_buffer()
519 for (i = 0; i < fusbh200->periodic_size; i++) { fill_periodic_buffer()
520 p = fusbh200->pshadow [i]; fill_periodic_buffer()
523 tag = Q_NEXT_TYPE(fusbh200, fusbh200->periodic [i]); fill_periodic_buffer()
532 switch (hc32_to_cpu(fusbh200, tag)) { fill_periodic_buffer()
537 hc32_to_cpup(fusbh200, fill_periodic_buffer()
558 u32 scratch = hc32_to_cpup(fusbh200, fill_periodic_buffer()
570 fusbh200, fill_periodic_buffer()
591 tag = Q_NEXT_TYPE(fusbh200, hw->hw_next); fill_periodic_buffer()
598 tag = Q_NEXT_TYPE(fusbh200, p.fstn->hw_next); fill_periodic_buffer()
604 tag = Q_NEXT_TYPE(fusbh200, p.itd->hw_next); fill_periodic_buffer()
616 spin_unlock_irqrestore (&fusbh200->lock, flags); fill_periodic_buffer()
623 static const char *rh_state_string(struct fusbh200_hcd *fusbh200) rh_state_string() argument
625 switch (fusbh200->rh_state) { rh_state_string()
641 struct fusbh200_hcd *fusbh200; fill_registers_buffer() local
649 fusbh200 = hcd_to_fusbh200 (hcd); fill_registers_buffer()
653 spin_lock_irqsave (&fusbh200->lock, flags); fill_registers_buffer()
667 i = HC_VERSION(fusbh200, fusbh200_readl(fusbh200, &fusbh200->caps->hc_capbase)); fill_registers_buffer()
675 i >> 8, i & 0x0ff, rh_state_string(fusbh200)); fill_registers_buffer()
680 i = fusbh200_readl(fusbh200, &fusbh200->caps->hcs_params); fill_registers_buffer()
685 i = fusbh200_readl(fusbh200, &fusbh200->caps->hcc_params); fill_registers_buffer()
692 fusbh200_readl(fusbh200, &fusbh200->regs->status)); fill_registers_buffer()
698 fusbh200_readl(fusbh200, &fusbh200->regs->command)); fill_registers_buffer()
704 fusbh200_readl(fusbh200, &fusbh200->regs->intr_enable)); fill_registers_buffer()
710 fusbh200_read_frame_index(fusbh200)); fill_registers_buffer()
714 if (fusbh200->async_unlink) { fill_registers_buffer()
716 fusbh200->async_unlink); fill_registers_buffer()
723 fusbh200->stats.normal, fusbh200->stats.error, fusbh200->stats.iaa, fill_registers_buffer()
724 fusbh200->stats.lost_iaa); fill_registers_buffer()
729 fusbh200->stats.complete, fusbh200->stats.unlink); fill_registers_buffer()
734 spin_unlock_irqrestore (&fusbh200->lock, flags); fill_registers_buffer()
841 static inline void create_debug_files (struct fusbh200_hcd *fusbh200) create_debug_files() argument
843 struct usb_bus *bus = &fusbh200_to_hcd(fusbh200)->self; create_debug_files()
845 fusbh200->debug_dir = debugfs_create_dir(bus->bus_name, fusbh200_debug_root); create_debug_files()
846 if (!fusbh200->debug_dir) create_debug_files()
849 if (!debugfs_create_file("async", S_IRUGO, fusbh200->debug_dir, bus, create_debug_files()
853 if (!debugfs_create_file("periodic", S_IRUGO, fusbh200->debug_dir, bus, create_debug_files()
857 if (!debugfs_create_file("registers", S_IRUGO, fusbh200->debug_dir, bus, create_debug_files()
864 debugfs_remove_recursive(fusbh200->debug_dir); create_debug_files()
867 static inline void remove_debug_files (struct fusbh200_hcd *fusbh200) remove_debug_files() argument
869 debugfs_remove_recursive(fusbh200->debug_dir); remove_debug_files()
891 static int handshake (struct fusbh200_hcd *fusbh200, void __iomem *ptr, handshake() argument
897 result = fusbh200_readl(fusbh200, ptr); handshake()
913 static int fusbh200_halt (struct fusbh200_hcd *fusbh200) fusbh200_halt() argument
917 spin_lock_irq(&fusbh200->lock); fusbh200_halt()
920 fusbh200_writel(fusbh200, 0, &fusbh200->regs->intr_enable); fusbh200_halt()
923 * This routine gets called during probe before fusbh200->command fusbh200_halt()
926 fusbh200->command &= ~CMD_RUN; fusbh200_halt()
927 temp = fusbh200_readl(fusbh200, &fusbh200->regs->command); fusbh200_halt()
929 fusbh200_writel(fusbh200, temp, &fusbh200->regs->command); fusbh200_halt()
931 spin_unlock_irq(&fusbh200->lock); fusbh200_halt()
932 synchronize_irq(fusbh200_to_hcd(fusbh200)->irq); fusbh200_halt()
934 return handshake(fusbh200, &fusbh200->regs->status, fusbh200_halt()
942 static int fusbh200_reset (struct fusbh200_hcd *fusbh200) fusbh200_reset() argument
945 u32 command = fusbh200_readl(fusbh200, &fusbh200->regs->command); fusbh200_reset()
949 if (fusbh200->debug && !dbgp_reset_prep(fusbh200_to_hcd(fusbh200))) fusbh200_reset()
950 fusbh200->debug = NULL; fusbh200_reset()
953 dbg_cmd (fusbh200, "reset", command); fusbh200_reset()
954 fusbh200_writel(fusbh200, command, &fusbh200->regs->command); fusbh200_reset()
955 fusbh200->rh_state = FUSBH200_RH_HALTED; fusbh200_reset()
956 fusbh200->next_statechange = jiffies; fusbh200_reset()
957 retval = handshake (fusbh200, &fusbh200->regs->command, fusbh200_reset()
963 if (fusbh200->debug) fusbh200_reset()
964 dbgp_external_startup(fusbh200_to_hcd(fusbh200)); fusbh200_reset()
966 fusbh200->port_c_suspend = fusbh200->suspended_ports = fusbh200_reset()
967 fusbh200->resuming_ports = 0; fusbh200_reset()
975 static void fusbh200_quiesce (struct fusbh200_hcd *fusbh200) fusbh200_quiesce() argument
979 if (fusbh200->rh_state != FUSBH200_RH_RUNNING) fusbh200_quiesce()
983 temp = (fusbh200->command << 10) & (STS_ASS | STS_PSS); fusbh200_quiesce()
984 handshake(fusbh200, &fusbh200->regs->status, STS_ASS | STS_PSS, temp, 16 * 125); fusbh200_quiesce()
987 spin_lock_irq(&fusbh200->lock); fusbh200_quiesce()
988 fusbh200->command &= ~(CMD_ASE | CMD_PSE); fusbh200_quiesce()
989 fusbh200_writel(fusbh200, fusbh200->command, &fusbh200->regs->command); fusbh200_quiesce()
990 spin_unlock_irq(&fusbh200->lock); fusbh200_quiesce()
993 handshake(fusbh200, &fusbh200->regs->status, STS_ASS | STS_PSS, 0, 16 * 125); fusbh200_quiesce()
998 static void end_unlink_async(struct fusbh200_hcd *fusbh200);
999 static void unlink_empty_async(struct fusbh200_hcd *fusbh200);
1000 static void fusbh200_work(struct fusbh200_hcd *fusbh200);
1001 static void start_unlink_intr(struct fusbh200_hcd *fusbh200, struct fusbh200_qh *qh);
1002 static void end_unlink_intr(struct fusbh200_hcd *fusbh200, struct fusbh200_qh *qh);
1007 static void fusbh200_set_command_bit(struct fusbh200_hcd *fusbh200, u32 bit) fusbh200_set_command_bit() argument
1009 fusbh200->command |= bit; fusbh200_set_command_bit()
1010 fusbh200_writel(fusbh200, fusbh200->command, &fusbh200->regs->command); fusbh200_set_command_bit()
1013 fusbh200_readl(fusbh200, &fusbh200->regs->command); fusbh200_set_command_bit()
1017 static void fusbh200_clear_command_bit(struct fusbh200_hcd *fusbh200, u32 bit) fusbh200_clear_command_bit() argument
1019 fusbh200->command &= ~bit; fusbh200_clear_command_bit()
1020 fusbh200_writel(fusbh200, fusbh200->command, &fusbh200->regs->command); fusbh200_clear_command_bit()
1023 fusbh200_readl(fusbh200, &fusbh200->regs->command); fusbh200_clear_command_bit()
1031 * Lots of different events are triggered from fusbh200->hrtimer. Whenever
1035 * fusbh200->enabled_hrtimer_events, and they are numbered in order of
1040 * fusbh200->next_hrtimer_event. Whenever fusbh200->hrtimer gets restarted, its
1054 * the event types indexed by enum fusbh200_hrtimer_event in fusbh200.h.
1070 static void fusbh200_enable_event(struct fusbh200_hcd *fusbh200, unsigned event, fusbh200_enable_event() argument
1073 ktime_t *timeout = &fusbh200->hr_timeouts[event]; fusbh200_enable_event()
1078 fusbh200->enabled_hrtimer_events |= (1 << event); fusbh200_enable_event()
1081 if (event < fusbh200->next_hrtimer_event) { fusbh200_enable_event()
1082 fusbh200->next_hrtimer_event = event; fusbh200_enable_event()
1083 hrtimer_start_range_ns(&fusbh200->hrtimer, *timeout, fusbh200_enable_event()
1090 static void fusbh200_poll_ASS(struct fusbh200_hcd *fusbh200) fusbh200_poll_ASS() argument
1095 if (fusbh200->rh_state != FUSBH200_RH_RUNNING) fusbh200_poll_ASS()
1098 want = (fusbh200->command & CMD_ASE) ? STS_ASS : 0; fusbh200_poll_ASS()
1099 actual = fusbh200_readl(fusbh200, &fusbh200->regs->status) & STS_ASS; fusbh200_poll_ASS()
1104 if (fusbh200->ASS_poll_count++ < 20) { fusbh200_poll_ASS()
1105 fusbh200_enable_event(fusbh200, FUSBH200_HRTIMER_POLL_ASS, true); fusbh200_poll_ASS()
1108 fusbh200_dbg(fusbh200, "Waited too long for the async schedule status (%x/%x), giving up\n", fusbh200_poll_ASS()
1111 fusbh200->ASS_poll_count = 0; fusbh200_poll_ASS()
1115 if (fusbh200->async_count > 0) fusbh200_poll_ASS()
1116 fusbh200_set_command_bit(fusbh200, CMD_ASE); fusbh200_poll_ASS()
1119 if (fusbh200->async_count == 0) { fusbh200_poll_ASS()
1122 fusbh200_enable_event(fusbh200, FUSBH200_HRTIMER_DISABLE_ASYNC, fusbh200_poll_ASS()
1129 static void fusbh200_disable_ASE(struct fusbh200_hcd *fusbh200) fusbh200_disable_ASE() argument
1131 fusbh200_clear_command_bit(fusbh200, CMD_ASE); fusbh200_disable_ASE()
1136 static void fusbh200_poll_PSS(struct fusbh200_hcd *fusbh200) fusbh200_poll_PSS() argument
1141 if (fusbh200->rh_state != FUSBH200_RH_RUNNING) fusbh200_poll_PSS()
1144 want = (fusbh200->command & CMD_PSE) ? STS_PSS : 0; fusbh200_poll_PSS()
1145 actual = fusbh200_readl(fusbh200, &fusbh200->regs->status) & STS_PSS; fusbh200_poll_PSS()
1150 if (fusbh200->PSS_poll_count++ < 20) { fusbh200_poll_PSS()
1151 fusbh200_enable_event(fusbh200, FUSBH200_HRTIMER_POLL_PSS, true); fusbh200_poll_PSS()
1154 fusbh200_dbg(fusbh200, "Waited too long for the periodic schedule status (%x/%x), giving up\n", fusbh200_poll_PSS()
1157 fusbh200->PSS_poll_count = 0; fusbh200_poll_PSS()
1161 if (fusbh200->periodic_count > 0) fusbh200_poll_PSS()
1162 fusbh200_set_command_bit(fusbh200, CMD_PSE); fusbh200_poll_PSS()
1165 if (fusbh200->periodic_count == 0) { fusbh200_poll_PSS()
1168 fusbh200_enable_event(fusbh200, FUSBH200_HRTIMER_DISABLE_PERIODIC, fusbh200_poll_PSS()
1175 static void fusbh200_disable_PSE(struct fusbh200_hcd *fusbh200) fusbh200_disable_PSE() argument
1177 fusbh200_clear_command_bit(fusbh200, CMD_PSE); fusbh200_disable_PSE()
1182 static void fusbh200_handle_controller_death(struct fusbh200_hcd *fusbh200) fusbh200_handle_controller_death() argument
1184 if (!(fusbh200_readl(fusbh200, &fusbh200->regs->status) & STS_HALT)) { fusbh200_handle_controller_death()
1187 if (fusbh200->died_poll_count++ < 5) { fusbh200_handle_controller_death()
1189 fusbh200_enable_event(fusbh200, FUSBH200_HRTIMER_POLL_DEAD, true); fusbh200_handle_controller_death()
1192 fusbh200_warn(fusbh200, "Waited too long for the controller to stop, giving up\n"); fusbh200_handle_controller_death()
1196 fusbh200->rh_state = FUSBH200_RH_HALTED; fusbh200_handle_controller_death()
1197 fusbh200_writel(fusbh200, 0, &fusbh200->regs->intr_enable); fusbh200_handle_controller_death()
1198 fusbh200_work(fusbh200); fusbh200_handle_controller_death()
1199 end_unlink_async(fusbh200); fusbh200_handle_controller_death()
1206 static void fusbh200_handle_intr_unlinks(struct fusbh200_hcd *fusbh200) fusbh200_handle_intr_unlinks() argument
1208 bool stopped = (fusbh200->rh_state < FUSBH200_RH_RUNNING); fusbh200_handle_intr_unlinks()
1217 fusbh200->intr_unlinking = true; fusbh200_handle_intr_unlinks()
1218 while (fusbh200->intr_unlink) { fusbh200_handle_intr_unlinks()
1219 struct fusbh200_qh *qh = fusbh200->intr_unlink; fusbh200_handle_intr_unlinks()
1221 if (!stopped && qh->unlink_cycle == fusbh200->intr_unlink_cycle) fusbh200_handle_intr_unlinks()
1223 fusbh200->intr_unlink = qh->unlink_next; fusbh200_handle_intr_unlinks()
1225 end_unlink_intr(fusbh200, qh); fusbh200_handle_intr_unlinks()
1229 if (fusbh200->intr_unlink) { fusbh200_handle_intr_unlinks()
1230 fusbh200_enable_event(fusbh200, FUSBH200_HRTIMER_UNLINK_INTR, true); fusbh200_handle_intr_unlinks()
1231 ++fusbh200->intr_unlink_cycle; fusbh200_handle_intr_unlinks()
1233 fusbh200->intr_unlinking = false; fusbh200_handle_intr_unlinks()
1238 static void start_free_itds(struct fusbh200_hcd *fusbh200) start_free_itds() argument
1240 if (!(fusbh200->enabled_hrtimer_events & BIT(FUSBH200_HRTIMER_FREE_ITDS))) { start_free_itds()
1241 fusbh200->last_itd_to_free = list_entry( start_free_itds()
1242 fusbh200->cached_itd_list.prev, start_free_itds()
1244 fusbh200_enable_event(fusbh200, FUSBH200_HRTIMER_FREE_ITDS, true); start_free_itds()
1249 static void end_free_itds(struct fusbh200_hcd *fusbh200) end_free_itds() argument
1253 if (fusbh200->rh_state < FUSBH200_RH_RUNNING) { end_free_itds()
1254 fusbh200->last_itd_to_free = NULL; end_free_itds()
1257 list_for_each_entry_safe(itd, n, &fusbh200->cached_itd_list, itd_list) { end_free_itds()
1259 dma_pool_free(fusbh200->itd_pool, itd, itd->itd_dma); end_free_itds()
1260 if (itd == fusbh200->last_itd_to_free) end_free_itds()
1264 if (!list_empty(&fusbh200->cached_itd_list)) end_free_itds()
1265 start_free_itds(fusbh200); end_free_itds()
1270 static void fusbh200_iaa_watchdog(struct fusbh200_hcd *fusbh200) fusbh200_iaa_watchdog() argument
1272 if (fusbh200->rh_state != FUSBH200_RH_RUNNING) fusbh200_iaa_watchdog()
1281 if (fusbh200->async_iaa) { fusbh200_iaa_watchdog()
1290 cmd = fusbh200_readl(fusbh200, &fusbh200->regs->command); fusbh200_iaa_watchdog()
1299 status = fusbh200_readl(fusbh200, &fusbh200->regs->status); fusbh200_iaa_watchdog()
1301 COUNT(fusbh200->stats.lost_iaa); fusbh200_iaa_watchdog()
1302 fusbh200_writel(fusbh200, STS_IAA, &fusbh200->regs->status); fusbh200_iaa_watchdog()
1305 fusbh200_dbg(fusbh200, "IAA watchdog: status %x cmd %x\n", fusbh200_iaa_watchdog()
1307 end_unlink_async(fusbh200); fusbh200_iaa_watchdog()
1313 static void turn_on_io_watchdog(struct fusbh200_hcd *fusbh200) turn_on_io_watchdog() argument
1316 if (fusbh200->rh_state != FUSBH200_RH_RUNNING || turn_on_io_watchdog()
1317 (fusbh200->enabled_hrtimer_events & turn_on_io_watchdog()
1325 if (fusbh200->isoc_count > 0 || (fusbh200->need_io_watchdog && turn_on_io_watchdog()
1326 fusbh200->async_count + fusbh200->intr_count > 0)) turn_on_io_watchdog()
1327 fusbh200_enable_event(fusbh200, FUSBH200_HRTIMER_IO_WATCHDOG, true); turn_on_io_watchdog()
1334 * enum fusbh200_hrtimer_event in fusbh200.h.
1351 struct fusbh200_hcd *fusbh200 = container_of(t, struct fusbh200_hcd, hrtimer); fusbh200_hrtimer_func() local
1357 spin_lock_irqsave(&fusbh200->lock, flags); fusbh200_hrtimer_func()
1359 events = fusbh200->enabled_hrtimer_events; fusbh200_hrtimer_func()
1360 fusbh200->enabled_hrtimer_events = 0; fusbh200_hrtimer_func()
1361 fusbh200->next_hrtimer_event = FUSBH200_HRTIMER_NO_EVENT; fusbh200_hrtimer_func()
1369 if (now.tv64 >= fusbh200->hr_timeouts[e].tv64) fusbh200_hrtimer_func()
1370 event_handlers[e](fusbh200); fusbh200_hrtimer_func()
1372 fusbh200_enable_event(fusbh200, e, false); fusbh200_hrtimer_func()
1375 spin_unlock_irqrestore(&fusbh200->lock, flags); fusbh200_hrtimer_func()
1387 struct fusbh200_hcd *fusbh200, check_reset_complete()
1398 fusbh200_dbg (fusbh200, check_reset_complete()
1403 fusbh200_dbg(fusbh200, "port %d reset complete, port enabled\n", check_reset_complete()
1418 struct fusbh200_hcd *fusbh200 = hcd_to_fusbh200 (hcd); fusbh200_hub_status_data() local
1430 status = fusbh200->resuming_ports; fusbh200_hub_status_data()
1438 spin_lock_irqsave (&fusbh200->lock, flags); fusbh200_hub_status_data()
1440 temp = fusbh200_readl(fusbh200, &fusbh200->regs->port_status); fusbh200_hub_status_data()
1449 if ((temp & mask) != 0 || test_bit(0, &fusbh200->port_c_suspend) fusbh200_hub_status_data()
1450 || (fusbh200->reset_done[0] && time_after_eq( fusbh200_hub_status_data()
1451 jiffies, fusbh200->reset_done[0]))) { fusbh200_hub_status_data()
1456 spin_unlock_irqrestore (&fusbh200->lock, flags); fusbh200_hub_status_data()
1464 struct fusbh200_hcd *fusbh200, fusbh200_hub_descriptor()
1467 int ports = HCS_N_PORTS (fusbh200->hcs_params); fusbh200_hub_descriptor()
1471 desc->bPwrOn2PwrGood = 10; /* fusbh200 1.0, 2.3.9 says 20ms max */ fusbh200_hub_descriptor()
1497 struct fusbh200_hcd *fusbh200 = hcd_to_fusbh200 (hcd); fusbh200_hub_control() local
1498 int ports = HCS_N_PORTS (fusbh200->hcs_params); fusbh200_hub_control()
1499 u32 __iomem *status_reg = &fusbh200->regs->port_status; fusbh200_hub_control()
1512 spin_lock_irqsave (&fusbh200->lock, flags); fusbh200_hub_control()
1528 temp = fusbh200_readl(fusbh200, status_reg); fusbh200_hub_control()
1540 fusbh200_writel(fusbh200, temp & ~PORT_PE, status_reg); fusbh200_hub_control()
1543 fusbh200_writel(fusbh200, temp | PORT_PEC, status_reg); fusbh200_hub_control()
1553 fusbh200_writel(fusbh200, temp | PORT_RESUME, status_reg); fusbh200_hub_control()
1554 fusbh200->reset_done[wIndex] = jiffies fusbh200_hub_control()
1558 clear_bit(wIndex, &fusbh200->port_c_suspend); fusbh200_hub_control()
1561 fusbh200_writel(fusbh200, temp | PORT_CSC, status_reg); fusbh200_hub_control()
1564 fusbh200_writel(fusbh200, temp | BMISR_OVC, &fusbh200->regs->bmisr); fusbh200_hub_control()
1572 fusbh200_readl(fusbh200, &fusbh200->regs->command); /* unblock posted write */ fusbh200_hub_control()
1575 fusbh200_hub_descriptor (fusbh200, (struct usb_hub_descriptor *) fusbh200_hub_control()
1588 temp = fusbh200_readl(fusbh200, status_reg); fusbh200_hub_control()
1596 temp1 = fusbh200_readl(fusbh200, &fusbh200->regs->bmisr); fusbh200_hub_control()
1604 if (!fusbh200->reset_done[wIndex]) { fusbh200_hub_control()
1606 fusbh200->reset_done[wIndex] = jiffies fusbh200_hub_control()
1609 mod_timer(&fusbh200_to_hcd(fusbh200)->rh_timer, fusbh200_hub_control()
1610 fusbh200->reset_done[wIndex]); fusbh200_hub_control()
1615 fusbh200->reset_done[wIndex])) { fusbh200_hub_control()
1616 clear_bit(wIndex, &fusbh200->suspended_ports); fusbh200_hub_control()
1617 set_bit(wIndex, &fusbh200->port_c_suspend); fusbh200_hub_control()
1618 fusbh200->reset_done[wIndex] = 0; fusbh200_hub_control()
1621 temp = fusbh200_readl(fusbh200, status_reg); fusbh200_hub_control()
1622 fusbh200_writel(fusbh200, fusbh200_hub_control()
1625 clear_bit(wIndex, &fusbh200->resuming_ports); fusbh200_hub_control()
1626 retval = handshake(fusbh200, status_reg, fusbh200_hub_control()
1629 fusbh200_err(fusbh200, fusbh200_hub_control()
1641 fusbh200->reset_done[wIndex])) { fusbh200_hub_control()
1643 fusbh200->reset_done [wIndex] = 0; fusbh200_hub_control()
1644 clear_bit(wIndex, &fusbh200->resuming_ports); fusbh200_hub_control()
1647 fusbh200_writel(fusbh200, temp & ~(PORT_RWC_BITS | PORT_RESET), fusbh200_hub_control()
1652 retval = handshake(fusbh200, status_reg, fusbh200_hub_control()
1655 fusbh200_err (fusbh200, "port %d reset error %d\n", fusbh200_hub_control()
1661 temp = check_reset_complete (fusbh200, wIndex, status_reg, fusbh200_hub_control()
1662 fusbh200_readl(fusbh200, status_reg)); fusbh200_hub_control()
1666 fusbh200->reset_done[wIndex] = 0; fusbh200_hub_control()
1667 clear_bit(wIndex, &fusbh200->resuming_ports); fusbh200_hub_control()
1672 test_bit(wIndex, &fusbh200->companion_ports)) { fusbh200_hub_control()
1674 fusbh200_writel(fusbh200, temp, status_reg); fusbh200_hub_control()
1675 fusbh200_dbg(fusbh200, "port %d --> companion\n", wIndex + 1); fusbh200_hub_control()
1676 temp = fusbh200_readl(fusbh200, status_reg); fusbh200_hub_control()
1687 status |= fusbh200_port_speed(fusbh200, temp); fusbh200_hub_control()
1695 } else if (test_bit(wIndex, &fusbh200->suspended_ports)) { fusbh200_hub_control()
1696 clear_bit(wIndex, &fusbh200->suspended_ports); fusbh200_hub_control()
1697 clear_bit(wIndex, &fusbh200->resuming_ports); fusbh200_hub_control()
1698 fusbh200->reset_done[wIndex] = 0; fusbh200_hub_control()
1700 set_bit(wIndex, &fusbh200->port_c_suspend); fusbh200_hub_control()
1703 temp1 = fusbh200_readl(fusbh200, &fusbh200->regs->bmisr); fusbh200_hub_control()
1708 if (test_bit(wIndex, &fusbh200->port_c_suspend)) fusbh200_hub_control()
1712 dbg_port(fusbh200, "GetStatus", wIndex + 1, temp); fusbh200_hub_control()
1732 temp = fusbh200_readl(fusbh200, status_reg); fusbh200_hub_control()
1744 fusbh200_writel(fusbh200, temp | PORT_SUSPEND, status_reg); fusbh200_hub_control()
1745 set_bit(wIndex, &fusbh200->suspended_ports); fusbh200_hub_control()
1754 fusbh200_dbg(fusbh200, "port %d reset\n", wIndex + 1); fusbh200_hub_control()
1762 fusbh200->reset_done [wIndex] = jiffies fusbh200_hub_control()
1764 fusbh200_writel(fusbh200, temp, status_reg); fusbh200_hub_control()
1776 spin_unlock_irqrestore(&fusbh200->lock, flags); fusbh200_hub_control()
1777 fusbh200_quiesce(fusbh200); fusbh200_hub_control()
1778 spin_lock_irqsave(&fusbh200->lock, flags); fusbh200_hub_control()
1781 temp = fusbh200_readl(fusbh200, status_reg) & ~PORT_RWC_BITS; fusbh200_hub_control()
1783 fusbh200_writel(fusbh200, temp | PORT_SUSPEND, fusbh200_hub_control()
1786 spin_unlock_irqrestore(&fusbh200->lock, flags); fusbh200_hub_control()
1787 fusbh200_halt(fusbh200); fusbh200_hub_control()
1788 spin_lock_irqsave(&fusbh200->lock, flags); fusbh200_hub_control()
1790 temp = fusbh200_readl(fusbh200, status_reg); fusbh200_hub_control()
1792 fusbh200_writel(fusbh200, temp, status_reg); fusbh200_hub_control()
1798 fusbh200_readl(fusbh200, &fusbh200->regs->command); /* unblock posted writes */ fusbh200_hub_control()
1806 spin_unlock_irqrestore (&fusbh200->lock, flags); fusbh200_hub_control()
1837 static inline void fusbh200_qtd_init(struct fusbh200_hcd *fusbh200, struct fusbh200_qtd *qtd, fusbh200_qtd_init() argument
1842 qtd->hw_token = cpu_to_hc32(fusbh200, QTD_STS_HALT); fusbh200_qtd_init()
1843 qtd->hw_next = FUSBH200_LIST_END(fusbh200); fusbh200_qtd_init()
1844 qtd->hw_alt_next = FUSBH200_LIST_END(fusbh200); fusbh200_qtd_init()
1848 static struct fusbh200_qtd *fusbh200_qtd_alloc (struct fusbh200_hcd *fusbh200, gfp_t flags) fusbh200_qtd_alloc() argument
1853 qtd = dma_pool_alloc (fusbh200->qtd_pool, flags, &dma); fusbh200_qtd_alloc()
1855 fusbh200_qtd_init(fusbh200, qtd, dma); fusbh200_qtd_alloc()
1860 static inline void fusbh200_qtd_free (struct fusbh200_hcd *fusbh200, struct fusbh200_qtd *qtd) fusbh200_qtd_free() argument
1862 dma_pool_free (fusbh200->qtd_pool, qtd, qtd->qtd_dma); fusbh200_qtd_free()
1866 static void qh_destroy(struct fusbh200_hcd *fusbh200, struct fusbh200_qh *qh) qh_destroy() argument
1870 fusbh200_dbg (fusbh200, "unused qh not empty!\n"); qh_destroy()
1874 fusbh200_qtd_free (fusbh200, qh->dummy); qh_destroy()
1875 dma_pool_free(fusbh200->qh_pool, qh->hw, qh->qh_dma); qh_destroy()
1879 static struct fusbh200_qh *fusbh200_qh_alloc (struct fusbh200_hcd *fusbh200, gfp_t flags) fusbh200_qh_alloc() argument
1888 dma_pool_alloc(fusbh200->qh_pool, flags, &dma); fusbh200_qh_alloc()
1897 qh->dummy = fusbh200_qtd_alloc (fusbh200, flags); fusbh200_qh_alloc()
1899 fusbh200_dbg (fusbh200, "no dummy td\n"); fusbh200_qh_alloc()
1905 dma_pool_free(fusbh200->qh_pool, qh->hw, qh->qh_dma); fusbh200_qh_alloc()
1918 static void fusbh200_mem_cleanup (struct fusbh200_hcd *fusbh200) fusbh200_mem_cleanup() argument
1920 if (fusbh200->async) fusbh200_mem_cleanup()
1921 qh_destroy(fusbh200, fusbh200->async); fusbh200_mem_cleanup()
1922 fusbh200->async = NULL; fusbh200_mem_cleanup()
1924 if (fusbh200->dummy) fusbh200_mem_cleanup()
1925 qh_destroy(fusbh200, fusbh200->dummy); fusbh200_mem_cleanup()
1926 fusbh200->dummy = NULL; fusbh200_mem_cleanup()
1929 if (fusbh200->qtd_pool) fusbh200_mem_cleanup()
1930 dma_pool_destroy (fusbh200->qtd_pool); fusbh200_mem_cleanup()
1931 fusbh200->qtd_pool = NULL; fusbh200_mem_cleanup()
1933 if (fusbh200->qh_pool) { fusbh200_mem_cleanup()
1934 dma_pool_destroy (fusbh200->qh_pool); fusbh200_mem_cleanup()
1935 fusbh200->qh_pool = NULL; fusbh200_mem_cleanup()
1938 if (fusbh200->itd_pool) fusbh200_mem_cleanup()
1939 dma_pool_destroy (fusbh200->itd_pool); fusbh200_mem_cleanup()
1940 fusbh200->itd_pool = NULL; fusbh200_mem_cleanup()
1942 if (fusbh200->periodic) fusbh200_mem_cleanup()
1943 dma_free_coherent (fusbh200_to_hcd(fusbh200)->self.controller, fusbh200_mem_cleanup()
1944 fusbh200->periodic_size * sizeof (u32), fusbh200_mem_cleanup()
1945 fusbh200->periodic, fusbh200->periodic_dma); fusbh200_mem_cleanup()
1946 fusbh200->periodic = NULL; fusbh200_mem_cleanup()
1949 kfree(fusbh200->pshadow); fusbh200_mem_cleanup()
1950 fusbh200->pshadow = NULL; fusbh200_mem_cleanup()
1954 static int fusbh200_mem_init (struct fusbh200_hcd *fusbh200, gfp_t flags) fusbh200_mem_init() argument
1959 fusbh200->qtd_pool = dma_pool_create ("fusbh200_qtd", fusbh200_mem_init()
1960 fusbh200_to_hcd(fusbh200)->self.controller, fusbh200_mem_init()
1964 if (!fusbh200->qtd_pool) { fusbh200_mem_init()
1969 fusbh200->qh_pool = dma_pool_create ("fusbh200_qh", fusbh200_mem_init()
1970 fusbh200_to_hcd(fusbh200)->self.controller, fusbh200_mem_init()
1974 if (!fusbh200->qh_pool) { fusbh200_mem_init()
1977 fusbh200->async = fusbh200_qh_alloc (fusbh200, flags); fusbh200_mem_init()
1978 if (!fusbh200->async) { fusbh200_mem_init()
1983 fusbh200->itd_pool = dma_pool_create ("fusbh200_itd", fusbh200_mem_init()
1984 fusbh200_to_hcd(fusbh200)->self.controller, fusbh200_mem_init()
1988 if (!fusbh200->itd_pool) { fusbh200_mem_init()
1993 fusbh200->periodic = (__le32 *) fusbh200_mem_init()
1994 dma_alloc_coherent (fusbh200_to_hcd(fusbh200)->self.controller, fusbh200_mem_init()
1995 fusbh200->periodic_size * sizeof(__le32), fusbh200_mem_init()
1996 &fusbh200->periodic_dma, 0); fusbh200_mem_init()
1997 if (fusbh200->periodic == NULL) { fusbh200_mem_init()
2001 for (i = 0; i < fusbh200->periodic_size; i++) fusbh200_mem_init()
2002 fusbh200->periodic[i] = FUSBH200_LIST_END(fusbh200); fusbh200_mem_init()
2005 fusbh200->pshadow = kcalloc(fusbh200->periodic_size, sizeof(void *), flags); fusbh200_mem_init()
2006 if (fusbh200->pshadow != NULL) fusbh200_mem_init()
2010 fusbh200_dbg (fusbh200, "couldn't init memory\n"); fusbh200_mem_init()
2011 fusbh200_mem_cleanup (fusbh200); fusbh200_mem_init()
2038 qtd_fill(struct fusbh200_hcd *fusbh200, struct fusbh200_qtd *qtd, dma_addr_t buf, qtd_fill() argument
2045 qtd->hw_buf[0] = cpu_to_hc32(fusbh200, (u32)addr); qtd_fill()
2046 qtd->hw_buf_hi[0] = cpu_to_hc32(fusbh200, (u32)(addr >> 32)); qtd_fill()
2057 qtd->hw_buf[i] = cpu_to_hc32(fusbh200, (u32)addr); qtd_fill()
2058 qtd->hw_buf_hi[i] = cpu_to_hc32(fusbh200, qtd_fill()
2071 qtd->hw_token = cpu_to_hc32(fusbh200, (count << 16) | token); qtd_fill()
2080 qh_update (struct fusbh200_hcd *fusbh200, struct fusbh200_qh *qh, struct fusbh200_qtd *qtd) qh_update() argument
2087 hw->hw_qtd_next = QTD_NEXT(fusbh200, qtd->qtd_dma); qh_update()
2088 hw->hw_alt_next = FUSBH200_LIST_END(fusbh200); qh_update()
2095 if (!(hw->hw_info1 & cpu_to_hc32(fusbh200, QH_TOGGLE_CTL))) { qh_update()
2099 epnum = (hc32_to_cpup(fusbh200, &hw->hw_info1) >> 8) & 0x0f; qh_update()
2101 hw->hw_token &= ~cpu_to_hc32(fusbh200, QTD_TOGGLE); qh_update()
2106 hw->hw_token &= cpu_to_hc32(fusbh200, QTD_TOGGLE | QTD_STS_PING); qh_update()
2114 qh_refresh (struct fusbh200_hcd *fusbh200, struct fusbh200_qh *qh) qh_refresh() argument
2130 if (cpu_to_hc32(fusbh200, qtd->qtd_dma) == qh->hw->hw_current) { qh_refresh()
2137 qh_update (fusbh200, qh, qtd); qh_refresh()
2142 static void qh_link_async(struct fusbh200_hcd *fusbh200, struct fusbh200_qh *qh);
2147 struct fusbh200_hcd *fusbh200 = hcd_to_fusbh200(hcd); fusbh200_clear_tt_buffer_complete() local
2151 spin_lock_irqsave(&fusbh200->lock, flags); fusbh200_clear_tt_buffer_complete()
2154 && fusbh200->rh_state == FUSBH200_RH_RUNNING) fusbh200_clear_tt_buffer_complete()
2155 qh_link_async(fusbh200, qh); fusbh200_clear_tt_buffer_complete()
2156 spin_unlock_irqrestore(&fusbh200->lock, flags); fusbh200_clear_tt_buffer_complete()
2159 static void fusbh200_clear_tt_buffer(struct fusbh200_hcd *fusbh200, struct fusbh200_qh *qh, fusbh200_clear_tt_buffer() argument
2178 fusbh200_to_hcd(fusbh200)->self.root_hub) { fusbh200_clear_tt_buffer()
2186 struct fusbh200_hcd *fusbh200, qtd_copy_status()
2228 fusbh200_dbg(fusbh200, "devpath %s ep%d%s 3strikes\n", qtd_copy_status()
2237 fusbh200_dbg(fusbh200, qtd_copy_status()
2249 fusbh200_urb_done(struct fusbh200_hcd *fusbh200, struct urb *urb, int status)
2250 __releases(fusbh200->lock)
2251 __acquires(fusbh200->lock)
2257 if ((qh->hw->hw_info2 & cpu_to_hc32(fusbh200, QH_SMASK)) != 0) {
2260 fusbh200_to_hcd(fusbh200)->self.bandwidth_int_reqs--;
2265 COUNT(fusbh200->stats.unlink);
2270 COUNT(fusbh200->stats.complete);
2274 fusbh200_dbg (fusbh200,
2284 usb_hcd_unlink_urb_from_ep(fusbh200_to_hcd(fusbh200), urb);
2285 spin_unlock (&fusbh200->lock);
2286 usb_hcd_giveback_urb(fusbh200_to_hcd(fusbh200), urb, status);
2287 spin_lock (&fusbh200->lock);
2290 static int qh_schedule (struct fusbh200_hcd *fusbh200, struct fusbh200_qh *qh);
2298 qh_completions (struct fusbh200_hcd *fusbh200, struct fusbh200_qh *qh) qh_completions() argument
2346 fusbh200_urb_done(fusbh200, last->urb, last_status); qh_completions()
2350 fusbh200_qtd_free (fusbh200, last); qh_completions()
2360 token = hc32_to_cpu(fusbh200, qtd->hw_token); qh_completions()
2368 fusbh200_dbg(fusbh200, qh_completions()
2389 fusbh200_dbg(fusbh200, qh_completions()
2401 qtd->hw_token = cpu_to_hc32(fusbh200, qh_completions()
2404 hw->hw_token = cpu_to_hc32(fusbh200, qh_completions()
2421 & FUSBH200_LIST_END(fusbh200))) { qh_completions()
2427 && fusbh200->rh_state >= FUSBH200_RH_RUNNING)) { qh_completions()
2435 if (fusbh200->rh_state < FUSBH200_RH_RUNNING) qh_completions()
2446 && cpu_to_hc32(fusbh200, qtd->qtd_dma) qh_completions()
2448 token = hc32_to_cpu(fusbh200, hw->hw_token); qh_completions()
2454 fusbh200_clear_tt_buffer(fusbh200, qh, urb, token); qh_completions()
2466 last_status = qtd_copy_status(fusbh200, urb, qh_completions()
2470 & FUSBH200_LIST_END(fusbh200))) qh_completions()
2488 fusbh200_clear_tt_buffer(fusbh200, qh, urb, qh_completions()
2512 fusbh200_urb_done(fusbh200, last->urb, last_status); qh_completions()
2514 fusbh200_qtd_free (fusbh200, last); qh_completions()
2539 if (stopped != 0 || hw->hw_qtd_next == FUSBH200_LIST_END(fusbh200)) { qh_completions()
2542 qh_refresh(fusbh200, qh); qh_completions()
2579 struct fusbh200_hcd *fusbh200, qtd_list_free()
2590 fusbh200_qtd_free (fusbh200, qtd); list_for_each_safe()
2599 struct fusbh200_hcd *fusbh200, qh_urb_transaction()
2615 qtd = fusbh200_qtd_alloc (fusbh200, flags); qh_urb_transaction()
2629 qtd_fill(fusbh200, qtd, urb->setup_dma, qh_urb_transaction()
2636 qtd = fusbh200_qtd_alloc (fusbh200, flags); qh_urb_transaction()
2640 qtd_prev->hw_next = QTD_NEXT(fusbh200, qtd->qtd_dma); qh_urb_transaction()
2680 this_qtd_len = qtd_fill(fusbh200, qtd, buf, this_sg_len, token, qh_urb_transaction()
2692 qtd->hw_alt_next = fusbh200->async->hw->hw_alt_next; qh_urb_transaction()
2707 qtd = fusbh200_qtd_alloc (fusbh200, flags); qh_urb_transaction()
2711 qtd_prev->hw_next = QTD_NEXT(fusbh200, qtd->qtd_dma); qh_urb_transaction()
2722 qtd->hw_alt_next = FUSBH200_LIST_END(fusbh200); qh_urb_transaction()
2743 qtd = fusbh200_qtd_alloc (fusbh200, flags); qh_urb_transaction()
2747 qtd_prev->hw_next = QTD_NEXT(fusbh200, qtd->qtd_dma); qh_urb_transaction()
2751 qtd_fill(fusbh200, qtd, 0, 0, token, 0); qh_urb_transaction()
2757 qtd->hw_token |= cpu_to_hc32(fusbh200, QTD_IOC); qh_urb_transaction()
2761 qtd_list_free (fusbh200, urb, head); qh_urb_transaction()
2784 struct fusbh200_hcd *fusbh200, qh_make()
2788 struct fusbh200_qh *qh = fusbh200_qh_alloc (fusbh200, flags); qh_make()
2812 fusbh200_dbg(fusbh200, "bogus qh maxpacket %d\n", max_packet(maxp)); qh_make()
2841 } else if (qh->period > fusbh200->periodic_size) { qh_make()
2842 qh->period = fusbh200->periodic_size; qh_make()
2866 if (qh->period > fusbh200->periodic_size) { qh_make()
2867 qh->period = fusbh200->periodic_size; qh_make()
2897 if (fusbh200_has_fsl_portno_bug(fusbh200)) qh_make()
2905 if (tt && tt->hub != fusbh200_to_hcd(fusbh200)->self.root_hub) qh_make()
2935 fusbh200_dbg(fusbh200, "bogus dev %p speed %d\n", urb->dev, qh_make()
2938 qh_destroy(fusbh200, qh); qh_make()
2947 hw->hw_info1 = cpu_to_hc32(fusbh200, info1); qh_make()
2948 hw->hw_info2 = cpu_to_hc32(fusbh200, info2); qh_make()
2951 qh_refresh (fusbh200, qh); qh_make()
2957 static void enable_async(struct fusbh200_hcd *fusbh200) enable_async() argument
2959 if (fusbh200->async_count++) enable_async()
2963 fusbh200->enabled_hrtimer_events &= ~BIT(FUSBH200_HRTIMER_DISABLE_ASYNC); enable_async()
2966 fusbh200_poll_ASS(fusbh200); enable_async()
2967 turn_on_io_watchdog(fusbh200); enable_async()
2970 static void disable_async(struct fusbh200_hcd *fusbh200) disable_async() argument
2972 if (--fusbh200->async_count) disable_async()
2976 WARN_ON(fusbh200->async->qh_next.qh || fusbh200->async_unlink); disable_async()
2979 fusbh200_poll_ASS(fusbh200); disable_async()
2984 static void qh_link_async (struct fusbh200_hcd *fusbh200, struct fusbh200_qh *qh) qh_link_async() argument
2986 __hc32 dma = QH_NEXT(fusbh200, qh->qh_dma); qh_link_async()
2996 qh_refresh(fusbh200, qh); qh_link_async()
2999 head = fusbh200->async; qh_link_async()
3011 enable_async(fusbh200); qh_link_async()
3023 struct fusbh200_hcd *fusbh200, qh_append_tds()
3031 __hc32 qh_addr_mask = cpu_to_hc32(fusbh200, 0x7f); qh_append_tds()
3035 /* can't sleep here, we have fusbh200->lock... */ qh_append_tds()
3036 qh = qh_make (fusbh200, urb, GFP_ATOMIC); qh_append_tds()
3070 qtd->hw_token = HALT_BIT(fusbh200); qh_append_tds()
3082 fusbh200_qtd_init(fusbh200, qtd, qtd->qtd_dma); qh_append_tds()
3089 qtd->hw_next = QTD_NEXT(fusbh200, dma); qh_append_tds()
3105 struct fusbh200_hcd *fusbh200, submit_async()
3121 fusbh200_dbg(fusbh200, submit_async()
3130 spin_lock_irqsave (&fusbh200->lock, flags); submit_async()
3131 if (unlikely(!HCD_HW_ACCESSIBLE(fusbh200_to_hcd(fusbh200)))) { submit_async()
3135 rc = usb_hcd_link_urb_to_ep(fusbh200_to_hcd(fusbh200), urb); submit_async()
3139 qh = qh_append_tds(fusbh200, urb, qtd_list, epnum, &urb->ep->hcpriv); submit_async()
3141 usb_hcd_unlink_urb_from_ep(fusbh200_to_hcd(fusbh200), urb); submit_async()
3150 qh_link_async(fusbh200, qh); submit_async()
3152 spin_unlock_irqrestore (&fusbh200->lock, flags); submit_async()
3154 qtd_list_free (fusbh200, urb, qtd_list); submit_async()
3160 static void single_unlink_async(struct fusbh200_hcd *fusbh200, struct fusbh200_qh *qh) single_unlink_async() argument
3166 if (fusbh200->async_unlink) single_unlink_async()
3167 fusbh200->async_unlink_last->unlink_next = qh; single_unlink_async()
3169 fusbh200->async_unlink = qh; single_unlink_async()
3170 fusbh200->async_unlink_last = qh; single_unlink_async()
3173 prev = fusbh200->async; single_unlink_async()
3179 if (fusbh200->qh_scan_next == qh) single_unlink_async()
3180 fusbh200->qh_scan_next = qh->qh_next.qh; single_unlink_async()
3183 static void start_iaa_cycle(struct fusbh200_hcd *fusbh200, bool nested) start_iaa_cycle() argument
3189 if (fusbh200->async_iaa || fusbh200->async_unlinking) start_iaa_cycle()
3193 fusbh200->async_iaa = fusbh200->async_unlink; start_iaa_cycle()
3194 fusbh200->async_unlink = NULL; start_iaa_cycle()
3197 if (unlikely(fusbh200->rh_state < FUSBH200_RH_RUNNING)) { start_iaa_cycle()
3199 end_unlink_async(fusbh200); start_iaa_cycle()
3202 } else if (likely(fusbh200->rh_state == FUSBH200_RH_RUNNING)) { start_iaa_cycle()
3206 fusbh200_writel(fusbh200, fusbh200->command | CMD_IAAD, start_iaa_cycle()
3207 &fusbh200->regs->command); start_iaa_cycle()
3208 fusbh200_readl(fusbh200, &fusbh200->regs->command); start_iaa_cycle()
3209 fusbh200_enable_event(fusbh200, FUSBH200_HRTIMER_IAA_WATCHDOG, true); start_iaa_cycle()
3215 static void end_unlink_async(struct fusbh200_hcd *fusbh200) end_unlink_async() argument
3221 fusbh200->async_unlinking = true; end_unlink_async()
3222 while (fusbh200->async_iaa) { end_unlink_async()
3223 qh = fusbh200->async_iaa; end_unlink_async()
3224 fusbh200->async_iaa = qh->unlink_next; end_unlink_async()
3230 qh_completions(fusbh200, qh); end_unlink_async()
3232 fusbh200->rh_state == FUSBH200_RH_RUNNING) end_unlink_async()
3233 qh_link_async(fusbh200, qh); end_unlink_async()
3234 disable_async(fusbh200); end_unlink_async()
3236 fusbh200->async_unlinking = false; end_unlink_async()
3239 if (fusbh200->async_unlink) { end_unlink_async()
3240 start_iaa_cycle(fusbh200, true); end_unlink_async()
3241 if (unlikely(fusbh200->rh_state < FUSBH200_RH_RUNNING)) end_unlink_async()
3246 static void unlink_empty_async(struct fusbh200_hcd *fusbh200) unlink_empty_async() argument
3249 bool stopped = (fusbh200->rh_state < FUSBH200_RH_RUNNING); unlink_empty_async()
3253 next = fusbh200->async->qh_next.qh; unlink_empty_async()
3261 fusbh200->async_unlink_cycle) unlink_empty_async()
3264 single_unlink_async(fusbh200, qh); unlink_empty_async()
3269 if (fusbh200->async_unlink) unlink_empty_async()
3270 start_iaa_cycle(fusbh200, false); unlink_empty_async()
3274 fusbh200_enable_event(fusbh200, FUSBH200_HRTIMER_ASYNC_UNLINKS, true); unlink_empty_async()
3275 ++fusbh200->async_unlink_cycle; unlink_empty_async()
3280 /* caller must own fusbh200->lock */
3282 static void start_unlink_async(struct fusbh200_hcd *fusbh200, struct fusbh200_qh *qh) start_unlink_async() argument
3295 single_unlink_async(fusbh200, qh); start_unlink_async()
3296 start_iaa_cycle(fusbh200, false); start_unlink_async()
3301 static void scan_async (struct fusbh200_hcd *fusbh200) scan_async() argument
3306 fusbh200->qh_scan_next = fusbh200->async->qh_next.qh; scan_async()
3307 while (fusbh200->qh_scan_next) { scan_async()
3308 qh = fusbh200->qh_scan_next; scan_async()
3309 fusbh200->qh_scan_next = qh->qh_next.qh; scan_async()
3317 * drops the lock. That's why fusbh200->qh_scan_next scan_async()
3319 * gets unlinked then fusbh200->qh_scan_next is adjusted scan_async()
3322 temp = qh_completions(fusbh200, qh); scan_async()
3324 start_unlink_async(fusbh200, qh); scan_async()
3327 qh->unlink_cycle = fusbh200->async_unlink_cycle; scan_async()
3340 if (check_unlinks_later && fusbh200->rh_state == FUSBH200_RH_RUNNING && scan_async()
3341 !(fusbh200->enabled_hrtimer_events & scan_async()
3343 fusbh200_enable_event(fusbh200, FUSBH200_HRTIMER_ASYNC_UNLINKS, true); scan_async()
3344 ++fusbh200->async_unlink_cycle; scan_async()
3371 periodic_next_shadow(struct fusbh200_hcd *fusbh200, union fusbh200_shadow *periodic, periodic_next_shadow() argument
3374 switch (hc32_to_cpu(fusbh200, tag)) { periodic_next_shadow()
3385 shadow_next_periodic(struct fusbh200_hcd *fusbh200, union fusbh200_shadow *periodic, shadow_next_periodic() argument
3388 switch (hc32_to_cpu(fusbh200, tag)) { shadow_next_periodic()
3398 /* caller must hold fusbh200->lock */ periodic_unlink()
3399 static void periodic_unlink (struct fusbh200_hcd *fusbh200, unsigned frame, void *ptr) periodic_unlink() argument
3401 union fusbh200_shadow *prev_p = &fusbh200->pshadow[frame]; periodic_unlink()
3402 __hc32 *hw_p = &fusbh200->periodic[frame]; periodic_unlink()
3407 prev_p = periodic_next_shadow(fusbh200, prev_p, periodic_unlink()
3408 Q_NEXT_TYPE(fusbh200, *hw_p)); periodic_unlink()
3409 hw_p = shadow_next_periodic(fusbh200, &here, periodic_unlink()
3410 Q_NEXT_TYPE(fusbh200, *hw_p)); periodic_unlink()
3420 *prev_p = *periodic_next_shadow(fusbh200, &here, periodic_unlink()
3421 Q_NEXT_TYPE(fusbh200, *hw_p)); periodic_unlink()
3423 *hw_p = *shadow_next_periodic(fusbh200, &here, periodic_unlink()
3424 Q_NEXT_TYPE(fusbh200, *hw_p)); periodic_unlink()
3429 periodic_usecs (struct fusbh200_hcd *fusbh200, unsigned frame, unsigned uframe) periodic_usecs() argument
3431 __hc32 *hw_p = &fusbh200->periodic [frame]; periodic_usecs()
3432 union fusbh200_shadow *q = &fusbh200->pshadow [frame]; periodic_usecs()
3437 switch (hc32_to_cpu(fusbh200, Q_NEXT_TYPE(fusbh200, *hw_p))) { periodic_usecs()
3441 if (hw->hw_info2 & cpu_to_hc32(fusbh200, 1 << uframe)) periodic_usecs()
3444 if (hw->hw_info2 & cpu_to_hc32(fusbh200, periodic_usecs()
3455 if (q->fstn->hw_prev != FUSBH200_LIST_END(fusbh200)) { periodic_usecs()
3456 fusbh200_dbg (fusbh200, "ignoring FSTN cost ...\n"); periodic_usecs()
3469 if (usecs > fusbh200->uframe_periodic_max) periodic_usecs()
3470 fusbh200_err (fusbh200, "uframe %d sched overrun: %d usecs\n", periodic_usecs()
3494 struct fusbh200_hcd *fusbh200, tt_no_collision()
3508 for (; frame < fusbh200->periodic_size; frame += period) { tt_no_collision()
3513 here = fusbh200->pshadow [frame]; tt_no_collision()
3514 type = Q_NEXT_TYPE(fusbh200, fusbh200->periodic [frame]); tt_no_collision()
3516 switch (hc32_to_cpu(fusbh200, type)) { tt_no_collision()
3518 type = Q_NEXT_TYPE(fusbh200, here.itd->hw_next); tt_no_collision()
3526 mask = hc32_to_cpu(fusbh200, tt_no_collision()
3533 type = Q_NEXT_TYPE(fusbh200, hw->hw_next); tt_no_collision()
3538 fusbh200_dbg (fusbh200, tt_no_collision()
3554 static void enable_periodic(struct fusbh200_hcd *fusbh200) enable_periodic() argument
3556 if (fusbh200->periodic_count++) enable_periodic()
3560 fusbh200->enabled_hrtimer_events &= ~BIT(FUSBH200_HRTIMER_DISABLE_PERIODIC); enable_periodic()
3563 fusbh200_poll_PSS(fusbh200); enable_periodic()
3564 turn_on_io_watchdog(fusbh200); enable_periodic()
3567 static void disable_periodic(struct fusbh200_hcd *fusbh200) disable_periodic() argument
3569 if (--fusbh200->periodic_count) disable_periodic()
3573 fusbh200_poll_PSS(fusbh200); disable_periodic()
3582 * no FSTN support (yet; fusbh200 0.96+)
3584 static void qh_link_periodic(struct fusbh200_hcd *fusbh200, struct fusbh200_qh *qh) qh_link_periodic() argument
3591 period, hc32_to_cpup(fusbh200, &qh->hw->hw_info2) qh_link_periodic()
3599 for (i = qh->start; i < fusbh200->periodic_size; i += period) { qh_link_periodic()
3600 union fusbh200_shadow *prev = &fusbh200->pshadow[i]; qh_link_periodic()
3601 __hc32 *hw_p = &fusbh200->periodic[i]; qh_link_periodic()
3607 type = Q_NEXT_TYPE(fusbh200, *hw_p); qh_link_periodic()
3608 if (type == cpu_to_hc32(fusbh200, Q_TYPE_QH)) qh_link_periodic()
3610 prev = periodic_next_shadow(fusbh200, prev, type); qh_link_periodic()
3611 hw_p = shadow_next_periodic(fusbh200, &here, type); qh_link_periodic()
3632 *hw_p = QH_NEXT (fusbh200, qh->qh_dma); qh_link_periodic()
3639 fusbh200_to_hcd(fusbh200)->self.bandwidth_allocated += qh->period qh_link_periodic()
3643 list_add(&qh->intr_node, &fusbh200->intr_qh_list); qh_link_periodic()
3646 ++fusbh200->intr_count; qh_link_periodic()
3647 enable_periodic(fusbh200); qh_link_periodic()
3650 static void qh_unlink_periodic(struct fusbh200_hcd *fusbh200, struct fusbh200_qh *qh) qh_unlink_periodic() argument
3674 for (i = qh->start; i < fusbh200->periodic_size; i += period) qh_unlink_periodic()
3675 periodic_unlink (fusbh200, i, qh); qh_unlink_periodic()
3678 fusbh200_to_hcd(fusbh200)->self.bandwidth_allocated -= qh->period qh_unlink_periodic()
3685 hc32_to_cpup(fusbh200, &qh->hw->hw_info2) & (QH_CMASK | QH_SMASK), qh_unlink_periodic()
3692 if (fusbh200->qh_scan_next == qh) qh_unlink_periodic()
3693 fusbh200->qh_scan_next = list_entry(qh->intr_node.next, qh_unlink_periodic()
3698 static void start_unlink_intr(struct fusbh200_hcd *fusbh200, struct fusbh200_qh *qh) start_unlink_intr() argument
3710 qh_unlink_periodic (fusbh200, qh); start_unlink_intr()
3720 qh->unlink_cycle = fusbh200->intr_unlink_cycle; start_unlink_intr()
3723 if (fusbh200->intr_unlink) start_unlink_intr()
3724 fusbh200->intr_unlink_last->unlink_next = qh; start_unlink_intr()
3726 fusbh200->intr_unlink = qh; start_unlink_intr()
3727 fusbh200->intr_unlink_last = qh; start_unlink_intr()
3729 if (fusbh200->intr_unlinking) start_unlink_intr()
3731 else if (fusbh200->rh_state < FUSBH200_RH_RUNNING) start_unlink_intr()
3732 fusbh200_handle_intr_unlinks(fusbh200); start_unlink_intr()
3733 else if (fusbh200->intr_unlink == qh) { start_unlink_intr()
3734 fusbh200_enable_event(fusbh200, FUSBH200_HRTIMER_UNLINK_INTR, true); start_unlink_intr()
3735 ++fusbh200->intr_unlink_cycle; start_unlink_intr()
3739 static void end_unlink_intr(struct fusbh200_hcd *fusbh200, struct fusbh200_qh *qh) end_unlink_intr() argument
3745 hw->hw_next = FUSBH200_LIST_END(fusbh200); end_unlink_intr()
3747 qh_completions(fusbh200, qh); end_unlink_intr()
3750 if (!list_empty(&qh->qtd_list) && fusbh200->rh_state == FUSBH200_RH_RUNNING) { end_unlink_intr()
3751 rc = qh_schedule(fusbh200, qh); end_unlink_intr()
3760 fusbh200_err(fusbh200, "can't reschedule qh %p, err %d\n", end_unlink_intr()
3765 --fusbh200->intr_count; end_unlink_intr()
3766 disable_periodic(fusbh200); end_unlink_intr()
3772 struct fusbh200_hcd *fusbh200, check_period()
3787 usecs = fusbh200->uframe_periodic_max - usecs; check_period()
3795 claimed = periodic_usecs (fusbh200, frame, uframe); check_period()
3799 } while ((frame += 1) < fusbh200->periodic_size); check_period()
3804 claimed = periodic_usecs (fusbh200, frame, uframe); check_period()
3807 } while ((frame += period) < fusbh200->periodic_size); check_period()
3815 struct fusbh200_hcd *fusbh200, check_intr_schedule()
3828 if (!check_period (fusbh200, frame, uframe, qh->period, qh->usecs)) check_intr_schedule()
3844 *c_maskp = cpu_to_hc32(fusbh200, mask << 8); check_intr_schedule()
3847 if (tt_no_collision (fusbh200, qh->period, qh->dev, frame, mask)) { check_intr_schedule()
3848 if (!check_period (fusbh200, frame, uframe + qh->gap_uf + 1, check_intr_schedule()
3851 if (!check_period (fusbh200, frame, uframe + qh->gap_uf, check_intr_schedule()
3863 static int qh_schedule(struct fusbh200_hcd *fusbh200, struct fusbh200_qh *qh) qh_schedule() argument
3871 qh_refresh(fusbh200, qh); qh_schedule()
3872 hw->hw_next = FUSBH200_LIST_END(fusbh200); qh_schedule()
3877 uframe = ffs(hc32_to_cpup(fusbh200, &hw->hw_info2) & QH_SMASK); qh_schedule()
3878 status = check_intr_schedule (fusbh200, frame, --uframe, qh_schedule()
3895 frame = ++fusbh200->random_frame % qh->period; qh_schedule()
3897 status = check_intr_schedule (fusbh200, qh_schedule()
3908 status = check_intr_schedule (fusbh200, 0, 0, qh, &c_mask); qh_schedule()
3915 hw->hw_info2 &= cpu_to_hc32(fusbh200, ~(QH_CMASK | QH_SMASK)); qh_schedule()
3917 ? cpu_to_hc32(fusbh200, 1 << uframe) qh_schedule()
3918 : cpu_to_hc32(fusbh200, QH_SMASK); qh_schedule()
3921 fusbh200_dbg (fusbh200, "reused qh %p schedule\n", qh); qh_schedule()
3924 qh_link_periodic(fusbh200, qh); qh_schedule()
3930 struct fusbh200_hcd *fusbh200, intr_submit()
3944 spin_lock_irqsave (&fusbh200->lock, flags); intr_submit()
3946 if (unlikely(!HCD_HW_ACCESSIBLE(fusbh200_to_hcd(fusbh200)))) { intr_submit()
3950 status = usb_hcd_link_urb_to_ep(fusbh200_to_hcd(fusbh200), urb); intr_submit()
3956 qh = qh_append_tds(fusbh200, urb, &empty, epnum, &urb->ep->hcpriv); intr_submit()
3962 if ((status = qh_schedule (fusbh200, qh)) != 0) intr_submit()
3967 qh = qh_append_tds(fusbh200, urb, qtd_list, epnum, &urb->ep->hcpriv); intr_submit()
3971 fusbh200_to_hcd(fusbh200)->self.bandwidth_int_reqs++; intr_submit()
3975 usb_hcd_unlink_urb_from_ep(fusbh200_to_hcd(fusbh200), urb); intr_submit()
3977 spin_unlock_irqrestore (&fusbh200->lock, flags); intr_submit()
3979 qtd_list_free (fusbh200, urb, qtd_list); intr_submit()
3984 static void scan_intr(struct fusbh200_hcd *fusbh200) scan_intr() argument
3988 list_for_each_entry_safe(qh, fusbh200->qh_scan_next, &fusbh200->intr_qh_list, scan_intr()
3997 * drops the lock. That's why fusbh200->qh_scan_next scan_intr()
3999 * gets unlinked then fusbh200->qh_scan_next is adjusted scan_intr()
4002 temp = qh_completions(fusbh200, qh); scan_intr()
4006 start_unlink_intr(fusbh200, qh); scan_intr()
4033 struct fusbh200_hcd *fusbh200, iso_stream_init()
4064 stream->buf0 = cpu_to_hc32(fusbh200, (epnum << 8) | dev->devnum); iso_stream_init()
4065 stream->buf1 = cpu_to_hc32(fusbh200, buf1); iso_stream_init()
4066 stream->buf2 = cpu_to_hc32(fusbh200, multi); iso_stream_init()
4091 iso_stream_find (struct fusbh200_hcd *fusbh200, struct urb *urb) iso_stream_find() argument
4104 spin_lock_irqsave (&fusbh200->lock, flags); iso_stream_find()
4112 iso_stream_init(fusbh200, stream, urb->dev, urb->pipe, iso_stream_find()
4118 fusbh200_dbg (fusbh200, "dev %s ep%d%s, not iso??\n", iso_stream_find()
4124 spin_unlock_irqrestore (&fusbh200->lock, flags); iso_stream_find()
4148 struct fusbh200_hcd *fusbh200, itd_sched_init()
4178 uframe->transaction = cpu_to_hc32(fusbh200, trans); itd_sched_init()
4196 // caller must hold fusbh200->lock! iso_sched_free()
4204 struct fusbh200_hcd *fusbh200, itd_urb_transaction()
4220 itd_sched_init(fusbh200, sched, stream, urb); itd_urb_transaction()
4228 spin_lock_irqsave (&fusbh200->lock, flags); itd_urb_transaction()
4238 if (itd->frame == fusbh200->now_frame) itd_urb_transaction()
4244 spin_unlock_irqrestore (&fusbh200->lock, flags); itd_urb_transaction()
4245 itd = dma_pool_alloc (fusbh200->itd_pool, mem_flags, itd_urb_transaction()
4247 spin_lock_irqsave (&fusbh200->lock, flags); itd_urb_transaction()
4250 spin_unlock_irqrestore(&fusbh200->lock, flags); itd_urb_transaction()
4259 spin_unlock_irqrestore (&fusbh200->lock, flags); itd_urb_transaction()
4271 struct fusbh200_hcd *fusbh200, itd_slot_ok()
4281 if (periodic_usecs (fusbh200, uframe >> 3, uframe & 0x7) itd_slot_ok()
4282 > (fusbh200->uframe_periodic_max - usecs)) itd_slot_ok()
4296 * Also avoid queue depths of less than fusbh200's worst irq latency (affected
4306 struct fusbh200_hcd *fusbh200, iso_stream_schedule()
4313 unsigned mod = fusbh200->periodic_size << 3; iso_stream_schedule()
4320 fusbh200_dbg (fusbh200, "iso request %p too long\n", urb); iso_stream_schedule()
4325 now = fusbh200_read_frame_index(fusbh200) & (mod - 1); iso_stream_schedule()
4340 if (!stream->highspeed && fusbh200->fs_i_thresh) iso_stream_schedule()
4341 next = now + fusbh200->i_thresh; iso_stream_schedule()
4356 fusbh200_dbg(fusbh200, "request %p would overflow (%d+%d >= %d)\n", iso_stream_schedule()
4365 * this is bigger than fusbh200->i_thresh allows; scheduling itself iso_stream_schedule()
4386 if (itd_slot_ok(fusbh200, mod, start, iso_stream_schedule()
4393 fusbh200_dbg(fusbh200, "iso resched full %p (now %d max %d)\n", iso_stream_schedule()
4403 fusbh200_dbg(fusbh200, "request %p would overflow (%d+%d >= %d)\n", iso_stream_schedule()
4418 if (fusbh200->isoc_count == 0) iso_stream_schedule()
4419 fusbh200->next_frame = now >> 3; iso_stream_schedule()
4431 itd_init(struct fusbh200_hcd *fusbh200, struct fusbh200_iso_stream *stream, itd_init() argument
4437 itd->hw_next = FUSBH200_LIST_END(fusbh200); itd_init()
4450 struct fusbh200_hcd *fusbh200, itd_patch()
4466 itd->hw_transaction[uframe] |= cpu_to_hc32(fusbh200, pg << 12); itd_patch()
4467 itd->hw_bufp[pg] |= cpu_to_hc32(fusbh200, uf->bufp & ~(u32)0); itd_patch()
4468 itd->hw_bufp_hi[pg] |= cpu_to_hc32(fusbh200, (u32)(uf->bufp >> 32)); itd_patch()
4475 itd->hw_bufp[pg] |= cpu_to_hc32(fusbh200, bufp & ~(u32)0); itd_patch()
4476 itd->hw_bufp_hi[pg] |= cpu_to_hc32(fusbh200, (u32)(bufp >> 32)); itd_patch()
4481 itd_link (struct fusbh200_hcd *fusbh200, unsigned frame, struct fusbh200_itd *itd) itd_link() argument
4483 union fusbh200_shadow *prev = &fusbh200->pshadow[frame]; itd_link()
4484 __hc32 *hw_p = &fusbh200->periodic[frame]; itd_link()
4490 type = Q_NEXT_TYPE(fusbh200, *hw_p); itd_link()
4491 if (type == cpu_to_hc32(fusbh200, Q_TYPE_QH)) itd_link()
4493 prev = periodic_next_shadow(fusbh200, prev, type); itd_link()
4494 hw_p = shadow_next_periodic(fusbh200, &here, type); itd_link()
4503 *hw_p = cpu_to_hc32(fusbh200, itd->itd_dma | Q_TYPE_ITD); itd_link()
4508 struct fusbh200_hcd *fusbh200, itd_link_urb()
4522 fusbh200_to_hcd(fusbh200)->self.bandwidth_allocated itd_link_urb()
4524 fusbh200_dbg(fusbh200, itd_link_urb()
4545 itd_init (fusbh200, stream, itd); itd_link_urb()
4551 itd_patch(fusbh200, itd, iso_sched, packet, uframe); itd_link_urb()
4560 itd_link(fusbh200, frame & (fusbh200->periodic_size - 1), itd); itd_link_urb()
4570 ++fusbh200->isoc_count; itd_link_urb()
4571 enable_periodic(fusbh200); itd_link_urb()
4586 static bool itd_complete(struct fusbh200_hcd *fusbh200, struct fusbh200_itd *itd) itd_complete() argument
4604 t = hc32_to_cpup(fusbh200, &itd->hw_transaction [uframe]); itd_complete()
4645 fusbh200_urb_done(fusbh200, urb, 0); itd_complete()
4649 --fusbh200->isoc_count; itd_complete()
4650 disable_periodic(fusbh200); itd_complete()
4653 fusbh200_to_hcd(fusbh200)->self.bandwidth_allocated itd_complete()
4655 fusbh200_dbg(fusbh200, itd_complete()
4670 &fusbh200->cached_itd_list); itd_complete()
4671 start_free_itds(fusbh200); itd_complete()
4679 static int itd_submit (struct fusbh200_hcd *fusbh200, struct urb *urb, itd_submit() argument
4687 stream = iso_stream_find (fusbh200, urb); itd_submit()
4689 fusbh200_dbg (fusbh200, "can't get iso stream\n"); itd_submit()
4693 fusbh200_port_speed(fusbh200, 0) == USB_PORT_STAT_HIGH_SPEED)) { itd_submit()
4694 fusbh200_dbg (fusbh200, "can't change iso interval %d --> %d\n", itd_submit()
4700 fusbh200_dbg (fusbh200, itd_submit()
4711 status = itd_urb_transaction (stream, fusbh200, urb, mem_flags); itd_submit()
4713 fusbh200_dbg (fusbh200, "can't init itds\n"); itd_submit()
4718 spin_lock_irqsave (&fusbh200->lock, flags); itd_submit()
4719 if (unlikely(!HCD_HW_ACCESSIBLE(fusbh200_to_hcd(fusbh200)))) { itd_submit()
4723 status = usb_hcd_link_urb_to_ep(fusbh200_to_hcd(fusbh200), urb); itd_submit()
4726 status = iso_stream_schedule(fusbh200, urb, stream); itd_submit()
4728 itd_link_urb (fusbh200, urb, fusbh200->periodic_size << 3, stream); itd_submit()
4730 usb_hcd_unlink_urb_from_ep(fusbh200_to_hcd(fusbh200), urb); itd_submit()
4732 spin_unlock_irqrestore (&fusbh200->lock, flags); itd_submit()
4739 static void scan_isoc(struct fusbh200_hcd *fusbh200) scan_isoc() argument
4742 unsigned fmask = fusbh200->periodic_size - 1; scan_isoc()
4750 if (fusbh200->rh_state >= FUSBH200_RH_RUNNING) { scan_isoc()
4751 uf = fusbh200_read_frame_index(fusbh200); scan_isoc()
4755 now_frame = (fusbh200->next_frame - 1) & fmask; scan_isoc()
4758 fusbh200->now_frame = now_frame; scan_isoc()
4760 frame = fusbh200->next_frame; scan_isoc()
4767 q_p = &fusbh200->pshadow [frame]; scan_isoc()
4768 hw_p = &fusbh200->periodic [frame]; scan_isoc()
4770 type = Q_NEXT_TYPE(fusbh200, *hw_p); scan_isoc()
4774 switch (hc32_to_cpu(fusbh200, type)) { scan_isoc()
4785 ITD_ACTIVE(fusbh200)) scan_isoc()
4791 type = Q_NEXT_TYPE(fusbh200, scan_isoc()
4805 type = Q_NEXT_TYPE(fusbh200, q.itd->hw_next); scan_isoc()
4807 modified = itd_complete (fusbh200, q.itd); scan_isoc()
4811 fusbh200_dbg(fusbh200, "corrupt type %d frame %d shadow %p\n", scan_isoc()
4823 if (unlikely(modified && fusbh200->isoc_count > 0)) scan_isoc()
4832 fusbh200->next_frame = now_frame; scan_isoc()
4842 struct fusbh200_hcd *fusbh200; show_uframe_periodic_max() local
4845 fusbh200 = hcd_to_fusbh200(bus_to_hcd(dev_get_drvdata(dev))); show_uframe_periodic_max()
4846 n = scnprintf(buf, PAGE_SIZE, "%d\n", fusbh200->uframe_periodic_max); show_uframe_periodic_max()
4855 struct fusbh200_hcd *fusbh200; store_uframe_periodic_max() local
4862 fusbh200 = hcd_to_fusbh200(bus_to_hcd(dev_get_drvdata(dev))); store_uframe_periodic_max()
4867 fusbh200_info(fusbh200, "rejecting invalid request for " store_uframe_periodic_max()
4878 spin_lock_irqsave (&fusbh200->lock, flags); store_uframe_periodic_max()
4885 if (uframe_periodic_max < fusbh200->uframe_periodic_max) { store_uframe_periodic_max()
4888 for (frame = 0; frame < fusbh200->periodic_size; ++frame) store_uframe_periodic_max()
4891 periodic_usecs (fusbh200, frame, uframe)); store_uframe_periodic_max()
4894 fusbh200_info(fusbh200, store_uframe_periodic_max()
4905 fusbh200_info(fusbh200, "setting max periodic bandwidth to %u%% " store_uframe_periodic_max()
4910 fusbh200_warn(fusbh200, "max periodic bandwidth set is non-standard\n"); store_uframe_periodic_max()
4912 fusbh200->uframe_periodic_max = uframe_periodic_max; store_uframe_periodic_max()
4916 spin_unlock_irqrestore (&fusbh200->lock, flags); store_uframe_periodic_max()
4922 static inline int create_sysfs_files(struct fusbh200_hcd *fusbh200) create_sysfs_files() argument
4924 struct device *controller = fusbh200_to_hcd(fusbh200)->self.controller; create_sysfs_files()
4935 static inline void remove_sysfs_files(struct fusbh200_hcd *fusbh200) remove_sysfs_files() argument
4937 struct device *controller = fusbh200_to_hcd(fusbh200)->self.controller; remove_sysfs_files()
4947 static void fusbh200_turn_off_all_ports(struct fusbh200_hcd *fusbh200) fusbh200_turn_off_all_ports() argument
4949 u32 __iomem *status_reg = &fusbh200->regs->port_status; fusbh200_turn_off_all_ports()
4951 fusbh200_writel(fusbh200, PORT_RWC_BITS, status_reg); fusbh200_turn_off_all_ports()
4958 static void fusbh200_silence_controller(struct fusbh200_hcd *fusbh200) fusbh200_silence_controller() argument
4960 fusbh200_halt(fusbh200); fusbh200_silence_controller()
4962 spin_lock_irq(&fusbh200->lock); fusbh200_silence_controller()
4963 fusbh200->rh_state = FUSBH200_RH_HALTED; fusbh200_silence_controller()
4964 fusbh200_turn_off_all_ports(fusbh200); fusbh200_silence_controller()
4965 spin_unlock_irq(&fusbh200->lock); fusbh200_silence_controller()
4974 struct fusbh200_hcd *fusbh200 = hcd_to_fusbh200(hcd); fusbh200_shutdown() local
4976 spin_lock_irq(&fusbh200->lock); fusbh200_shutdown()
4977 fusbh200->shutdown = true; fusbh200_shutdown()
4978 fusbh200->rh_state = FUSBH200_RH_STOPPING; fusbh200_shutdown()
4979 fusbh200->enabled_hrtimer_events = 0; fusbh200_shutdown()
4980 spin_unlock_irq(&fusbh200->lock); fusbh200_shutdown()
4982 fusbh200_silence_controller(fusbh200); fusbh200_shutdown()
4984 hrtimer_cancel(&fusbh200->hrtimer); fusbh200_shutdown()
4991 * it calls driver completion functions, after dropping fusbh200->lock.
4993 static void fusbh200_work (struct fusbh200_hcd *fusbh200) fusbh200_work() argument
4995 /* another CPU may drop fusbh200->lock during a schedule scan while fusbh200_work()
4999 if (fusbh200->scanning) { fusbh200_work()
5000 fusbh200->need_rescan = true; fusbh200_work()
5003 fusbh200->scanning = true; fusbh200_work()
5006 fusbh200->need_rescan = false; fusbh200_work()
5007 if (fusbh200->async_count) fusbh200_work()
5008 scan_async(fusbh200); fusbh200_work()
5009 if (fusbh200->intr_count > 0) fusbh200_work()
5010 scan_intr(fusbh200); fusbh200_work()
5011 if (fusbh200->isoc_count > 0) fusbh200_work()
5012 scan_isoc(fusbh200); fusbh200_work()
5013 if (fusbh200->need_rescan) fusbh200_work()
5015 fusbh200->scanning = false; fusbh200_work()
5021 turn_on_io_watchdog(fusbh200); fusbh200_work()
5029 struct fusbh200_hcd *fusbh200 = hcd_to_fusbh200 (hcd); fusbh200_stop() local
5031 fusbh200_dbg (fusbh200, "stop\n"); fusbh200_stop()
5035 spin_lock_irq(&fusbh200->lock); fusbh200_stop()
5036 fusbh200->enabled_hrtimer_events = 0; fusbh200_stop()
5037 spin_unlock_irq(&fusbh200->lock); fusbh200_stop()
5039 fusbh200_quiesce(fusbh200); fusbh200_stop()
5040 fusbh200_silence_controller(fusbh200); fusbh200_stop()
5041 fusbh200_reset (fusbh200); fusbh200_stop()
5043 hrtimer_cancel(&fusbh200->hrtimer); fusbh200_stop()
5044 remove_sysfs_files(fusbh200); fusbh200_stop()
5045 remove_debug_files (fusbh200); fusbh200_stop()
5048 spin_lock_irq (&fusbh200->lock); fusbh200_stop()
5049 end_free_itds(fusbh200); fusbh200_stop()
5050 spin_unlock_irq (&fusbh200->lock); fusbh200_stop()
5051 fusbh200_mem_cleanup (fusbh200); fusbh200_stop()
5053 fusbh200_dbg(fusbh200, "irq normal %ld err %ld iaa %ld (lost %ld)\n", fusbh200_stop()
5054 fusbh200->stats.normal, fusbh200->stats.error, fusbh200->stats.iaa, fusbh200_stop()
5055 fusbh200->stats.lost_iaa); fusbh200_stop()
5056 fusbh200_dbg (fusbh200, "complete %ld unlink %ld\n", fusbh200_stop()
5057 fusbh200->stats.complete, fusbh200->stats.unlink); fusbh200_stop()
5059 dbg_status (fusbh200, "fusbh200_stop completed", fusbh200_stop()
5060 fusbh200_readl(fusbh200, &fusbh200->regs->status)); fusbh200_stop()
5066 struct fusbh200_hcd *fusbh200 = hcd_to_fusbh200(hcd); hcd_fusbh200_init() local
5072 spin_lock_init(&fusbh200->lock); hcd_fusbh200_init()
5077 fusbh200->need_io_watchdog = 1; hcd_fusbh200_init()
5079 hrtimer_init(&fusbh200->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS); hcd_fusbh200_init()
5080 fusbh200->hrtimer.function = fusbh200_hrtimer_func; hcd_fusbh200_init()
5081 fusbh200->next_hrtimer_event = FUSBH200_HRTIMER_NO_EVENT; hcd_fusbh200_init()
5083 hcc_params = fusbh200_readl(fusbh200, &fusbh200->caps->hcc_params); hcd_fusbh200_init()
5089 fusbh200->uframe_periodic_max = 100; hcd_fusbh200_init()
5095 fusbh200->periodic_size = DEFAULT_I_TDPS; hcd_fusbh200_init()
5096 INIT_LIST_HEAD(&fusbh200->intr_qh_list); hcd_fusbh200_init()
5097 INIT_LIST_HEAD(&fusbh200->cached_itd_list); hcd_fusbh200_init()
5102 case 0: fusbh200->periodic_size = 1024; break; hcd_fusbh200_init()
5103 case 1: fusbh200->periodic_size = 512; break; hcd_fusbh200_init()
5104 case 2: fusbh200->periodic_size = 256; break; hcd_fusbh200_init()
5108 if ((retval = fusbh200_mem_init(fusbh200, GFP_KERNEL)) < 0) hcd_fusbh200_init()
5112 fusbh200->i_thresh = 2; hcd_fusbh200_init()
5121 fusbh200->async->qh_next.qh = NULL; hcd_fusbh200_init()
5122 hw = fusbh200->async->hw; hcd_fusbh200_init()
5123 hw->hw_next = QH_NEXT(fusbh200, fusbh200->async->qh_dma); hcd_fusbh200_init()
5124 hw->hw_info1 = cpu_to_hc32(fusbh200, QH_HEAD); hcd_fusbh200_init()
5125 hw->hw_token = cpu_to_hc32(fusbh200, QTD_STS_HALT); hcd_fusbh200_init()
5126 hw->hw_qtd_next = FUSBH200_LIST_END(fusbh200); hcd_fusbh200_init()
5127 fusbh200->async->qh_state = QH_STATE_LINKED; hcd_fusbh200_init()
5128 hw->hw_alt_next = QTD_NEXT(fusbh200, fusbh200->async->dummy->qtd_dma); hcd_fusbh200_init()
5147 fusbh200_dbg(fusbh200, "park %d\n", park); hcd_fusbh200_init()
5154 fusbh200->command = temp; hcd_fusbh200_init()
5165 struct fusbh200_hcd *fusbh200 = hcd_to_fusbh200 (hcd); fusbh200_run() local
5173 fusbh200_writel(fusbh200, fusbh200->periodic_dma, &fusbh200->regs->frame_list); fusbh200_run()
5174 fusbh200_writel(fusbh200, (u32)fusbh200->async->qh_dma, &fusbh200->regs->async_next); fusbh200_run()
5177 * hcc_params controls whether fusbh200->regs->segment must (!!!) fusbh200_run()
5188 hcc_params = fusbh200_readl(fusbh200, &fusbh200->caps->hcc_params); fusbh200_run()
5192 fusbh200->command &= ~(CMD_IAAD|CMD_PSE|CMD_ASE|CMD_RESET); fusbh200_run()
5193 fusbh200->command |= CMD_RUN; fusbh200_run()
5194 fusbh200_writel(fusbh200, fusbh200->command, &fusbh200->regs->command); fusbh200_run()
5195 dbg_cmd (fusbh200, "init", fusbh200->command); fusbh200_run()
5212 fusbh200->rh_state = FUSBH200_RH_RUNNING; fusbh200_run()
5213 fusbh200_readl(fusbh200, &fusbh200->regs->command); /* unblock posted writes */ fusbh200_run()
5216 fusbh200->last_periodic_enable = ktime_get_real(); fusbh200_run()
5218 temp = HC_VERSION(fusbh200, fusbh200_readl(fusbh200, &fusbh200->caps->hc_capbase)); fusbh200_run()
5219 fusbh200_info (fusbh200, fusbh200_run()
5221 ((fusbh200->sbrn & 0xf0)>>4), (fusbh200->sbrn & 0x0f), fusbh200_run()
5224 fusbh200_writel(fusbh200, INTR_MASK, fusbh200_run()
5225 &fusbh200->regs->intr_enable); /* Turn On Interrupts */ fusbh200_run()
5231 create_debug_files(fusbh200); fusbh200_run()
5232 create_sysfs_files(fusbh200); fusbh200_run()
5239 struct fusbh200_hcd *fusbh200 = hcd_to_fusbh200(hcd); fusbh200_setup() local
5242 fusbh200->regs = (void __iomem *)fusbh200->caps + fusbh200_setup()
5243 HC_LENGTH(fusbh200, fusbh200_readl(fusbh200, &fusbh200->caps->hc_capbase)); fusbh200_setup()
5244 dbg_hcs_params(fusbh200, "reset"); fusbh200_setup()
5245 dbg_hcc_params(fusbh200, "reset"); fusbh200_setup()
5248 fusbh200->hcs_params = fusbh200_readl(fusbh200, &fusbh200->caps->hcs_params); fusbh200_setup()
5250 fusbh200->sbrn = HCD_USB2; fusbh200_setup()
5257 retval = fusbh200_halt(fusbh200); fusbh200_setup()
5261 fusbh200_reset(fusbh200); fusbh200_setup()
5270 struct fusbh200_hcd *fusbh200 = hcd_to_fusbh200 (hcd); fusbh200_irq() local
5274 spin_lock (&fusbh200->lock); fusbh200_irq()
5276 status = fusbh200_readl(fusbh200, &fusbh200->regs->status); fusbh200_irq()
5280 fusbh200_dbg (fusbh200, "device removed\n"); fusbh200_irq()
5291 if (!masked_status || unlikely(fusbh200->rh_state == FUSBH200_RH_HALTED)) { fusbh200_irq()
5292 spin_unlock(&fusbh200->lock); fusbh200_irq()
5297 fusbh200_writel(fusbh200, masked_status, &fusbh200->regs->status); fusbh200_irq()
5298 cmd = fusbh200_readl(fusbh200, &fusbh200->regs->command); fusbh200_irq()
5304 COUNT (fusbh200->stats.normal); fusbh200_irq()
5306 COUNT (fusbh200->stats.error); fusbh200_irq()
5314 fusbh200->enabled_hrtimer_events &= ~BIT(FUSBH200_HRTIMER_IAA_WATCHDOG); fusbh200_irq()
5323 if (fusbh200->next_hrtimer_event == FUSBH200_HRTIMER_IAA_WATCHDOG) fusbh200_irq()
5324 ++fusbh200->next_hrtimer_event; fusbh200_irq()
5328 fusbh200_dbg(fusbh200, "IAA with IAAD still set?\n"); fusbh200_irq()
5329 if (fusbh200->async_iaa) { fusbh200_irq()
5330 COUNT(fusbh200->stats.iaa); fusbh200_irq()
5331 end_unlink_async(fusbh200); fusbh200_irq()
5333 fusbh200_dbg(fusbh200, "IAA with nothing unlinked?\n"); fusbh200_irq()
5339 u32 __iomem *status_reg = &fusbh200->regs->port_status; fusbh200_irq()
5345 if (fusbh200->rh_state == FUSBH200_RH_SUSPENDED) fusbh200_irq()
5348 pstatus = fusbh200_readl(fusbh200, status_reg); fusbh200_irq()
5350 if (test_bit(0, &fusbh200->suspended_ports) && fusbh200_irq()
5354 fusbh200->reset_done[0] == 0) { fusbh200_irq()
5361 fusbh200->reset_done[0] = jiffies + msecs_to_jiffies(25); fusbh200_irq()
5362 set_bit(0, &fusbh200->resuming_ports); fusbh200_irq()
5363 fusbh200_dbg (fusbh200, "port 1 remote wakeup\n"); fusbh200_irq()
5364 mod_timer(&hcd->rh_timer, fusbh200->reset_done[0]); fusbh200_irq()
5370 fusbh200_err(fusbh200, "fatal error\n"); fusbh200_irq()
5371 dbg_cmd(fusbh200, "fatal", cmd); fusbh200_irq()
5372 dbg_status(fusbh200, "fatal", status); fusbh200_irq()
5377 fusbh200->shutdown = true; fusbh200_irq()
5378 fusbh200->rh_state = FUSBH200_RH_STOPPING; fusbh200_irq()
5379 fusbh200->command &= ~(CMD_RUN | CMD_ASE | CMD_PSE); fusbh200_irq()
5380 fusbh200_writel(fusbh200, fusbh200->command, &fusbh200->regs->command); fusbh200_irq()
5381 fusbh200_writel(fusbh200, 0, &fusbh200->regs->intr_enable); fusbh200_irq()
5382 fusbh200_handle_controller_death(fusbh200); fusbh200_irq()
5389 fusbh200_work (fusbh200); fusbh200_irq()
5390 spin_unlock (&fusbh200->lock); fusbh200_irq()
5415 struct fusbh200_hcd *fusbh200 = hcd_to_fusbh200 (hcd); fusbh200_urb_enqueue() local
5430 if (!qh_urb_transaction (fusbh200, urb, &qtd_list, mem_flags)) fusbh200_urb_enqueue()
5432 return submit_async(fusbh200, urb, &qtd_list, mem_flags); fusbh200_urb_enqueue()
5435 if (!qh_urb_transaction (fusbh200, urb, &qtd_list, mem_flags)) fusbh200_urb_enqueue()
5437 return intr_submit(fusbh200, urb, &qtd_list, mem_flags); fusbh200_urb_enqueue()
5440 return itd_submit (fusbh200, urb, mem_flags); fusbh200_urb_enqueue()
5450 struct fusbh200_hcd *fusbh200 = hcd_to_fusbh200 (hcd); fusbh200_urb_dequeue() local
5455 spin_lock_irqsave (&fusbh200->lock, flags); fusbh200_urb_dequeue()
5470 start_unlink_async(fusbh200, qh); fusbh200_urb_dequeue()
5478 qh_completions(fusbh200, qh); fusbh200_urb_dequeue()
5490 start_unlink_intr(fusbh200, qh); fusbh200_urb_dequeue()
5493 qh_completions (fusbh200, qh); fusbh200_urb_dequeue()
5496 fusbh200_dbg (fusbh200, "bogus qh %p state %d\n", fusbh200_urb_dequeue()
5510 spin_unlock_irqrestore (&fusbh200->lock, flags); fusbh200_urb_dequeue()
5521 struct fusbh200_hcd *fusbh200 = hcd_to_fusbh200 (hcd); fusbh200_endpoint_disable() local
5529 spin_lock_irqsave (&fusbh200->lock, flags); fusbh200_endpoint_disable()
5548 if (fusbh200->rh_state < FUSBH200_RH_RUNNING) fusbh200_endpoint_disable()
5553 for (tmp = fusbh200->async->qh_next.qh; fusbh200_endpoint_disable()
5561 start_unlink_async(fusbh200, qh); fusbh200_endpoint_disable()
5566 spin_unlock_irqrestore (&fusbh200->lock, flags); fusbh200_endpoint_disable()
5573 qh_destroy(fusbh200, qh); fusbh200_endpoint_disable()
5581 fusbh200_err (fusbh200, "qh %p (#%02x) state %d%s\n", fusbh200_endpoint_disable()
5588 spin_unlock_irqrestore (&fusbh200->lock, flags); fusbh200_endpoint_disable()
5594 struct fusbh200_hcd *fusbh200 = hcd_to_fusbh200(hcd); fusbh200_endpoint_reset() local
5604 spin_lock_irqsave(&fusbh200->lock, flags); fusbh200_endpoint_reset()
5624 start_unlink_async(fusbh200, qh); fusbh200_endpoint_reset()
5626 start_unlink_intr(fusbh200, qh); fusbh200_endpoint_reset()
5629 spin_unlock_irqrestore(&fusbh200->lock, flags); fusbh200_endpoint_reset()
5634 struct fusbh200_hcd *fusbh200 = hcd_to_fusbh200 (hcd); fusbh200_get_frame() local
5635 return (fusbh200_read_frame_index(fusbh200) >> 3) % fusbh200->periodic_size; fusbh200_get_frame()
5644 * give the fusbh200 driver exclusive access to those.
5696 static void fusbh200_init(struct fusbh200_hcd *fusbh200) fusbh200_init() argument
5700 reg = fusbh200_readl(fusbh200, &fusbh200->regs->bmcsr); fusbh200_init()
5703 fusbh200_writel(fusbh200, reg, &fusbh200->regs->bmcsr); fusbh200_init()
5705 reg = fusbh200_readl(fusbh200, &fusbh200->regs->bmier); fusbh200_init()
5706 fusbh200_writel(fusbh200, reg | BMIER_OVC_EN | BMIER_VBUS_ERR_EN, fusbh200_init()
5707 &fusbh200->regs->bmier); fusbh200_init()
5724 struct fusbh200_hcd *fusbh200; fusbh200_hcd_probe() local
5785 fusbh200 = hcd_to_fusbh200(hcd); fusbh200_hcd_probe()
5787 fusbh200->caps = hcd->regs; fusbh200_hcd_probe()
5793 fusbh200_init(fusbh200); fusbh200_hcd_probe()
5841 .name = "fusbh200",
5866 fusbh200_debug_root = debugfs_create_dir("fusbh200", usb_debug_root); fusbh200_hcd_init()
364 qh_lines( struct fusbh200_hcd *fusbh200, struct fusbh200_qh *qh, char **nextp, unsigned *sizep ) qh_lines() argument
1386 check_reset_complete( struct fusbh200_hcd *fusbh200, int index, u32 __iomem *status_reg, int port_status ) check_reset_complete() argument
1463 fusbh200_hub_descriptor( struct fusbh200_hcd *fusbh200, struct usb_hub_descriptor *desc ) fusbh200_hub_descriptor() argument
2185 qtd_copy_status( struct fusbh200_hcd *fusbh200, struct urb *urb, size_t length, u32 token ) qtd_copy_status() argument
2578 qtd_list_free( struct fusbh200_hcd *fusbh200, struct urb *urb, struct list_head *qtd_list ) qtd_list_free() argument
2598 qh_urb_transaction( struct fusbh200_hcd *fusbh200, struct urb *urb, struct list_head *head, gfp_t flags ) qh_urb_transaction() argument
2783 qh_make( struct fusbh200_hcd *fusbh200, struct urb *urb, gfp_t flags ) qh_make() argument
3022 qh_append_tds( struct fusbh200_hcd *fusbh200, struct urb *urb, struct list_head *qtd_list, int epnum, void **ptr ) qh_append_tds() argument
3104 submit_async( struct fusbh200_hcd *fusbh200, struct urb *urb, struct list_head *qtd_list, gfp_t mem_flags ) submit_async() argument
3493 tt_no_collision( struct fusbh200_hcd *fusbh200, unsigned period, struct usb_device *dev, unsigned frame, u32 uf_mask ) tt_no_collision() argument
3771 check_period( struct fusbh200_hcd *fusbh200, unsigned frame, unsigned uframe, unsigned period, unsigned usecs ) check_period() argument
3814 check_intr_schedule( struct fusbh200_hcd *fusbh200, unsigned frame, unsigned uframe, const struct fusbh200_qh *qh, __hc32 *c_maskp ) check_intr_schedule() argument
3929 intr_submit( struct fusbh200_hcd *fusbh200, struct urb *urb, struct list_head *qtd_list, gfp_t mem_flags ) intr_submit() argument
4032 iso_stream_init( struct fusbh200_hcd *fusbh200, struct fusbh200_iso_stream *stream, struct usb_device *dev, int pipe, unsigned interval ) iso_stream_init() argument
4147 itd_sched_init( struct fusbh200_hcd *fusbh200, struct fusbh200_iso_sched *iso_sched, struct fusbh200_iso_stream *stream, struct urb *urb ) itd_sched_init() argument
4202 itd_urb_transaction( struct fusbh200_iso_stream *stream, struct fusbh200_hcd *fusbh200, struct urb *urb, gfp_t mem_flags ) itd_urb_transaction() argument
4270 itd_slot_ok( struct fusbh200_hcd *fusbh200, u32 mod, u32 uframe, u8 usecs, u32 period ) itd_slot_ok() argument
4305 iso_stream_schedule( struct fusbh200_hcd *fusbh200, struct urb *urb, struct fusbh200_iso_stream *stream ) iso_stream_schedule() argument
4449 itd_patch( struct fusbh200_hcd *fusbh200, struct fusbh200_itd *itd, struct fusbh200_iso_sched *iso_sched, unsigned index, u16 uframe ) itd_patch() argument
4507 itd_link_urb( struct fusbh200_hcd *fusbh200, struct urb *urb, unsigned mod, struct fusbh200_iso_stream *stream ) itd_link_urb() argument
H A Dfusbh200.h182 static inline struct usb_hcd *fusbh200_to_hcd (struct fusbh200_hcd *fusbh200) fusbh200_to_hcd() argument
184 return container_of ((void *) fusbh200, struct usb_hcd, hcd_priv); fusbh200_to_hcd()
200 #define HC_LENGTH(fusbh200, p) (0x00ff&((p) >> /* bits 7:0 / offset 00h */ \
201 (fusbh200_big_endian_capbase(fusbh200) ? 24 : 0)))
202 #define HC_VERSION(fusbh200, p) (0xffff&((p) >> /* bits 31:16 / offset 02h */ \
203 (fusbh200_big_endian_capbase(fusbh200) ? 0 : 16)))
292 #define QTD_NEXT(fusbh200, dma) cpu_to_hc32(fusbh200, (u32)dma)
321 #define ACTIVE_BIT(fusbh200) cpu_to_hc32(fusbh200, QTD_STS_ACTIVE)
322 #define HALT_BIT(fusbh200) cpu_to_hc32(fusbh200, QTD_STS_HALT)
323 #define STATUS_BIT(fusbh200) cpu_to_hc32(fusbh200, QTD_STS_STS)
336 #define QTD_MASK(fusbh200) cpu_to_hc32 (fusbh200, ~0x1f)
343 #define Q_NEXT_TYPE(fusbh200,dma) ((dma) & cpu_to_hc32(fusbh200, 3 << 1))
359 #define QH_NEXT(fusbh200,dma) (cpu_to_hc32(fusbh200, (((u32)dma)&~0x01f)|Q_TYPE_QH))
362 #define FUSBH200_LIST_END(fusbh200) cpu_to_hc32(fusbh200, 1) /* "null pointer" to hw */
534 #define ITD_ACTIVE(fusbh200) cpu_to_hc32(fusbh200, FUSBH200_ISOC_ACTIVE)
577 #define fusbh200_prepare_ports_for_controller_suspend(fusbh200, do_wakeup) \
578 fusbh200_adjust_port_wakeup_flags(fusbh200, true, do_wakeup);
580 #define fusbh200_prepare_ports_for_controller_resume(fusbh200) \
581 fusbh200_adjust_port_wakeup_flags(fusbh200, false, false);
593 fusbh200_get_speed(struct fusbh200_hcd *fusbh200, unsigned int portsc) fusbh200_get_speed() argument
595 return (readl(&fusbh200->regs->bmcsr) fusbh200_get_speed()
601 fusbh200_port_speed(struct fusbh200_hcd *fusbh200, unsigned int portsc) fusbh200_port_speed() argument
603 switch (fusbh200_get_speed(fusbh200, portsc)) { fusbh200_port_speed()
632 static inline unsigned int fusbh200_readl(const struct fusbh200_hcd *fusbh200, fusbh200_readl() argument
638 static inline void fusbh200_writel(const struct fusbh200_hcd *fusbh200, fusbh200_writel() argument
644 /* cpu to fusbh200 */ cpu_to_hc32()
645 static inline __hc32 cpu_to_hc32 (const struct fusbh200_hcd *fusbh200, const u32 x) cpu_to_hc32() argument
650 /* fusbh200 to cpu */ hc32_to_cpu()
651 static inline u32 hc32_to_cpu (const struct fusbh200_hcd *fusbh200, const __hc32 x) hc32_to_cpu() argument
656 static inline u32 hc32_to_cpup (const struct fusbh200_hcd *fusbh200, const __hc32 *x) hc32_to_cpup() argument
663 static inline unsigned fusbh200_read_frame_index(struct fusbh200_hcd *fusbh200) fusbh200_read_frame_index() argument
665 return fusbh200_readl(fusbh200, &fusbh200->regs->frame_index); fusbh200_read_frame_index()
H A DMakefile74 obj-$(CONFIG_USB_FUSBH200_HCD) += fusbh200-hcd.o

Completed in 130 milliseconds