Lines Matching refs:ed

143 static void periodic_link (struct ohci_hcd *ohci, struct ed *ed)  in periodic_link()  argument
148 (ed->hwINFO & cpu_to_hc32 (ohci, ED_ISO)) ? "iso " : "", in periodic_link()
149 ed, ed->branch, ed->load, ed->interval); in periodic_link()
151 for (i = ed->branch; i < NUM_INTS; i += ed->interval) { in periodic_link()
152 struct ed **prev = &ohci->periodic [i]; in periodic_link()
154 struct ed *here = *prev; in periodic_link()
160 while (here && ed != here) { in periodic_link()
161 if (ed->interval > here->interval) in periodic_link()
167 if (ed != here) { in periodic_link()
168 ed->ed_next = here; in periodic_link()
170 ed->hwNextED = *prev_p; in periodic_link()
172 *prev = ed; in periodic_link()
173 *prev_p = cpu_to_hc32(ohci, ed->dma); in periodic_link()
176 ohci->load [i] += ed->load; in periodic_link()
178 ohci_to_hcd(ohci)->self.bandwidth_allocated += ed->load / ed->interval; in periodic_link()
183 static int ed_schedule (struct ohci_hcd *ohci, struct ed *ed) in ed_schedule() argument
187 ed->ed_prev = NULL; in ed_schedule()
188 ed->ed_next = NULL; in ed_schedule()
189 ed->hwNextED = 0; in ed_schedule()
202 switch (ed->type) { in ed_schedule()
206 ohci_writel (ohci, ed->dma, in ed_schedule()
209 ohci->ed_controltail->ed_next = ed; in ed_schedule()
211 ed->dma); in ed_schedule()
213 ed->ed_prev = ohci->ed_controltail; in ed_schedule()
221 ohci->ed_controltail = ed; in ed_schedule()
227 ohci_writel (ohci, ed->dma, &ohci->regs->ed_bulkhead); in ed_schedule()
229 ohci->ed_bulktail->ed_next = ed; in ed_schedule()
231 ed->dma); in ed_schedule()
233 ed->ed_prev = ohci->ed_bulktail; in ed_schedule()
241 ohci->ed_bulktail = ed; in ed_schedule()
247 branch = balance (ohci, ed->interval, ed->load); in ed_schedule()
251 branch, ed->interval, ed->load); in ed_schedule()
255 ed->branch = branch; in ed_schedule()
256 periodic_link (ohci, ed); in ed_schedule()
263 ed->state = ED_OPER; in ed_schedule()
270 static void periodic_unlink (struct ohci_hcd *ohci, struct ed *ed) in periodic_unlink() argument
274 for (i = ed->branch; i < NUM_INTS; i += ed->interval) { in periodic_unlink()
275 struct ed *temp; in periodic_unlink()
276 struct ed **prev = &ohci->periodic [i]; in periodic_unlink()
279 while (*prev && (temp = *prev) != ed) { in periodic_unlink()
284 *prev_p = ed->hwNextED; in periodic_unlink()
285 *prev = ed->ed_next; in periodic_unlink()
287 ohci->load [i] -= ed->load; in periodic_unlink()
289 ohci_to_hcd(ohci)->self.bandwidth_allocated -= ed->load / ed->interval; in periodic_unlink()
292 (ed->hwINFO & cpu_to_hc32 (ohci, ED_ISO)) ? "iso " : "", in periodic_unlink()
293 ed, ed->branch, ed->load, ed->interval); in periodic_unlink()
317 static void ed_deschedule (struct ohci_hcd *ohci, struct ed *ed) in ed_deschedule() argument
319 ed->hwINFO |= cpu_to_hc32 (ohci, ED_SKIP); in ed_deschedule()
321 ed->state = ED_UNLINK; in ed_deschedule()
333 switch (ed->type) { in ed_deschedule()
336 if (ed->ed_prev == NULL) { in ed_deschedule()
337 if (!ed->hwNextED) { in ed_deschedule()
344 hc32_to_cpup (ohci, &ed->hwNextED), in ed_deschedule()
347 ed->ed_prev->ed_next = ed->ed_next; in ed_deschedule()
348 ed->ed_prev->hwNextED = ed->hwNextED; in ed_deschedule()
351 if (ohci->ed_controltail == ed) { in ed_deschedule()
352 ohci->ed_controltail = ed->ed_prev; in ed_deschedule()
355 } else if (ed->ed_next) { in ed_deschedule()
356 ed->ed_next->ed_prev = ed->ed_prev; in ed_deschedule()
362 if (ed->ed_prev == NULL) { in ed_deschedule()
363 if (!ed->hwNextED) { in ed_deschedule()
370 hc32_to_cpup (ohci, &ed->hwNextED), in ed_deschedule()
373 ed->ed_prev->ed_next = ed->ed_next; in ed_deschedule()
374 ed->ed_prev->hwNextED = ed->hwNextED; in ed_deschedule()
377 if (ohci->ed_bulktail == ed) { in ed_deschedule()
378 ohci->ed_bulktail = ed->ed_prev; in ed_deschedule()
381 } else if (ed->ed_next) { in ed_deschedule()
382 ed->ed_next->ed_prev = ed->ed_prev; in ed_deschedule()
389 periodic_unlink (ohci, ed); in ed_deschedule()
400 static struct ed *ed_get ( in ed_get()
407 struct ed *ed; in ed_get() local
412 ed = ep->hcpriv; in ed_get()
413 if (!ed) { in ed_get()
418 ed = ed_alloc (ohci, GFP_ATOMIC); in ed_get()
419 if (!ed) { in ed_get()
428 ed_free (ohci, ed); in ed_get()
429 ed = NULL; in ed_get()
432 ed->dummy = td; in ed_get()
433 ed->hwTailP = cpu_to_hc32 (ohci, td->td_dma); in ed_get()
434 ed->hwHeadP = ed->hwTailP; /* ED_C, ED_H zeroed */ in ed_get()
435 ed->state = ED_IDLE; in ed_get()
443 ed->type = usb_pipetype(pipe); in ed_get()
450 if (ed->type != PIPE_CONTROL) { in ed_get()
452 if (ed->type != PIPE_BULK) { in ed_get()
454 if (ed->type == PIPE_ISOCHRONOUS) in ed_get()
458 ed->interval = interval; in ed_get()
459 ed->load = usb_calc_bus_time ( in ed_get()
461 ed->type == PIPE_ISOCHRONOUS, in ed_get()
466 ed->hwINFO = cpu_to_hc32(ohci, info); in ed_get()
468 ep->hcpriv = ed; in ed_get()
473 return ed; in ed_get()
484 static void start_ed_unlink (struct ohci_hcd *ohci, struct ed *ed) in start_ed_unlink() argument
486 ed->hwINFO |= cpu_to_hc32 (ohci, ED_DEQUEUE); in start_ed_unlink()
487 ed_deschedule (ohci, ed); in start_ed_unlink()
490 ed->ed_next = ohci->ed_rm_list; in start_ed_unlink()
491 ed->ed_prev = NULL; in start_ed_unlink()
492 ohci->ed_rm_list = ed; in start_ed_unlink()
505 ed->tick = ohci_frame_no(ohci) + 1; in start_ed_unlink()
546 td = urb_priv->td [index] = urb_priv->ed->dummy; in td_fill()
547 urb_priv->ed->dummy = td_pt; in td_fill()
549 td->ed = urb_priv->ed; in td_fill()
572 list_add_tail (&td->td_list, &td->ed->td_list); in td_fill()
581 td->ed->hwTailP = td->hwNextTD; in td_fill()
613 urb_priv->ed->hwHeadP &= ~cpu_to_hc32 (ohci, ED_C); in td_submit_urb()
641 switch (urb_priv->ed->type) { in td_submit_urb()
685 if (urb_priv->ed->type == PIPE_BULK) { in td_submit_urb()
837 struct ed *ed = td->ed; in ed_halted() local
839 __hc32 toggle = ed->hwHeadP & cpu_to_hc32 (ohci, ED_C); in ed_halted()
844 ed->hwINFO |= cpu_to_hc32 (ohci, ED_SKIP); in ed_halted()
846 ed->hwHeadP &= ~cpu_to_hc32 (ohci, ED_H); in ed_halted()
852 while (tmp != &ed->td_list) { in ed_halted()
871 ed->hwHeadP = next->hwNextTD | toggle; in ed_halted()
902 struct ed *ed; in add_to_done_list() local
908 ed = td->ed; in add_to_done_list()
910 list_for_each_entry_continue_reverse(td2, &ed->td_list, td_list) { in add_to_done_list()
929 td2 = ed->pending_td; in add_to_done_list()
931 ed->pending_td = NULL; in add_to_done_list()
964 && (td->ed->hwHeadP & cpu_to_hc32 (ohci, ED_H))) in update_done_list()
978 struct ed *ed, **last; in finish_unlinks() local
981 for (last = &ohci->ed_rm_list, ed = *last; ed != NULL; ed = *last) { in finish_unlinks()
990 tick_before(tick, ed->tick)) { in finish_unlinks()
992 last = &ed->ed_next; in finish_unlinks()
995 if (!list_empty(&ed->td_list)) { in finish_unlinks()
999 td = list_first_entry(&ed->td_list, struct td, td_list); in finish_unlinks()
1002 head = hc32_to_cpu(ohci, ed->hwHeadP) & TD_MASK; in finish_unlinks()
1013 ed->hwHeadP &= ~cpu_to_hc32(ohci, ED_H); in finish_unlinks()
1014 ed->hwNextED = 0; in finish_unlinks()
1016 ed->hwINFO &= ~cpu_to_hc32(ohci, ED_SKIP | ED_DEQUEUE); in finish_unlinks()
1022 *last = ed->ed_next; in finish_unlinks()
1023 ed->ed_next = NULL; in finish_unlinks()
1036 prev = &ed->hwHeadP; in finish_unlinks()
1037 list_for_each_safe (entry, tmp, &ed->td_list) { in finish_unlinks()
1064 ed->hwHeadP &= ~cpu_to_hc32(ohci, ED_C); in finish_unlinks()
1066 ed->hwHeadP |= cpu_to_hc32(ohci, ED_C); in finish_unlinks()
1078 if (completed && !list_empty (&ed->td_list)) in finish_unlinks()
1087 if (list_empty(&ed->td_list)) { in finish_unlinks()
1088 ed->state = ED_IDLE; in finish_unlinks()
1089 list_del(&ed->in_use_list); in finish_unlinks()
1091 ed_schedule(ohci, ed); in finish_unlinks()
1093 ed->ed_next = ohci->ed_rm_list; in finish_unlinks()
1094 ohci->ed_rm_list = ed; in finish_unlinks()
1097 last = &ed->ed_next; in finish_unlinks()
1154 struct ed *ed = td->ed; in takeback_td() local
1166 if (list_empty(&ed->td_list)) { in takeback_td()
1167 if (ed->state == ED_OPER) in takeback_td()
1168 start_ed_unlink(ohci, ed); in takeback_td()
1171 } else if ((ed->hwINFO & cpu_to_hc32(ohci, ED_SKIP | ED_DEQUEUE)) in takeback_td()
1173 td = list_entry(ed->td_list.next, struct td, td_list); in takeback_td()
1175 ed->hwINFO &= ~cpu_to_hc32(ohci, ED_SKIP); in takeback_td()
1177 switch (ed->type) { in takeback_td()