Lines Matching refs:ep
135 struct sl811h_ep *ep, in setup_packet() argument
159 ep->length = 0; in setup_packet()
160 PACKET("SETUP qh%p\n", ep); in setup_packet()
166 struct sl811h_ep *ep, in status_packet() argument
189 ep->length = 0; in status_packet()
190 PACKET("STATUS%s/%s qh%p\n", ep->nak_count ? "/retry" : "", in status_packet()
191 do_out ? "out" : "in", ep); in status_packet()
200 struct sl811h_ep *ep, in in_packet() argument
211 len = ep->maxpacket; in in_packet()
214 && usb_gettoggle(urb->dev, ep->epnum, 0)) in in_packet()
221 writeb(SL_IN | ep->epnum, data_reg); in in_packet()
225 ep->length = min_t(u32, len, in in_packet()
227 PACKET("IN%s/%d qh%p len%d\n", ep->nak_count ? "/retry" : "", in in_packet()
228 !!usb_gettoggle(urb->dev, ep->epnum, 0), ep, len); in in_packet()
236 struct sl811h_ep *ep, in out_packet() argument
250 len = min_t(u32, ep->maxpacket, in out_packet()
254 && usb_gettoggle(urb->dev, ep->epnum, 1)) in out_packet()
264 writeb(SL_OUT | ep->epnum, data_reg); in out_packet()
269 ep->length = len; in out_packet()
270 PACKET("OUT%s/%d qh%p len%d\n", ep->nak_count ? "/retry" : "", in out_packet()
271 !!usb_gettoggle(urb->dev, ep->epnum, 1), ep, len); in out_packet()
303 struct sl811h_ep *ep; in start() local
310 ep = sl811->next_periodic; in start()
311 sl811->next_periodic = ep->next; in start()
314 ep = sl811->next_async; in start()
316 ep = container_of(sl811->async.next, in start()
326 if ((bank && sl811->active_b == ep) || sl811->active_a == ep) in start()
330 if (ep->schedule.next == &sl811->async) in start()
333 sl811->next_async = container_of(ep->schedule.next, in start()
337 if (unlikely(list_empty(&ep->hep->urb_list))) { in start()
339 "empty %p queue?\n", ep); in start()
343 urb = container_of(ep->hep->urb_list.next, struct urb, urb_list); in start()
344 control = ep->defctrl; in start()
356 fclock -= ep->maxpacket << 8; in start()
360 if (ep->period) in start()
368 if (ep->period) in start()
373 } else if (ep->nak_count) in start()
378 switch (ep->nextpid) { in start()
380 in_packet(sl811, ep, urb, bank, control); in start()
383 out_packet(sl811, ep, urb, bank, control); in start()
386 setup_packet(sl811, ep, urb, bank, control); in start()
389 status_packet(sl811, ep, urb, bank, control); in start()
393 "bad ep%p pid %02x\n", ep, ep->nextpid); in start()
394 ep = NULL; in start()
396 return ep; in start()
421 struct sl811h_ep *ep, in finish_request() argument
429 ep->nextpid = USB_PID_SETUP; in finish_request()
437 if (!list_empty(&ep->hep->urb_list)) in finish_request()
441 if (!list_empty(&ep->schedule)) { in finish_request()
442 list_del_init(&ep->schedule); in finish_request()
443 if (ep == sl811->next_async) in finish_request()
450 "deschedule qh%d/%p branch %d\n", ep->period, ep, ep->branch); in finish_request()
451 for (i = ep->branch; i < PERIODIC_SIZE; i += ep->period) { in finish_request()
455 while (*prev && ((temp = *prev) != ep)) in finish_request()
458 *prev = ep->next; in finish_request()
459 sl811->load[i] -= ep->load; in finish_request()
461 ep->branch = PERIODIC_SIZE; in finish_request()
464 -= ep->load / ep->period; in finish_request()
465 if (ep == sl811->next_periodic) in finish_request()
466 sl811->next_periodic = ep->next; in finish_request()
474 done(struct sl811 *sl811, struct sl811h_ep *ep, u8 bank) in done() argument
480 if (unlikely(!ep)) in done()
485 urb = container_of(ep->hep->urb_list.next, struct urb, urb_list); in done()
490 if (!ep->period) in done()
491 ep->nak_count++; in done()
492 ep->error_count = 0; in done()
502 ep->nak_count = ep->error_count = 0; in done()
503 switch (ep->nextpid) { in done()
506 urb->actual_length += ep->length; in done()
507 usb_dotoggle(udev, ep->epnum, 1); in done()
511 ep->nextpid = USB_PID_ACK; in done()
516 else if (ep->length < ep->maxpacket in done()
526 len = ep->maxpacket - sl811_read(sl811, in done()
528 if (len > ep->length) { in done()
529 len = ep->length; in done()
535 usb_dotoggle(udev, ep->epnum, 0); in done()
537 (len < ep->maxpacket || in done()
541 ep->nextpid = USB_PID_ACK; in done()
549 ep->nextpid = USB_PID_ACK; in done()
552 ep->nextpid = USB_PID_OUT; in done()
555 ep->nextpid = USB_PID_IN; in done()
566 PACKET("...STALL_%02x qh%p\n", bank, ep); in done()
567 ep->nak_count = ep->error_count = 0; in done()
571 } else if (++ep->error_count >= 3) { in done()
578 ep->error_count = 0; in done()
580 bank, status, ep, urbstat); in done()
584 finish_request(sl811, ep, urb, urbstat); in done()
800 struct sl811h_ep *ep = NULL; in sl811h_urb_enqueue() local
804 struct usb_host_endpoint *hep = urb->ep; in sl811h_urb_enqueue()
813 ep = kzalloc(sizeof *ep, mem_flags); in sl811h_urb_enqueue()
814 if (ep == NULL) in sl811h_urb_enqueue()
824 kfree(ep); in sl811h_urb_enqueue()
829 kfree(ep); in sl811h_urb_enqueue()
834 kfree(ep); in sl811h_urb_enqueue()
835 ep = hep->hcpriv; in sl811h_urb_enqueue()
836 } else if (!ep) { in sl811h_urb_enqueue()
841 INIT_LIST_HEAD(&ep->schedule); in sl811h_urb_enqueue()
842 ep->udev = udev; in sl811h_urb_enqueue()
843 ep->epnum = epnum; in sl811h_urb_enqueue()
844 ep->maxpacket = usb_maxpacket(udev, urb->pipe, is_out); in sl811h_urb_enqueue()
845 ep->defctrl = SL11H_HCTLMASK_ARM | SL11H_HCTLMASK_ENABLE; in sl811h_urb_enqueue()
849 ep->nextpid = USB_PID_SETUP; in sl811h_urb_enqueue()
851 ep->nextpid = USB_PID_OUT; in sl811h_urb_enqueue()
853 ep->nextpid = USB_PID_IN; in sl811h_urb_enqueue()
855 if (ep->maxpacket > H_MAXPACKET) { in sl811h_urb_enqueue()
859 epnum, ep->maxpacket); in sl811h_urb_enqueue()
861 kfree(ep); in sl811h_urb_enqueue()
868 ep->defctrl |= SL11H_HCTLMASK_PREAMBLE; in sl811h_urb_enqueue()
875 ep->period = urb->interval; in sl811h_urb_enqueue()
876 ep->branch = PERIODIC_SIZE; in sl811h_urb_enqueue()
878 ep->defctrl |= SL11H_HCTLMASK_ISOCH; in sl811h_urb_enqueue()
879 ep->load = usb_calc_bus_time(udev->speed, !is_out, in sl811h_urb_enqueue()
886 ep->hep = hep; in sl811h_urb_enqueue()
887 hep->hcpriv = ep; in sl811h_urb_enqueue()
894 if (list_empty(&ep->schedule)) in sl811h_urb_enqueue()
895 list_add_tail(&ep->schedule, &sl811->async); in sl811h_urb_enqueue()
899 urb->interval = ep->period; in sl811h_urb_enqueue()
900 if (ep->branch < PERIODIC_SIZE) { in sl811h_urb_enqueue()
907 + ep->branch; in sl811h_urb_enqueue()
911 retval = balance(sl811, ep->period, ep->load); in sl811h_urb_enqueue()
914 ep->branch = retval; in sl811h_urb_enqueue()
917 + ep->branch; in sl811h_urb_enqueue()
924 ep->period, ep, ep->branch); in sl811h_urb_enqueue()
925 for (i = ep->branch; i < PERIODIC_SIZE; i += ep->period) { in sl811h_urb_enqueue()
929 while (here && ep != here) { in sl811h_urb_enqueue()
930 if (ep->period > here->period) in sl811h_urb_enqueue()
935 if (ep != here) { in sl811h_urb_enqueue()
936 ep->next = here; in sl811h_urb_enqueue()
937 *prev = ep; in sl811h_urb_enqueue()
939 sl811->load[i] += ep->load; in sl811h_urb_enqueue()
942 hcd->self.bandwidth_allocated += ep->load / ep->period; in sl811h_urb_enqueue()
962 struct sl811h_ep *ep; in sl811h_urb_dequeue() local
971 ep = hep->hcpriv; in sl811h_urb_dequeue()
972 if (ep) { in sl811h_urb_dequeue()
976 if (ep->hep->urb_list.next != &urb->urb_list) { in sl811h_urb_dequeue()
980 } else if (sl811->active_a == ep) { in sl811h_urb_dequeue()
995 } else if (sl811->active_b == ep) { in sl811h_urb_dequeue()
1015 finish_request(sl811, ep, urb, 0); in sl811h_urb_dequeue()
1019 (sl811->active_a == ep) ? "A" : "B"); in sl811h_urb_dequeue()
1030 struct sl811h_ep *ep = hep->hcpriv; in sl811h_endpoint_disable() local
1032 if (!ep) in sl811h_endpoint_disable()
1039 dev_warn(hcd->self.controller, "ep %p not empty?\n", ep); in sl811h_endpoint_disable()
1041 kfree(ep); in sl811h_endpoint_disable()
1386 struct sl811h_ep *ep; in sl811h_show() local
1434 list_for_each_entry (ep, &sl811->async, schedule) { in sl811h_show()
1439 (ep == sl811->active_a) ? "(A) " : "", in sl811h_show()
1440 (ep == sl811->active_b) ? "(B) " : "", in sl811h_show()
1441 ep, ep->epnum, in sl811h_show()
1442 ({ char *s; switch (ep->nextpid) { in sl811h_show()
1449 ep->maxpacket, in sl811h_show()
1450 ep->nak_count, ep->error_count); in sl811h_show()
1451 list_for_each_entry (urb, &ep->hep->urb_list, urb_list) { in sl811h_show()
1463 ep = sl811->periodic[i]; in sl811h_show()
1464 if (!ep) in sl811h_show()
1473 (ep == sl811->active_a) ? "(A) " : "", in sl811h_show()
1474 (ep == sl811->active_b) ? "(B) " : "", in sl811h_show()
1475 ep->period, ep, in sl811h_show()
1476 (ep->udev->speed == USB_SPEED_FULL) in sl811h_show()
1478 ep->udev->devnum, ep->epnum, in sl811h_show()
1479 (ep->epnum == 0) ? "" in sl811h_show()
1480 : ((ep->nextpid == USB_PID_IN) in sl811h_show()
1483 ep->maxpacket, ep->error_count); in sl811h_show()
1484 ep = ep->next; in sl811h_show()
1485 } while (ep); in sl811h_show()